diff --git a/packages/service/common/middle/reqFrequencyLimit.ts b/packages/service/common/middle/reqFrequencyLimit.ts index e2beb1a5e..8f950c75d 100644 --- a/packages/service/common/middle/reqFrequencyLimit.ts +++ b/packages/service/common/middle/reqFrequencyLimit.ts @@ -12,7 +12,7 @@ import { jsonRes } from '../response'; export function useReqFrequencyLimit(seconds: number, limit: number) { return async (req: ApiRequestProps, res: NextApiResponse) => { const ip = requestIp.getClientIp(req); - if (!ip && process.env.USE_IP_LIMIT !== 'true') { + if (!ip || process.env.USE_IP_LIMIT !== 'true') { return; } try { diff --git a/packages/service/core/workflow/dispatch/chat/oneapi.ts b/packages/service/core/workflow/dispatch/chat/oneapi.ts index 475d817b4..2d28bf769 100644 --- a/packages/service/core/workflow/dispatch/chat/oneapi.ts +++ b/packages/service/core/workflow/dispatch/chat/oneapi.ts @@ -45,6 +45,7 @@ import { computedMaxToken, llmCompletionsBodyFormat } from '../../../ai/utils'; import { WorkflowResponseType } from '../type'; import { formatTime2YMDHM } from '@fastgpt/global/common/string/time'; import { AiChatQuoteRoleType } from '@fastgpt/global/core/workflow/template/system/aiChat/type'; +import { getErrText } from '@fastgpt/global/common/error/utils'; export type ChatProps = ModuleDispatchProps< AIChatNodeProps & { @@ -262,7 +263,7 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise { const key = item.key.startsWith('$') ? item.key : `$.${item.key}`; results[item.key] = (() => { - // 检查是否是简单的属性访问或单一索引访问 - if (/^\$(\.[a-zA-Z_][a-zA-Z0-9_]*)+$/.test(key) || /^\$(\[\d+\])+$/.test(key)) { - return JSONPath({ path: key, json: formatResponse })[0]; + const result = JSONPath({ path: key, json: formatResponse }); + + // 如果结果为空,返回 undefined + if (!result || result.length === 0) { + return undefined; } - // 如果无法确定,默认返回数组 - return JSONPath({ path: key, json: formatResponse }); + // 以下情况返回数组: + // 1. 使用通配符 * + // 2. 使用数组切片 [start:end] + // 3. 使用过滤表达式 [?(...)] + // 4. 使用递归下降 .. + // 5. 使用多个结果运算符 , + const needArrayResult = /[*]|[\[][:?]|\.\.|\,/.test(key); + + return needArrayResult ? result : result[0]; })(); }); diff --git a/packages/web/components/common/Tag/index.tsx b/packages/web/components/common/Tag/index.tsx index 35760e7e3..9a714d369 100644 --- a/packages/web/components/common/Tag/index.tsx +++ b/packages/web/components/common/Tag/index.tsx @@ -19,7 +19,7 @@ const colorMap: Record< } > = { white: { - borderColor: 'myGray.400', + borderColor: 'myGray.200', bg: 'white', color: 'myGray.700' }, diff --git a/packages/web/hooks/useConfirm.tsx b/packages/web/hooks/useConfirm.tsx index bc23e6304..b62e7b77b 100644 --- a/packages/web/hooks/useConfirm.tsx +++ b/packages/web/hooks/useConfirm.tsx @@ -75,15 +75,22 @@ export const useConfirm = (props?: { const [requesting, setRequesting] = useState(false); useEffect(() => { - timer.current = setInterval(() => { - setCountDownAmount((val) => { - if (val <= 0) { - clearInterval(timer.current); - } - return val - 1; - }); - }, 1000); - }, []); + if (isOpen) { + setCountDownAmount(countDown); + timer.current = setInterval(() => { + setCountDownAmount((val) => { + if (val <= 0) { + clearInterval(timer.current); + } + return val - 1; + }); + }, 1000); + + return () => { + clearInterval(timer.current); + }; + } + }, [isOpen]); return ( diff --git a/packages/web/i18n/en/app.json b/packages/web/i18n/en/app.json index efa205ead..e93f967de 100644 --- a/packages/web/i18n/en/app.json +++ b/packages/web/i18n/en/app.json @@ -27,7 +27,6 @@ "cron.every_month": "Run Monthly", "cron.every_week": "Run Weekly", "cron.interval": "Run at Intervals", - "current_settings": "Current Configuration", "day": "Day", "document_quote": "Document Reference", "document_quote_tip": "Usually used to accept user-uploaded document content (requires document parsing), and can also be used to reference other string data.", @@ -160,4 +159,4 @@ "workflow.user_file_input_desc": "Links to documents and images uploaded by users.", "workflow.user_select": "User Selection", "workflow.user_select_tip": "This module can configure multiple options for selection during the dialogue. Different options can lead to different workflow branches." -} +} \ No newline at end of file diff --git a/packages/web/i18n/en/common.json b/packages/web/i18n/en/common.json index 8cc64354f..2cd36dcfe 100644 --- a/packages/web/i18n/en/common.json +++ b/packages/web/i18n/en/common.json @@ -624,7 +624,7 @@ "core.dataset.test.test result placeholder": "Test results will be displayed here", "core.dataset.test.test result tip": "Sort based on the similarity between the Dataset content and the test text. You can adjust the corresponding text based on the test results.\nNote: The data in the test records may have been modified. Clicking on a test data will display the latest data.", "core.dataset.training.Agent queue": "QA Training Queue", - "core.dataset.training.Auto mode": "Enhanced Processing (Experimental)", + "core.dataset.training.Auto mode": "Auto Processing", "core.dataset.training.Auto mode Tip": "Increase the semantic richness of data blocks by generating related questions and summaries through sub-indexes and calling models, making it more conducive to retrieval. Requires more storage space and increases AI call times.", "core.dataset.training.Chunk mode": "Direct Segmentation", "core.dataset.training.Full": "Estimated Over 5 Minutes", @@ -1198,4 +1198,4 @@ "verification": "Verification", "xx_search_result": "{{key}} Search Results", "yes": "Yes" -} +} \ No newline at end of file diff --git a/packages/web/i18n/en/dataset.json b/packages/web/i18n/en/dataset.json index b1b8115e2..8f95e0ae8 100644 --- a/packages/web/i18n/en/dataset.json +++ b/packages/web/i18n/en/dataset.json @@ -6,6 +6,10 @@ "common_dataset": "General Dataset", "common_dataset_desc": "Build a Dataset by importing files, web links, or manual input.", "confirm_to_rebuild_embedding_tip": "Are you sure you want to switch the index for the Dataset?\nSwitching the index is a significant operation that requires re-indexing all data in your Dataset, which may take a long time. Please ensure your account has sufficient remaining points.\n\nAdditionally, you need to update the applications that use this Dataset to avoid conflicts with other indexed model Datasets.", + "custom_data_process_params": "Custom", + "custom_data_process_params_desc": "Customize data processing rules", + "data_process_params": "Processing parameters", + "data_process_setting": "Data processing configuration", "dataset.no_collections": "No datasets available", "dataset.no_tags": "No tags available", "external_file": "External File Library", @@ -17,6 +21,10 @@ "file_model_function_tip": "Enhances indexing and QA generation", "filename": "Filename", "folder_dataset": "Folder", + "ideal_chunk_length": "ideal block length", + "ideal_chunk_length_tips": "Segment according to the end symbol and combine multiple segments into one block. This value determines the estimated size of the block, if there is any fluctuation.", + "import.Auto mode Estimated Price Tips": "The text understanding model needs to be called, which requires more points: {{price}} points/1K tokens", + "import.Embedding Estimated Price Tips": "Only use the index model and consume a small amount of AI points: {{price}} points/1K tokens", "permission.des.manage": "Can manage the entire knowledge base data and information", "permission.des.read": "View knowledge base content", "permission.des.write": "Ability to add and change knowledge base content", @@ -33,6 +41,7 @@ "tag.tags": "Tags", "tag.total_tags": "Total {{total}} tags", "the_knowledge_base_has_indexes_that_are_being_trained_or_being_rebuilt": "The Dataset has indexes that are being trained or rebuilt", + "training_mode": "Chunk mode", "website_dataset": "Website Sync", "website_dataset_desc": "Website sync allows you to build a Dataset directly using a web link." } \ No newline at end of file diff --git a/packages/web/i18n/en/login.json b/packages/web/i18n/en/login.json index 305977fa8..a1256d494 100644 --- a/packages/web/i18n/en/login.json +++ b/packages/web/i18n/en/login.json @@ -16,4 +16,4 @@ "agree": "agree", "cookies_tip": " This website uses cookies to provide a better service experience. By continuing to use the site, you agree to our Cookie Policy.", "privacy_policy": "Privacy Policy" -} +} \ No newline at end of file diff --git a/packages/web/i18n/en/workflow.json b/packages/web/i18n/en/workflow.json index 9d58bb9d2..48ded9c3c 100644 --- a/packages/web/i18n/en/workflow.json +++ b/packages/web/i18n/en/workflow.json @@ -54,7 +54,6 @@ "field_description_placeholder": "Describe the function of this input field. If it is a tool call parameter, this description will affect the quality of the model generation.", "field_name_already_exists": "Field name already exists", "field_required": "Required", - "field_used_as_reference": "Support reference", "field_used_as_tool_input": "Used as Tool Call Parameter", "filter_description": "Currently supports filtering by tags and creation time. Fill in the format as follows:\n{\n \"tags\": {\n \"$and\": [\"Tag 1\",\"Tag 2\"],\n \"$or\": [\"When there are $and tags, and is effective, or is not effective\"]\n },\n \"createTime\": {\n \"$gte\": \"YYYY-MM-DD HH:mm format, collection creation time greater than this time\",\n \"$lte\": \"YYYY-MM-DD HH:mm format, collection creation time less than this time, can be used with $gte\"\n }\n}", "form_input_result": "User complete input result", @@ -175,7 +174,6 @@ "tool_params.params_description_placeholder": "Name/Age/SQL statement..", "tool_params.params_name": "Name", "tool_params.params_name_placeholder": "name/age/sql", - "tool_params_config": "Tool params config", "trigger_after_application_completion": "Will be triggered after the application is fully completed", "update_link_error": "Error updating link", "update_specified_node_output_or_global_variable": "Can update the output value of a specified node or update global variables", @@ -185,7 +183,6 @@ "user_form_input_name": "Name", "user_question": "User Question", "user_question_tool_desc": "User input questions (questions need to be improved)", - "value_type": "Value type", "variable_description": "Variable description", "variable_picker_tips": "Type node name or variable name to search", "variable_update": "Variable Update", @@ -193,4 +190,4 @@ "workflow.Switch_success": "Switch Successful", "workflow.Team cloud": "Team Cloud", "workflow.exit_tips": "Your changes have not been saved. 'Exit directly' will not save your edits." -} +} \ No newline at end of file diff --git a/packages/web/i18n/zh/app.json b/packages/web/i18n/zh/app.json index e9af635d9..9b8fda251 100644 --- a/packages/web/i18n/zh/app.json +++ b/packages/web/i18n/zh/app.json @@ -27,7 +27,6 @@ "cron.every_month": "每月执行", "cron.every_week": "每周执行", "cron.interval": "间隔执行", - "current_settings": "当前配置", "day": "日", "document_quote": "文档引用", "document_quote_tip": "通常用于接受用户上传的文档内容(这需要文档解析),也可以用于引用其他字符串数据。", @@ -161,4 +160,4 @@ "workflow.user_file_input_desc": "用户上传的文档和图片链接", "workflow.user_select": "用户选择", "workflow.user_select_tip": "该模块可配置多个选项,以供对话时选择。不同选项可导向不同工作流支线" -} +} \ No newline at end of file diff --git a/packages/web/i18n/zh/chat.json b/packages/web/i18n/zh/chat.json index 720a04bc8..ef327cfdf 100644 --- a/packages/web/i18n/zh/chat.json +++ b/packages/web/i18n/zh/chat.json @@ -41,4 +41,4 @@ "upload": "上传", "view_citations": "查看引用", "web_site_sync": "Web站点同步" -} +} \ No newline at end of file diff --git a/packages/web/i18n/zh/common.json b/packages/web/i18n/zh/common.json index 948b2c8d9..7a546068c 100644 --- a/packages/web/i18n/zh/common.json +++ b/packages/web/i18n/zh/common.json @@ -20,7 +20,6 @@ "Folder": "文件夹", "Login": "登录", "Move": "移动", - "move.confirm": "确认移动", "Name": "名称", "None": "无", "Rename": "重命名", @@ -83,8 +82,6 @@ "code_error.team_error.un_auth": "无权操作该团队", "code_error.team_error.user_not_active": "用户未接受或已离开团队", "code_error.team_error.website_sync_not_enough": "无权使用Web站点同步~", - "code_error.team_error.group_name_duplicate": "群组名称重复", - "code_error.team_error.user_not_active": "用户未接受或已离开团队", "code_error.token_error_code.403": "登录状态无效,请重新登录", "code_error.user_error.balance_not_enough": "账号余额不足~", "code_error.user_error.bin_visitor": "您的身份校验未通过", @@ -544,14 +541,14 @@ "core.dataset.externalFile": "外部文件库", "core.dataset.file": "文件", "core.dataset.folder": "目录", - "core.dataset.import.Auto mode Estimated Price Tips": "需调用文本理解模型,需要消耗较多 tokens:{{price}} 积分/1K tokens", + "core.dataset.import.Auto mode Estimated Price Tips": "需调用文本理解模型,需要消耗较多AI 积分:{{price}} 积分/1K tokens", "core.dataset.import.Auto process": "自动", "core.dataset.import.Auto process desc": "自动设置分割和预处理规则", "core.dataset.import.Chunk Range": "范围:{{min}}~{{max}}", "core.dataset.import.Chunk Split": "直接分段", "core.dataset.import.Chunk Split Tip": "将文本按一定的规则进行分段处理后,转成可进行语义搜索的格式,适合绝大多数场景。不需要调用模型额外处理,成本低。", "core.dataset.import.Custom process": "自定义规则", - "core.dataset.import.Custom process desc": "自定义设置分制和预处理规则", + "core.dataset.import.Custom process desc": "自定义设置数据处理规则", "core.dataset.import.Custom prompt": "自定义提示词", "core.dataset.import.Custom split char": "自定义分隔符", "core.dataset.import.Custom split char Tips": "允许你根据自定义的分隔符进行分块。通常用于已处理好的数据,使用特定的分隔符来精确分块。", @@ -633,7 +630,7 @@ "core.dataset.test.test result placeholder": "测试结果将在这里展示", "core.dataset.test.test result tip": "根据知识库内容与测试文本的相似度进行排序,你可以根据测试结果调整对应的文本。\n注意:测试记录中的数据可能已经被修改过,点击某条测试数据后将展示最新的数据。", "core.dataset.training.Agent queue": "QA 训练排队", - "core.dataset.training.Auto mode": "增强处理(实验)", + "core.dataset.training.Auto mode": "增强处理", "core.dataset.training.Auto mode Tip": "通过子索引以及调用模型生成相关问题与摘要,来增加数据块的语义丰富度,更利于检索。需要消耗更多的存储空间和增加 AI 调用次数。", "core.dataset.training.Chunk mode": "直接分段", "core.dataset.training.Full": "预计 5 分钟以上", @@ -892,6 +889,7 @@ "item_description": "字段描述", "item_name": "字段名", "key_repetition": "key 重复", + "move.confirm": "确认移动", "navbar.Account": "账号", "navbar.Chat": "聊天", "navbar.Datasets": "知识库", @@ -1209,4 +1207,4 @@ "verification": "验证", "xx_search_result": "{{key}} 的搜索结果", "yes": "是" -} +} \ No newline at end of file diff --git a/packages/web/i18n/zh/dataset.json b/packages/web/i18n/zh/dataset.json index 056ab005d..6d1429452 100644 --- a/packages/web/i18n/zh/dataset.json +++ b/packages/web/i18n/zh/dataset.json @@ -6,6 +6,11 @@ "common_dataset": "通用知识库", "common_dataset_desc": "可通过导入文件、网页链接或手动录入形式构建知识库", "confirm_to_rebuild_embedding_tip": "确认为知识库切换索引?\n切换索引是一个非常重量的操作,需要对您知识库内所有数据进行重新索引,时间可能较长,请确保账号内剩余积分充足。\n\n此外,你还需要注意修改选择该知识库的应用,避免它们与其他索引模型知识库混用。", + "custom_data_process_params": "自定义", + "custom_data_process_params_desc": "自定义设置数据处理规则", + "data.ideal_chunk_length": "理想分块长度", + "data_process_params": "处理参数", + "data_process_setting": "数据处理配置", "dataset.no_collections": "暂无数据集", "dataset.no_tags": "暂无标签", "external_file": "外部文件库", @@ -17,6 +22,14 @@ "file_model_function_tip": "用于增强索引和 QA 生成", "filename": "文件名", "folder_dataset": "文件夹", + "ideal_chunk_length": "理想分块长度", + "ideal_chunk_length_tips": "按结束符号进行分段,并将多个分段组成一个分块,该值决定了分块的预估大小,如果会有上下浮动。", + "import.Auto mode Estimated Price Tips": "需调用文本理解模型,需要消耗较多AI 积分:{{price}} 积分/1K tokens", + "import.Embedding Estimated Price Tips": "仅使用索引模型,消耗少量 AI 积分:{{price}} 积分/1K tokens", + "move.hint": "移动后,所选知识库/文件夹将继承新文件夹的权限设置,原先的权限设置失效。", + "permission.des.manage": "可管理整个知识库数据和信息", + "permission.des.read": "可查看知识库内容", + "permission.des.write": "可增加和变更知识库内容", "rebuild_embedding_start_tip": "切换索引模型任务已开始", "rebuilding_index_count": "重建中索引数量:{{count}}", "tag.Add New": "新建", @@ -30,10 +43,7 @@ "tag.tags": "标签", "tag.total_tags": "共{{total}}个标签", "the_knowledge_base_has_indexes_that_are_being_trained_or_being_rebuilt": "知识库有训练中或正在重建的索引", + "training_mode": "处理方式", "website_dataset": "Web 站点同步", - "website_dataset_desc": "Web 站点同步允许你直接使用一个网页链接构建知识库", - "permission.des.read": "可查看知识库内容", - "permission.des.write": "可增加和变更知识库内容", - "permission.des.manage": "可管理整个知识库数据和信息", - "move.hint": "移动后,所选知识库/文件夹将继承新文件夹的权限设置,原先的权限设置失效。" -} + "website_dataset_desc": "Web 站点同步允许你直接使用一个网页链接构建知识库" +} \ No newline at end of file diff --git a/packages/web/i18n/zh/login.json b/packages/web/i18n/zh/login.json index 7cbb446ba..92eb9606b 100644 --- a/packages/web/i18n/zh/login.json +++ b/packages/web/i18n/zh/login.json @@ -16,4 +16,4 @@ "agree": "同意", "cookies_tip": "本网站使用 cookies 提供更好的服务体验。继续使用即表示您同意我们的 Cookie 政策。", "privacy_policy": "隐私政策" -} +} \ No newline at end of file diff --git a/packages/web/i18n/zh/workflow.json b/packages/web/i18n/zh/workflow.json index 8a0b22116..f1b6a116e 100644 --- a/packages/web/i18n/zh/workflow.json +++ b/packages/web/i18n/zh/workflow.json @@ -55,7 +55,6 @@ "field_description_placeholder": "描述该输入字段的功能,如果为工具调用参数,则该描述会影响模型生成的质量", "field_name_already_exists": "字段名已经存在", "field_required": "必填", - "field_used_as_reference": "支持变量引用", "field_used_as_tool_input": "作为工具调用参数", "filter_description": "目前支持标签和创建时间过滤,需按照以下格式填写:\n{\n \"tags\": {\n \"$and\": [\"标签 1\",\"标签 2\"],\n \"$or\": [\"有 $and 标签时,and 生效,or 不生效\"]\n },\n \"createTime\": {\n \"$gte\": \"YYYY-MM-DD HH:mm 格式即可,集合的创建时间大于该时间\",\n \"$lte\": \"YYYY-MM-DD HH:mm 格式即可,集合的创建时间小于该时间,可和 $gte 共同使用\"\n }\n}", "form_input_result": "用户完整输入结果", @@ -186,7 +185,6 @@ "user_form_input_name": "标题", "user_question": "用户问题", "user_question_tool_desc": "用户输入的问题(问题需要完善)", - "value_type": "数据类型", "variable_description": "变量描述", "variable_picker_tips": "可输入节点名或变量名搜索", "variable_update": "变量更新", @@ -194,4 +192,4 @@ "workflow.Switch_success": "切换成功", "workflow.Team cloud": "团队云端", "workflow.exit_tips": "您的更改尚未保存,「直接退出」将不会保存您的编辑记录。" -} +} \ No newline at end of file diff --git a/projects/app/src/components/common/folder/SlideCard.tsx b/projects/app/src/components/common/folder/SlideCard.tsx index 16590c990..90773bed3 100644 --- a/projects/app/src/components/common/folder/SlideCard.tsx +++ b/projects/app/src/components/common/folder/SlideCard.tsx @@ -126,29 +126,11 @@ const FolderSlideCard = ({ - {t('common:support.permission.Permission')} - {!isInheritPermission && ( resumeInheritPermission?.().then(refetchResource)} /> )} - - {managePer.permission.hasManagePer && !!defaultPer && ( - - - {t('common:permission.Default permission')} - - defaultPer.onChange(v)} - hasParent={hasParent} - /> - - )} diff --git a/projects/app/src/components/core/chat/ChatContainer/ChatBox/Input/ChatInput.tsx b/projects/app/src/components/core/chat/ChatContainer/ChatBox/Input/ChatInput.tsx index 305639f76..35cbfdef8 100644 --- a/projects/app/src/components/core/chat/ChatContainer/ChatBox/Input/ChatInput.tsx +++ b/projects/app/src/components/core/chat/ChatContainer/ChatBox/Input/ChatInput.tsx @@ -114,6 +114,35 @@ const ChatInput = ({ renderAudioGraph, stream } = useSpeech({ appId, ...outLinkAuthData }); + const onWhisperRecord = useCallback(() => { + const finishWhisperTranscription = (text: string) => { + if (!text) return; + if (whisperConfig?.autoSend) { + onSendMessage({ + text, + files: fileList, + autoTTSResponse + }); + replaceFiles([]); + } else { + resetInputVal({ text }); + } + }; + if (isSpeaking) { + return stopSpeak(); + } + startSpeak(finishWhisperTranscription); + }, [ + autoTTSResponse, + fileList, + isSpeaking, + onSendMessage, + replaceFiles, + resetInputVal, + startSpeak, + stopSpeak, + whisperConfig?.autoSend + ]); useEffect(() => { if (!stream) { return; @@ -131,28 +160,6 @@ const ChatInput = ({ }; renderCurve(); }, [renderAudioGraph, stream]); - const finishWhisperTranscription = useCallback( - (text: string) => { - if (!text) return; - if (whisperConfig?.autoSend) { - onSendMessage({ - text, - files: fileList, - autoTTSResponse - }); - replaceFiles([]); - } else { - resetInputVal({ text }); - } - }, - [autoTTSResponse, fileList, onSendMessage, replaceFiles, resetInputVal, whisperConfig?.autoSend] - ); - const onWhisperRecord = useCallback(() => { - if (isSpeaking) { - return stopSpeak(); - } - startSpeak(finishWhisperTranscription); - }, [finishWhisperTranscription, isSpeaking, startSpeak, stopSpeak]); const RenderTranslateLoading = useMemo( () => ( diff --git a/projects/app/src/components/support/permission/MemberManager/AddMemberModal.tsx b/projects/app/src/components/support/permission/MemberManager/AddMemberModal.tsx index 3beb58c77..7116e5a8c 100644 --- a/projects/app/src/components/support/permission/MemberManager/AddMemberModal.tsx +++ b/projects/app/src/components/support/permission/MemberManager/AddMemberModal.tsx @@ -95,23 +95,19 @@ function AddMemberModal({ onClose, mode = 'member' }: AddModalPropsType) { iconSrc="modal/AddClb" title={t('user:team.add_collaborator')} minW="800px" + h={'100%'} isCentered isLoading={loadingMembersAndGroups} > - + - + void }) => { ); }; + const PlanUsage = () => { const router = useRouter(); const { t } = useTranslation(); diff --git a/projects/app/src/pages/api/v1/chat/completions.ts b/projects/app/src/pages/api/v1/chat/completions.ts index 3d4d3e67d..2ab925271 100644 --- a/projects/app/src/pages/api/v1/chat/completions.ts +++ b/projects/app/src/pages/api/v1/chat/completions.ts @@ -527,15 +527,14 @@ const authHeaderRequest = async ({ teamId, tmbId, authType, - apikey, - canWrite: apiKeyCanWrite + apikey } = await authCert({ req, authToken: true, authApiKey: true }); - const { app, canWrite } = await (async () => { + const { app } = await (async () => { if (authType === AuthUserTypeEnum.apikey) { if (!apiKeyAppId) { return Promise.reject( @@ -551,16 +550,14 @@ const authHeaderRequest = async ({ appId = String(app._id); return { - app, - canWrite: apiKeyCanWrite + app }; } else { // token_auth - if (!appId) { return Promise.reject('appId is empty'); } - const { app, permission } = await authApp({ + const { app } = await authApp({ req, authToken: true, appId, @@ -568,8 +565,7 @@ const authHeaderRequest = async ({ }); return { - app, - canWrite: permission.hasReadPer + app }; } })(); @@ -579,7 +575,12 @@ const authHeaderRequest = async ({ MongoChat.findOne({ appId, chatId }).lean() ]); - if (chat && (String(chat.teamId) !== teamId || String(chat.tmbId) !== tmbId)) { + if ( + chat && + (String(chat.teamId) !== teamId || + // There's no need to distinguish who created it if it's apiKey auth + (authType === AuthUserTypeEnum.token && String(chat.tmbId) !== tmbId)) + ) { return Promise.reject(ChatErrEnum.unAuthChat); } @@ -591,7 +592,7 @@ const authHeaderRequest = async ({ responseDetail: true, apikey, authType, - canWrite + canWrite: true }; }; diff --git a/projects/app/src/pages/chat/share.tsx b/projects/app/src/pages/chat/share.tsx index 644479fda..adc7f1349 100644 --- a/projects/app/src/pages/chat/share.tsx +++ b/projects/app/src/pages/chat/share.tsx @@ -386,7 +386,7 @@ const Render = (props: Props) => { return ( <> - + {systemLoaded && ( ; diff --git a/projects/app/src/pages/dataset/component/MemberManager.tsx b/projects/app/src/pages/dataset/component/MemberManager.tsx index 3d61275a7..c201d70ea 100644 --- a/projects/app/src/pages/dataset/component/MemberManager.tsx +++ b/projects/app/src/pages/dataset/component/MemberManager.tsx @@ -15,11 +15,11 @@ function MemberManager({ managePer }: { managePer: MemberManagerInputPropsType } return ( <> - - {t('common:permission.Collaborator')} + + {t('common:permission.Collaborator')} - - + + - + - {t('common:core.dataset.import.Data process params')} + {t('dataset:data_process_setting')} - {t('common:core.dataset.import.Training mode')} + {t('dataset:training_mode')} ({ title: t(value.label as any), @@ -107,8 +107,9 @@ function DataProcess({ showPreviewChunks = true }: { showPreviewChunks: boolean flexWrap={'wrap'} /> + - {t('common:core.dataset.import.Process way')} + {t('dataset:data_process_params')} {showChunkInput && chunkSizeField && ( - {t('common:core.dataset.import.Ideal chunk length')} - + {t('dataset:ideal_chunk_length')} + - - {feConfigs?.show_pay && ( - - - {priceTip} - - - )} - + + {feConfigs?.show_pay && ( + + + {priceTip} + + + )} +