Commit 9eb02b7e by Archer Committed by GitHub

feat: plan index;flat i18n and add variable value type (#2762)

* feat: plan index

* flat i18n and add variable value type

* fix: ts

* perf: free plan tip
parent 75af549c
...@@ -91,6 +91,13 @@ ${mdSplitString} ...@@ -91,6 +91,13 @@ ${mdSplitString}
}; };
}; };
/*
1. 自定义分隔符:不需要重叠
2. Markdown 标题:不需要重叠;标题嵌套共享。
3. 特殊 markdown 语法:不需要重叠
4. 段落:尽可能保证它是一个完整的段落。
5. 标点分割:重叠
*/
const commonSplit = (props: SplitProps): SplitResponse => { const commonSplit = (props: SplitProps): SplitResponse => {
let { text = '', chunkLen, overlapRatio = 0.2, customReg = [] } = props; let { text = '', chunkLen, overlapRatio = 0.2, customReg = [] } = props;
......
...@@ -76,6 +76,9 @@ try { ...@@ -76,6 +76,9 @@ try {
SubSchema.index({ teamId: 1, type: 1, expiredTime: -1 }); SubSchema.index({ teamId: 1, type: 1, expiredTime: -1 });
// timer task. Get standard plan;Get free plan;Clear expired extract plan // timer task. Get standard plan;Get free plan;Clear expired extract plan
SubSchema.index({ type: 1, expiredTime: -1, currentSubLevel: 1 }); SubSchema.index({ type: 1, expiredTime: -1, currentSubLevel: 1 });
// unique
SubSchema.index({ teamId: 1, type: 1, currentSubLevel: 1 }, { unique: true });
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
......
...@@ -31,9 +31,7 @@ ...@@ -31,9 +31,7 @@
"no_workflow_response": "No workflow data", "no_workflow_response": "No workflow data",
"plugins_output": "Plugin Output", "plugins_output": "Plugin Output",
"question_tip": "From top to bottom, the response order of each module", "question_tip": "From top to bottom, the response order of each module",
"response": { "response.node_inputs": "Node Inputs",
"node_inputs": "Node Inputs"
},
"select": "Select", "select": "Select",
"select_file": "Upload File", "select_file": "Upload File",
"select_file_img": "Upload file / image", "select_file_img": "Upload file / image",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"Enable": "Enable", "Enable": "Enable",
"collection": { "collection.Create update time": "Creation/Update Time",
"Create update time": "Creation/Update Time", "collection.Training type": "Training Mode",
"Training type": "Training Mode"
},
"collection_tags": "Collection Tags", "collection_tags": "Collection Tags",
"common_dataset": "General Dataset", "common_dataset": "General Dataset",
"common_dataset_desc": "Build a Dataset by importing files, web links, or manual input.", "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.", "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.",
"dataset": { "dataset.no_collections": "No datasets available",
"no_collections": "No datasets available", "dataset.no_tags": "No tags available",
"no_tags": "No tags available"
},
"external_file": "External File Library", "external_file": "External File Library",
"external_file_dataset_desc": "Import files from an external file library to build a Dataset. The files will not be stored again.", "external_file_dataset_desc": "Import files from an external file library to build a Dataset. The files will not be stored again.",
"external_id": "File Reading ID", "external_id": "File Reading ID",
...@@ -21,27 +17,21 @@ ...@@ -21,27 +17,21 @@
"file_model_function_tip": "Enhances indexing and QA generation", "file_model_function_tip": "Enhances indexing and QA generation",
"filename": "Filename", "filename": "Filename",
"folder_dataset": "Folder", "folder_dataset": "Folder",
"permission": { "permission.des.manage": "Can manage the entire knowledge base data and information",
"des": { "permission.des.read": "View knowledge base content",
"manage": "Can manage the entire knowledge base data and information", "permission.des.write": "Ability to add and change knowledge base content",
"read": "View knowledge base content",
"write": "Ability to add and change knowledge base content"
}
},
"rebuild_embedding_start_tip": "Index model switching task has started", "rebuild_embedding_start_tip": "Index model switching task has started",
"rebuilding_index_count": "Number of indexes being rebuilt: {{count}}", "rebuilding_index_count": "Number of indexes being rebuilt: {{count}}",
"tag": { "tag.Add New": "Add New",
"Add New": "Add New", "tag.Add_new_tag": "Add New Tag",
"Add_new_tag": "Add New Tag", "tag.Edit_tag": "Edit Tag",
"Edit_tag": "Edit Tag", "tag.add": "Create",
"add": "Create", "tag.cancel": "Cancel",
"cancel": "Cancel", "tag.delete_tag_confirm": "Confirm to delete the tag?",
"delete_tag_confirm": "Confirm to delete the tag?", "tag.manage": "Tagging",
"manage": "Tagging", "tag.searchOrAddTag": "Search or Add Tag",
"searchOrAddTag": "Search or Add Tag", "tag.tags": "Tags",
"tags": "Tags", "tag.total_tags": "Total {{total}} tags",
"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", "the_knowledge_base_has_indexes_that_are_being_trained_or_being_rebuilt": "The Dataset has indexes that are being trained or rebuilt",
"website_dataset": "Website Sync", "website_dataset": "Website Sync",
"website_dataset_desc": "Website sync allows you to build a Dataset directly using a web link." "website_dataset_desc": "Website sync allows you to build a Dataset directly using a web link."
......
...@@ -14,13 +14,11 @@ ...@@ -14,13 +14,11 @@
"key_tips": "You can use the API key to access specific interfaces (cannot access the application, use the in-app API key for that)", "key_tips": "You can use the API key to access specific interfaces (cannot access the application, use the in-app API key for that)",
"link_name": "Share Link Name", "link_name": "Share Link Name",
"new_feishu_bot": "Add New Feishu Bot", "new_feishu_bot": "Add New Feishu Bot",
"official_account": { "official_account.create_modal_title": "Create WeChat Official Account Integration",
"create_modal_title": "Create WeChat Official Account Integration", "official_account.desc": "Connect to WeChat Official Account directly via API",
"desc": "Connect to WeChat Official Account directly via API", "official_account.edit_modal_title": "Edit WeChat Official Account Integration",
"edit_modal_title": "Edit WeChat Official Account Integration", "official_account.name": "WeChat Official Account Integration",
"name": "WeChat Official Account Integration", "official_account.params": "WeChat Official Account Parameters",
"params": "WeChat Official Account Parameters"
},
"publish_name": "Name", "publish_name": "Name",
"qpm_is_empty": "QPM cannot be empty", "qpm_is_empty": "QPM cannot be empty",
"qpm_tips": "Maximum number of queries per minute per IP", "qpm_tips": "Maximum number of queries per minute per IP",
...@@ -29,12 +27,10 @@ ...@@ -29,12 +27,10 @@
"token_auth": "Token Authentication", "token_auth": "Token Authentication",
"token_auth_tips": "Token authentication server URL. If provided, a request will be sent to the specified server for authentication before each conversation.", "token_auth_tips": "Token authentication server URL. If provided, a request will be sent to the specified server for authentication before each conversation.",
"token_auth_use_cases": "View Token Authentication Guide", "token_auth_use_cases": "View Token Authentication Guide",
"wecom": { "wecom.api": "WeCom API",
"api": "WeCom API", "wecom.bot": "WeCom Bot",
"bot": "WeCom Bot", "wecom.bot_desc": "Connect to WeCom Bot directly via API",
"bot_desc": "Connect to WeCom Bot directly via API", "wecom.create_modal_title": "Create WeCom Bot",
"create_modal_title": "Create WeCom Bot", "wecom.edit_modal_title": "Edit WeCom Bot",
"edit_modal_title": "Edit WeCom Bot", "wecom.title": "Publish to WeCom Bot"
"title": "Publish to WeCom Bot"
}
} }
\ No newline at end of file
{ {
"bill": { "bill.balance": "Balance",
"balance": "Balance", "bill.buy_plan": "Purchase Plan",
"buy_plan": "Purchase Plan", "bill.contact_customer_service": "Contact Support",
"contact_customer_service": "Contact Support", "bill.conversion": "Conversion",
"conversion": "Conversion", "bill.convert_error": "Conversion Failed",
"convert_error": "Conversion Failed", "bill.convert_success": "Conversion Successful",
"convert_success": "Conversion Successful", "bill.current_token_price": "Current Token Price",
"current_token_price": "Current Token Price", "bill.not_need_invoice": "Balance payment, invoice not available",
"not_need_invoice": "Balance payment, invoice not available", "bill.price": "Price",
"price": "Price", "bill.renew_plan": "Renew Plan",
"renew_plan": "Renew Plan", "bill.standard_valid_tip": "Plan Usage Rules: Higher-level plans will be used first. Unused plans will be activated later.",
"standard_valid_tip": "Plan Usage Rules: Higher-level plans will be used first. Unused plans will be activated later.", "bill.token_expire_1year": "Tokens are valid for one year",
"token_expire_1year": "Tokens are valid for one year", "bill.tokens": "Tokens",
"tokens": "Tokens", "bill.use_balance": "Use Balance",
"use_balance": "Use Balance", "bill.use_balance_hint": "Due to system upgrade, the 'Auto-renewal from balance' mode is canceled, and the balance recharge option is closed. Your balance can be used to purchase tokens.",
"use_balance_hint": "Due to system upgrade, the 'Auto-renewal from balance' mode is canceled, and the balance recharge option is closed. Your balance can be used to purchase tokens.", "bill.valid_time": "Effective Time",
"valid_time": "Effective Time", "bill.you_can_convert": "You can convert",
"you_can_convert": "You can convert", "bill.yuan": "Yuan",
"yuan": "Yuan"
},
"bill_and_invoices": "Bill & Invoice", "bill_and_invoices": "Bill & Invoice",
"bind_inform_account_error": "Failed to Bind Notification Account", "bind_inform_account_error": "Failed to Bind Notification Account",
"bind_inform_account_success": "Notification Account Bound Successfully", "bind_inform_account_success": "Notification Account Bound Successfully",
"delete": { "delete.admin_failed": "Failed to Delete Admin",
"admin_failed": "Failed to Delete Admin", "delete.admin_success": "Admin Deleted Successfully",
"admin_success": "Admin Deleted Successfully"
},
"has_chosen": "Selected", "has_chosen": "Selected",
"individuation": "Individuation", "individuation": "Individuation",
"login": { "login.error": "Login Error",
"error": "Login Error", "login.password_condition": "Password can be up to 60 characters",
"password_condition": "Password can be up to 60 characters", "login.success": "Login Successful",
"success": "Login Successful"
},
"name": "Name", "name": "Name",
"notice": "Notice", "notice": "Notice",
"notification": { "notification.Bind Notification Pipe Hint": "Please bind a notification receiving account to ensure you receive notifications such as plan expiration reminders, ensuring your service runs smoothly.",
"Bind Notification Pipe Hint": "Please bind a notification receiving account to ensure you receive notifications such as plan expiration reminders, ensuring your service runs smoothly.", "notification.remind_owner_bind": "Please remind the creator to bind a notification account",
"remind_owner_bind": "Please remind the creator to bind a notification account"
},
"operations": "Actions", "operations": "Actions",
"password": { "password.code_required": "Verification Code Required",
"code_required": "Verification Code Required", "password.code_send_error": "Failed to Send Verification Code",
"code_send_error": "Failed to Send Verification Code", "password.code_sended": "Verification Code Sent",
"code_sended": "Verification Code Sent", "password.confirm": "Confirm Password",
"confirm": "Confirm Password", "password.email_phone_error": "Invalid Email/Phone Number Format",
"email_phone_error": "Invalid Email/Phone Number Format", "password.email_phone_void": "Email/Phone Number Cannot Be Empty",
"email_phone_void": "Email/Phone Number Cannot Be Empty", "password.get_code": "Get Verification Code",
"get_code": "Get Verification Code", "password.get_code_again": "Get Again in s",
"get_code_again": "Get Again in s", "password.new_password": "New Password (4-20 characters)",
"new_password": "New Password (4-20 characters)", "password.not_match": "Passwords Do Not Match",
"not_match": "Passwords Do Not Match", "password.password_condition": "Password must be between 4 and 20 characters",
"password_condition": "Password must be between 4 and 20 characters", "password.password_required": "Password Cannot Be Empty",
"password_required": "Password Cannot Be Empty", "password.retrieve": "Retrieve Password",
"retrieve": "Retrieve Password", "password.retrieved": "Password Retrieved",
"retrieved": "Password Retrieved", "password.retrieved_account": "Retrieve {{account}} Account",
"retrieved_account": "Retrieve {{account}} Account", "password.to_login": "Go to Login",
"to_login": "Go to Login", "password.verification_code": "Verification Code",
"verification_code": "Verification Code" "permission.Manage": "Admin",
}, "permission.Manage tip": "Team admin with full permissions",
"permission": { "permission.Read": "Read Only",
"Manage": "Admin", "permission.Read desc": "Members can only read related resources, cannot create new resources",
"Manage tip": "Team admin with full permissions", "permission.Write": "Write",
"Read": "Read Only", "permission.Write tip": "In addition to read access, can create new resources",
"Read desc": "Members can only read related resources, cannot create new resources", "permission.only_collaborators": "Collaborators Only",
"Write": "Write", "permission.team_read": "Team Read Access",
"Write tip": "In addition to read access, can create new resources", "permission.team_write": "Team Write Access",
"only_collaborators": "Collaborators Only", "permission_des.manage": "Can create resources, invite, and delete members",
"team_read": "Team Read Access", "permission_des.read": "Members can only read related resources and cannot create new resources.",
"team_write": "Team Write Access" "permission_des.write": "In addition to readable resources, you can also create new resources",
},
"permission_des": {
"manage": "Can create resources, invite, and delete members",
"read": "Members can only read related resources and cannot create new resources.",
"write": "In addition to readable resources, you can also create new resources"
},
"permissions": "Permissions", "permissions": "Permissions",
"personal_information": "Me", "personal_information": "Me",
"personalization": "Personalization", "personalization": "Personalization",
"promotion_records": "Promotion", "promotion_records": "Promotion",
"register": { "register.confirm": "Confirm Registration",
"confirm": "Confirm Registration", "register.register_account": "Register {{account}} Account",
"register_account": "Register {{account}} Account", "register.success": "Registration Successful",
"success": "Registration Successful", "register.to_login": "Already have an account? Login",
"to_login": "Already have an account? Login"
},
"search_user": "Search Username", "search_user": "Search Username",
"sign_out": "Sign out", "sign_out": "Sign out",
"synchronization": { "synchronization.button": "Sync Now",
"button": "Sync Now", "synchronization.placeholder": "Enter Sync Tag",
"placeholder": "Enter Sync Tag", "synchronization.title": "Enter the sync tag link and click the sync button to synchronize",
"title": "Enter the sync tag link and click the sync button to synchronize" "team.Add manager": "Add Admin",
}, "team.add_collaborator": "Add Collaborator",
"team": { "team.manage_collaborators": "Manage Collaborators",
"Add manager": "Add Admin", "team.no_collaborators": "No Collaborators",
"add_collaborator": "Add Collaborator", "usage.feishu": "Feishu",
"manage_collaborators": "Manage Collaborators", "usage.official_account": "Official Account",
"no_collaborators": "No Collaborators" "usage.share": "Share Link",
}, "usage.wecom": "WeCom",
"usage": {
"feishu": "Feishu",
"official_account": "Official Account",
"share": "Share Link",
"wecom": "WeCom"
},
"usage_record": "Usages" "usage_record": "Usages"
} }
\ No newline at end of file
...@@ -9,10 +9,8 @@ ...@@ -9,10 +9,8 @@
"can_not_loop": "This node can't loop.", "can_not_loop": "This node can't loop.",
"choose_another_application_to_call": "Select another application to call", "choose_another_application_to_call": "Select another application to call",
"classification_result": "Classification Result", "classification_result": "Classification Result",
"code": { "code.Reset template": "Reset Template",
"Reset template": "Reset Template", "code.Reset template confirm": "Confirm reset code template? This will reset all inputs and outputs to template values. Please save your current code.",
"Reset template confirm": "Confirm reset code template? This will reset all inputs and outputs to template values. Please save your current code."
},
"code_execution": "Code Execution", "code_execution": "Code Execution",
"collection_metadata_filter": "Collection Metadata Filter", "collection_metadata_filter": "Collection Metadata Filter",
"complete_extraction_result": "Complete Extraction Result", "complete_extraction_result": "Complete Extraction Result",
...@@ -58,10 +56,8 @@ ...@@ -58,10 +56,8 @@
"http_raw_response_description": "Raw HTTP response. Only accepts string or JSON type response data.", "http_raw_response_description": "Raw HTTP response. Only accepts string or JSON type response data.",
"http_request": "HTTP Request", "http_request": "HTTP Request",
"http_request_error_info": "HTTP request error information, returns empty on success", "http_request_error_info": "HTTP request error information, returns empty on success",
"ifelse": { "ifelse.Input value": "Input Value",
"Input value": "Input Value", "ifelse.Select value": "Select Value",
"Select value": "Select Value"
},
"input_description": "Field Description", "input_description": "Field Description",
"input_variable_list": "Type / to invoke variable list", "input_variable_list": "Type / to invoke variable list",
"intro_assigned_reply": "This module can directly reply with a specified content. Commonly used for guidance or prompts. Non-string content will be converted to string for output.", "intro_assigned_reply": "This module can directly reply with a specified content. Commonly used for guidance or prompts. Non-string content will be converted to string for output.",
...@@ -104,10 +100,8 @@ ...@@ -104,10 +100,8 @@
"optional_value_type_tip": "You can specify one or more data types. When dynamically adding fields, users can only select the configured types.", "optional_value_type_tip": "You can specify one or more data types. When dynamically adding fields, users can only select the configured types.",
"pan_priority": "Touchpad first", "pan_priority": "Touchpad first",
"pass_returned_object_as_output_to_next_nodes": "Pass the object returned in the code as output to the next nodes. The variable name needs to correspond to the return key.", "pass_returned_object_as_output_to_next_nodes": "Pass the object returned in the code as output to the next nodes. The variable name needs to correspond to the return key.",
"plugin": { "plugin.Instruction_Tip": "You can configure an instruction to explain the purpose of the plugin. This instruction will be displayed each time the plugin is used. Supports standard Markdown syntax.",
"Instruction_Tip": "You can configure an instruction to explain the purpose of the plugin. This instruction will be displayed each time the plugin is used. Supports standard Markdown syntax.", "plugin.Instructions": "Instructions",
"Instructions": "Instructions"
},
"plugin_input": "Plugin Input", "plugin_input": "Plugin Input",
"question_classification": "Question Classification", "question_classification": "Question Classification",
"question_optimization": "Question Optimization", "question_optimization": "Question Optimization",
...@@ -121,29 +115,25 @@ ...@@ -121,29 +115,25 @@
"regex": "Regex", "regex": "Regex",
"reply_text": "Reply Text", "reply_text": "Reply Text",
"request_error": "Request Error", "request_error": "Request Error",
"response": { "response.Code log": "Code Log",
"Code log": "Code Log", "response.Custom inputs": "Custom Inputs",
"Custom inputs": "Custom Inputs", "response.Custom outputs": "Custom Outputs",
"Custom outputs": "Custom Outputs", "response.Error": "Error",
"Error": "Error", "response.Read file result": "Read File Result",
"Read file result": "Read File Result", "response.read files": "Read Files",
"read files": "Read Files"
},
"select_an_application": "Select an Application", "select_an_application": "Select an Application",
"select_another_application_to_call": "You can choose another application to call", "select_another_application_to_call": "You can choose another application to call",
"special_array_format": "Special array format, returns an empty array when the search result is empty.", "special_array_format": "Special array format, returns an empty array when the search result is empty.",
"start_with": "Starts With", "start_with": "Starts With",
"target_fields_description": "A target field consists of 'description' and 'key'. Multiple target fields can be extracted.", "target_fields_description": "A target field consists of 'description' and 'key'. Multiple target fields can be extracted.",
"template": { "template.ai_chat": "AI Chat",
"ai_chat": "AI Chat", "template.ai_chat_intro": "AI Large Model Chat",
"ai_chat_intro": "AI Large Model Chat", "template.dataset_search": "Dataset Search",
"dataset_search": "Dataset Search", "template.dataset_search_intro": "Use 'semantic search' and 'full-text search' capabilities to find potentially relevant reference content from the 'Dataset'.",
"dataset_search_intro": "Use 'semantic search' and 'full-text search' capabilities to find potentially relevant reference content from the 'Dataset'.", "template.system_config": "System Configuration",
"system_config": "System Configuration", "template.tool_call": "Tool Call",
"tool_call": "Tool Call", "template.tool_call_intro": "Automatically select one or more functional blocks for calling through the AI model, or call plugins.",
"tool_call_intro": "Automatically select one or more functional blocks for calling through the AI model, or call plugins.", "template.workflow_start": "Workflow Start",
"workflow_start": "Workflow Start"
},
"template.plugin_output": "Plugin output", "template.plugin_output": "Plugin output",
"template.plugin_start": "Plugin start", "template.plugin_start": "Plugin start",
"text_concatenation": "Text Concatenation", "text_concatenation": "Text Concatenation",
...@@ -157,12 +147,11 @@ ...@@ -157,12 +147,11 @@
"update_specified_node_output_or_global_variable": "Can update the output value of a specified node or update global variables", "update_specified_node_output_or_global_variable": "Can update the output value of a specified node or update global variables",
"use_user_id": "User ID", "use_user_id": "User ID",
"user_question": "User Question", "user_question": "User Question",
"value_type": "Value type",
"variable_picker_tips": "Type node name or variable name to search", "variable_picker_tips": "Type node name or variable name to search",
"variable_update": "Variable Update", "variable_update": "Variable Update",
"workflow": { "workflow.My edit": "My Edit",
"My edit": "My Edit", "workflow.Switch_success": "Switch Successful",
"Switch_success": "Switch Successful", "workflow.Team cloud": "Team Cloud",
"Team cloud": "Team Cloud", "workflow.exit_tips": "Your changes have not been saved. 'Exit directly' will not save your edits."
"exit_tips": "Your changes have not been saved. 'Exit directly' will not save your edits."
}
} }
\ No newline at end of file
...@@ -31,9 +31,7 @@ ...@@ -31,9 +31,7 @@
"no_workflow_response": "没有运行数据", "no_workflow_response": "没有运行数据",
"plugins_output": "插件输出", "plugins_output": "插件输出",
"question_tip": "从上到下,为各个模块的响应顺序", "question_tip": "从上到下,为各个模块的响应顺序",
"response": { "response.node_inputs": "节点输入",
"node_inputs": "节点输入"
},
"select": "选择", "select": "选择",
"select_file": "上传文件", "select_file": "上传文件",
"select_file_img": "上传文件/图片", "select_file_img": "上传文件/图片",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"Enable": "启用", "Enable": "启用",
"collection": { "collection.Create update time": "创建/更新时间",
"Create update time": "创建/更新时间", "collection.Training type": "训练模式",
"Training type": "训练模式"
},
"collection_tags": "集合标签", "collection_tags": "集合标签",
"common_dataset": "通用知识库", "common_dataset": "通用知识库",
"common_dataset_desc": "可通过导入文件、网页链接或手动录入形式构建知识库", "common_dataset_desc": "可通过导入文件、网页链接或手动录入形式构建知识库",
"confirm_to_rebuild_embedding_tip": "确认为知识库切换索引?\n切换索引是一个非常重量的操作,需要对您知识库内所有数据进行重新索引,时间可能较长,请确保账号内剩余积分充足。\n\n此外,你还需要注意修改选择该知识库的应用,避免它们与其他索引模型知识库混用。", "confirm_to_rebuild_embedding_tip": "确认为知识库切换索引?\n切换索引是一个非常重量的操作,需要对您知识库内所有数据进行重新索引,时间可能较长,请确保账号内剩余积分充足。\n\n此外,你还需要注意修改选择该知识库的应用,避免它们与其他索引模型知识库混用。",
"dataset": { "dataset.no_collections": "暂无数据集",
"no_collections": "暂无数据集", "dataset.no_tags": "暂无标签",
"no_tags": "暂无标签"
},
"external_file": "外部文件库", "external_file": "外部文件库",
"external_file_dataset_desc": "可以从外部文件库导入文件构建知识库,文件不会进行二次存储", "external_file_dataset_desc": "可以从外部文件库导入文件构建知识库,文件不会进行二次存储",
"external_id": "文件阅读 ID", "external_id": "文件阅读 ID",
...@@ -23,26 +19,20 @@ ...@@ -23,26 +19,20 @@
"folder_dataset": "文件夹", "folder_dataset": "文件夹",
"rebuild_embedding_start_tip": "切换索引模型任务已开始", "rebuild_embedding_start_tip": "切换索引模型任务已开始",
"rebuilding_index_count": "重建中索引数量:{{count}}", "rebuilding_index_count": "重建中索引数量:{{count}}",
"tag": { "tag.Add New": "新建",
"Add New": "新建", "tag.Add_new_tag": "新建标签",
"Add_new_tag": "新建标签", "tag.Edit_tag": "编辑标签",
"Edit_tag": "编辑标签", "tag.add": "创建",
"add": "创建", "tag.cancel": "取消选择",
"cancel": "取消选择", "tag.delete_tag_confirm": "确定删除标签?",
"delete_tag_confirm": "确定删除标签?", "tag.manage": "标签管理",
"manage": "标签管理", "tag.searchOrAddTag": "搜索或添加标签",
"searchOrAddTag": "搜索或添加标签", "tag.tags": "标签",
"tags": "标签", "tag.total_tags": "共{{total}}个标签",
"total_tags": "共{{total}}个标签"
},
"the_knowledge_base_has_indexes_that_are_being_trained_or_being_rebuilt": "知识库有训练中或正在重建的索引", "the_knowledge_base_has_indexes_that_are_being_trained_or_being_rebuilt": "知识库有训练中或正在重建的索引",
"website_dataset": "Web 站点同步", "website_dataset": "Web 站点同步",
"website_dataset_desc": "Web 站点同步允许你直接使用一个网页链接构建知识库", "website_dataset_desc": "Web 站点同步允许你直接使用一个网页链接构建知识库",
"permission": { "permission.des.read": "可查看知识库内容",
"des": { "permission.des.write": "可增加和变更知识库内容",
"read": "可查看知识库内容", "permission.des.manage": "可管理整个知识库数据和信息"
"write": "可增加和变更知识库内容",
"manage": "可管理整个知识库数据和信息"
}
}
} }
\ No newline at end of file
...@@ -14,13 +14,11 @@ ...@@ -14,13 +14,11 @@
"key_tips": "你可以使用 API 密钥访问一些特定的接口(无法访问应用,访问应用需使用应用内的 API key)", "key_tips": "你可以使用 API 密钥访问一些特定的接口(无法访问应用,访问应用需使用应用内的 API key)",
"link_name": "分享链接的名字", "link_name": "分享链接的名字",
"new_feishu_bot": "新增飞书机器人", "new_feishu_bot": "新增飞书机器人",
"official_account": { "official_account.create_modal_title": "创建微信公众号接入",
"create_modal_title": "创建微信公众号接入", "official_account.desc": "通过 API 直接接入微信公众号",
"desc": "通过 API 直接接入微信公众号", "official_account.edit_modal_title": "编辑微信公众号接入",
"edit_modal_title": "编辑微信公众号接入", "official_account.name": "微信公众号接入",
"name": "微信公众号接入", "official_account.params": "微信公众号参数",
"params": "微信公众号参数"
},
"publish_name": "名称", "publish_name": "名称",
"qpm_is_empty": "QPM 不能为空", "qpm_is_empty": "QPM 不能为空",
"qpm_tips": "每个 IP 每分钟最多提问多少次", "qpm_tips": "每个 IP 每分钟最多提问多少次",
...@@ -29,12 +27,10 @@ ...@@ -29,12 +27,10 @@
"token_auth": "身份验证", "token_auth": "身份验证",
"token_auth_tips": "身份校验服务器地址,如填写该值,每次对话前都会向指定服务器发送一个请求,进行身份校验", "token_auth_tips": "身份校验服务器地址,如填写该值,每次对话前都会向指定服务器发送一个请求,进行身份校验",
"token_auth_use_cases": "查看身份验证使用说明", "token_auth_use_cases": "查看身份验证使用说明",
"wecom": { "wecom.api": "企微 API",
"api": "企微 API", "wecom.bot": "企业微信机器人",
"bot": "企业微信机器人", "wecom.bot_desc": "通过 API 直接接入企业微信机器人",
"bot_desc": "通过 API 直接接入企业微信机器人", "wecom.create_modal_title": "创建企微机器人",
"create_modal_title": "创建企微机器人", "wecom.edit_modal_title": "编辑企微机器人",
"edit_modal_title": "编辑企微机器人", "wecom.title": "发布到企业微信机器人"
"title": "发布到企业微信机器人"
}
} }
\ No newline at end of file
{ {
"bill": { "bill.balance": "余额",
"balance": "余额", "bill.buy_plan": "购买套餐",
"buy_plan": "购买套餐", "bill.contact_customer_service": "联系客服",
"contact_customer_service": "联系客服", "bill.conversion": "兑换",
"conversion": "兑换", "bill.convert_error": "兑换失败",
"convert_error": "兑换失败", "bill.convert_success": "兑换成功",
"convert_success": "兑换成功", "bill.current_token_price": "当前积分价格",
"current_token_price": "当前积分价格", "bill.not_need_invoice": "余额支付,无法开票",
"not_need_invoice": "余额支付,无法开票", "bill.price": "价格",
"price": "价格", "bill.renew_plan": "续费套餐",
"renew_plan": "续费套餐", "bill.standard_valid_tip": "套餐使用规则:系统优先使用更高级的套餐,原未用完的套餐将延后生效",
"standard_valid_tip": "套餐使用规则:系统优先使用更高级的套餐,原未用完的套餐将延后生效", "bill.token_expire_1year": "积分有效期一年",
"token_expire_1year": "积分有效期一年", "bill.tokens": "积分",
"tokens": "积分", "bill.use_balance": "使用余额",
"use_balance": "使用余额", "bill.use_balance_hint": "由于系统升级,原“自动续费从余额扣款”模式取消,余额充值入口关闭。您的余额可用于购买积分",
"use_balance_hint": "由于系统升级,原“自动续费从余额扣款”模式取消,余额充值入口关闭。您的余额可用于购买积分", "bill.valid_time": "生效时间",
"valid_time": "生效时间", "bill.you_can_convert": "您可兑换",
"you_can_convert": "您可兑换", "bill.yuan": "元",
"yuan": "元"
},
"bill_and_invoices": "账单 & 发票", "bill_and_invoices": "账单 & 发票",
"bind_inform_account_error": "绑定通知账号异常", "bind_inform_account_error": "绑定通知账号异常",
"bind_inform_account_success": "绑定通知账号成功", "bind_inform_account_success": "绑定通知账号成功",
"delete": { "delete.admin_failed": "删除管理员失败",
"admin_failed": "删除管理员失败", "delete.admin_success": "删除管理员成功",
"admin_success": "删除管理员成功"
},
"has_chosen": "已选择", "has_chosen": "已选择",
"individuation": "个性化", "individuation": "个性化",
"login": { "login.error": "登录异常",
"error": "登录异常", "login.password_condition": "密码最多 60 位",
"password_condition": "密码最多 60 位", "login.success": "登录成功",
"success": "登录成功"
},
"name": "名称", "name": "名称",
"notice": "通知", "notice": "通知",
"notification": { "notification.Bind Notification Pipe Hint": "请绑定通知接收账号,以确保您能正常接收套餐过期提醒等通知,保障您的服务正常运行。",
"Bind Notification Pipe Hint": "请绑定通知接收账号,以确保您能正常接收套餐过期提醒等通知,保障您的服务正常运行。", "notification.remind_owner_bind": "请提醒创建者绑定通知账号",
"remind_owner_bind": "请提醒创建者绑定通知账号"
},
"operations": "操作", "operations": "操作",
"password": { "password.code_required": "验证码不能为空",
"code_required": "验证码不能为空", "password.code_send_error": "验证码发送异常",
"code_send_error": "验证码发送异常", "password.code_sended": "验证码已发送",
"code_sended": "验证码已发送", "password.confirm": "确认密码",
"confirm": "确认密码", "password.email_phone_error": "邮箱/手机号格式错误",
"email_phone_error": "邮箱/手机号格式错误", "password.email_phone_void": "邮箱/手机号不能为空",
"email_phone_void": "邮箱/手机号不能为空", "password.get_code": "获取验证码",
"get_code": "获取验证码", "password.get_code_again": "s后重新获取",
"get_code_again": "s后重新获取", "password.new_password": "新密码(4~20位)",
"new_password": "新密码(4~20位)", "password.not_match": "两次密码不一致",
"not_match": "两次密码不一致", "password.password_condition": "密码最少 4 位最多 20 位",
"password_condition": "密码最少 4 位最多 20 位", "password.password_required": "密码不能为空",
"password_required": "密码不能为空", "password.retrieve": "找回密码",
"retrieve": "找回密码", "password.retrieved": "密码已找回",
"retrieved": "密码已找回", "password.retrieved_account": "找回 {{account}} 账号",
"retrieved_account": "找回 {{account}} 账号", "password.to_login": "去登录",
"to_login": "去登录", "password.verification_code": "验证码",
"verification_code": "验证码" "permission.Manage": "管理员",
}, "permission.Manage tip": "团队管理员,拥有全部权限",
"permission": { "permission.Read": "仅读",
"Manage": "管理员", "permission.Read desc": "成员仅可阅读相关资源,无法新建资源",
"Manage tip": "团队管理员,拥有全部权限", "permission.Write": "可写",
"Read": "仅读", "permission.Write tip": "除了可读资源外,还可以新建新的资源",
"Read desc": "成员仅可阅读相关资源,无法新建资源", "permission.only_collaborators": "仅协作者访问",
"Write": "可写", "permission.team_read": "团队可访问",
"Write tip": "除了可读资源外,还可以新建新的资源", "permission.team_write": "团队可编辑",
"only_collaborators": "仅协作者访问", "permission_des.manage": "可创建资源、邀请、删除成员",
"team_read": "团队可访问", "permission_des.read": "成员仅可阅读相关资源,无法新建资源",
"team_write": "团队可编辑" "permission_des.write": "除了可读资源外,还可以新建新的资源",
},
"permission_des": {
"manage": "可创建资源、邀请、删除成员",
"read": "成员仅可阅读相关资源,无法新建资源",
"write": "除了可读资源外,还可以新建新的资源"
},
"permissions": "权限", "permissions": "权限",
"personal_information": "个人信息", "personal_information": "个人信息",
"personalization": "个性化", "personalization": "个性化",
"promotion_records": "推广记录", "promotion_records": "推广记录",
"register": { "register.confirm": "确认注册",
"confirm": "确认注册", "register.register_account": "注册 {{account}} 账号",
"register_account": "注册 {{account}} 账号", "register.success": "注册成功",
"success": "注册成功", "register.to_login": "已有账号,去登录",
"to_login": "已有账号,去登录"
},
"search_user": "搜索用户名", "search_user": "搜索用户名",
"sign_out": "登出", "sign_out": "登出",
"synchronization": { "synchronization.button": "立即同步",
"button": "立即同步", "synchronization.placeholder": "请输入同步标签",
"placeholder": "请输入同步标签", "synchronization.title": "填写标签同步链接,点击同步按钮即可同步",
"title": "填写标签同步链接,点击同步按钮即可同步" "team.Add manager": "添加管理员",
}, "team.add_collaborator": "添加协作者",
"team": { "team.manage_collaborators": "管理协作者",
"Add manager": "添加管理员", "team.no_collaborators": "暂无协作者",
"add_collaborator": "添加协作者", "usage.feishu": "飞书",
"manage_collaborators": "管理协作者", "usage.official_account": "公众号",
"no_collaborators": "暂无协作者" "usage.share": "分享链接",
}, "usage.wecom": "企业微信",
"usage": {
"feishu": "飞书",
"official_account": "公众号",
"share": "分享链接",
"wecom": "企业微信"
},
"usage_record": "使用记录" "usage_record": "使用记录"
} }
\ No newline at end of file
...@@ -9,10 +9,8 @@ ...@@ -9,10 +9,8 @@
"can_not_loop": "该节点不支持循环嵌套", "can_not_loop": "该节点不支持循环嵌套",
"choose_another_application_to_call": "选择一个其他应用进行调用", "choose_another_application_to_call": "选择一个其他应用进行调用",
"classification_result": "分类结果", "classification_result": "分类结果",
"code": { "code.Reset template": "还原模板",
"Reset template": "还原模板", "code.Reset template confirm": "确认还原代码模板?将会重置所有输入和输出至模板值,请注意保存当前代码。",
"Reset template confirm": "确认还原代码模板?将会重置所有输入和输出至模板值,请注意保存当前代码。"
},
"code_execution": "代码运行", "code_execution": "代码运行",
"collection_metadata_filter": "集合元数据过滤", "collection_metadata_filter": "集合元数据过滤",
"complete_extraction_result": "完整提取结果", "complete_extraction_result": "完整提取结果",
...@@ -58,10 +56,8 @@ ...@@ -58,10 +56,8 @@
"http_raw_response_description": "HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。", "http_raw_response_description": "HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。",
"http_request": "HTTP 请求", "http_request": "HTTP 请求",
"http_request_error_info": "HTTP请求错误信息,成功时返回空", "http_request_error_info": "HTTP请求错误信息,成功时返回空",
"ifelse": { "ifelse.Input value": "输入值",
"Input value": "输入值", "ifelse.Select value": "选择值",
"Select value": "选择值"
},
"input_description": "字段描述", "input_description": "字段描述",
"input_variable_list": "可输入 / 唤起变量列表", "input_variable_list": "可输入 / 唤起变量列表",
"intro_assigned_reply": "该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。", "intro_assigned_reply": "该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。",
...@@ -110,10 +106,8 @@ ...@@ -110,10 +106,8 @@
"optional_value_type_tip": "可以指定 1 个或多个数据类型,用户在动态添加字段时,仅可选择配置的类型", "optional_value_type_tip": "可以指定 1 个或多个数据类型,用户在动态添加字段时,仅可选择配置的类型",
"pan_priority": "触摸板优先", "pan_priority": "触摸板优先",
"pass_returned_object_as_output_to_next_nodes": "将代码中 return 的对象作为输出,传递给后续的节点。变量名需要对应 return 的 key", "pass_returned_object_as_output_to_next_nodes": "将代码中 return 的对象作为输出,传递给后续的节点。变量名需要对应 return 的 key",
"plugin": { "plugin.Instruction_Tip": "可以配置一段说明,以解释该插件的用途。每次使用插件前,会显示该段说明。支持标准 Markdown 语法。",
"Instruction_Tip": "可以配置一段说明,以解释该插件的用途。每次使用插件前,会显示该段说明。支持标准 Markdown 语法。", "plugin.Instructions": "使用说明",
"Instructions": "使用说明"
},
"plugin_input": "插件输入", "plugin_input": "插件输入",
"question_classification": "问题分类", "question_classification": "问题分类",
"question_optimization": "问题优化", "question_optimization": "问题优化",
...@@ -127,29 +121,25 @@ ...@@ -127,29 +121,25 @@
"regex": "正则", "regex": "正则",
"reply_text": "回复的文本", "reply_text": "回复的文本",
"request_error": "请求错误", "request_error": "请求错误",
"response": { "response.Code log": "Log 日志",
"Code log": "Log 日志", "response.Custom inputs": "自定义输入",
"Custom inputs": "自定义输入", "response.Custom outputs": "自定义输出",
"Custom outputs": "自定义输出", "response.Error": "错误信息",
"Error": "错误信息", "response.Read file result": "文档解析结果预览",
"Read file result": "文档解析结果预览", "response.read files": "解析的文档",
"read files": "解析的文档"
},
"select_an_application": "选择一个应用", "select_an_application": "选择一个应用",
"select_another_application_to_call": "可以选择一个其他应用进行调用", "select_another_application_to_call": "可以选择一个其他应用进行调用",
"special_array_format": "特殊数组格式,搜索结果为空时,返回空数组。", "special_array_format": "特殊数组格式,搜索结果为空时,返回空数组。",
"start_with": "开始为", "start_with": "开始为",
"target_fields_description": "由 '描述' 和 'key' 组成一个目标字段,可提取多个目标字段", "target_fields_description": "由 '描述' 和 'key' 组成一个目标字段,可提取多个目标字段",
"template": { "template.ai_chat": "AI 对话",
"ai_chat": "AI 对话", "template.ai_chat_intro": "AI 大模型对话",
"ai_chat_intro": "AI 大模型对话", "template.dataset_search": "知识库搜索",
"dataset_search": "知识库搜索", "template.dataset_search_intro": "调用“语义检索”和“全文检索”能力,从“知识库”中查找可能与问题相关的参考内容",
"dataset_search_intro": "调用“语义检索”和“全文检索”能力,从“知识库”中查找可能与问题相关的参考内容", "template.system_config": "系统配置",
"system_config": "系统配置", "template.tool_call": "工具调用",
"tool_call": "工具调用", "template.tool_call_intro": "通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。",
"tool_call_intro": "通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。", "template.workflow_start": "流程开始",
"workflow_start": "流程开始"
},
"template.plugin_output": "插件输出", "template.plugin_output": "插件输出",
"template.plugin_start": "插件开始", "template.plugin_start": "插件开始",
"text_concatenation": "文本拼接", "text_concatenation": "文本拼接",
...@@ -163,12 +153,11 @@ ...@@ -163,12 +153,11 @@
"update_specified_node_output_or_global_variable": "可以更新指定节点的输出值或更新全局变量", "update_specified_node_output_or_global_variable": "可以更新指定节点的输出值或更新全局变量",
"use_user_id": "使用者 ID", "use_user_id": "使用者 ID",
"user_question": "用户问题", "user_question": "用户问题",
"value_type": "数据类型",
"variable_picker_tips": "可输入节点名或变量名搜索", "variable_picker_tips": "可输入节点名或变量名搜索",
"variable_update": "变量更新", "variable_update": "变量更新",
"workflow": { "workflow.My edit": "我的编辑",
"My edit": "我的编辑", "workflow.Switch_success": "切换成功",
"Switch_success": "切换成功", "workflow.Team cloud": "团队云端",
"Team cloud": "团队云端", "workflow.exit_tips": "您的更改尚未保存,「直接退出」将不会保存您的编辑记录。"
"exit_tips": "您的更改尚未保存,「直接退出」将不会保存您的编辑记录。"
}
} }
\ No newline at end of file
...@@ -23,14 +23,8 @@ export interface I18nNamespaces { ...@@ -23,14 +23,8 @@ export interface I18nNamespaces {
export type I18nNsType = (keyof I18nNamespaces)[]; export type I18nNsType = (keyof I18nNamespaces)[];
export type NestedKeyOf<ObjectType extends object> = {
[Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object
? `${Key}` | `${Key}.${NestedKeyOf<ObjectType[Key]>}`
: `${Key}`;
}[keyof ObjectType & (string | number)];
export type ParseKeys<Ns extends keyof I18nNamespaces = keyof I18nNamespaces> = { export type ParseKeys<Ns extends keyof I18nNamespaces = keyof I18nNamespaces> = {
[K in Ns]: `${K}:${NestedKeyOf<I18nNamespaces[K]>}`; [K in Ns]: `${K}:${keyof I18nNamespaces[K] & string}`;
}[Ns]; }[Ns];
export type I18nKeyFunction = { export type I18nKeyFunction = {
......
import React, { useMemo, useState } from 'react'; import React, { useCallback, useMemo, useState } from 'react';
import { import {
Box, Box,
Button, Button,
...@@ -41,6 +41,29 @@ import MyRadio from '@/components/common/MyRadio'; ...@@ -41,6 +41,29 @@ import MyRadio from '@/components/common/MyRadio';
import { formatEditorVariablePickerIcon } from '@fastgpt/global/core/workflow/utils'; import { formatEditorVariablePickerIcon } from '@fastgpt/global/core/workflow/utils';
import ChatFunctionTip from './Tip'; import ChatFunctionTip from './Tip';
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel'; import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
import { FlowValueTypeMap } from '@fastgpt/global/core/workflow/node/constant';
import MySelect from '@fastgpt/web/components/common/MySelect';
export const defaultVariable: VariableItemType = {
id: nanoid(),
key: 'key',
label: 'label',
type: VariableInputEnum.input,
required: true,
maxLen: 50,
enums: [{ value: '' }],
valueType: WorkflowIOValueTypeEnum.string
};
export const addVariable = () => {
const newVariable = { ...defaultVariable, key: '', id: '' };
return newVariable;
};
const valueTypeMap = {
[VariableInputEnum.input]: WorkflowIOValueTypeEnum.string,
[VariableInputEnum.select]: WorkflowIOValueTypeEnum.string,
[VariableInputEnum.textarea]: WorkflowIOValueTypeEnum.string,
[VariableInputEnum.custom]: WorkflowIOValueTypeEnum.any
};
const VariableEdit = ({ const VariableEdit = ({
variables = [], variables = [],
...@@ -65,6 +88,7 @@ const VariableEdit = ({ ...@@ -65,6 +88,7 @@ const VariableEdit = ({
const { isOpen: isOpenEdit, onOpen: onOpenEdit, onClose: onCloseEdit } = useDisclosure(); const { isOpen: isOpenEdit, onOpen: onOpenEdit, onClose: onCloseEdit } = useDisclosure();
const { const {
setValue,
reset: resetEdit, reset: resetEdit,
register: registerEdit, register: registerEdit,
getValues: getValuesEdit, getValues: getValuesEdit,
...@@ -75,6 +99,7 @@ const VariableEdit = ({ ...@@ -75,6 +99,7 @@ const VariableEdit = ({
} = useForm<{ variable: VariableItemType }>(); } = useForm<{ variable: VariableItemType }>();
const variableType = watch('variable.type'); const variableType = watch('variable.type');
const valueType = watch('variable.valueType');
const { const {
fields: selectEnums, fields: selectEnums,
...@@ -96,8 +121,85 @@ const VariableEdit = ({ ...@@ -96,8 +121,85 @@ const VariableEdit = ({
}); });
}, [variables]); }, [variables]);
const valueTypeSelectList = useMemo(
() =>
Object.values(FlowValueTypeMap)
.map((item) => ({
label: t(item.label as any),
value: item.value
}))
.filter(
(item) =>
![
WorkflowIOValueTypeEnum.arrayAny,
WorkflowIOValueTypeEnum.selectApp,
WorkflowIOValueTypeEnum.selectDataset,
WorkflowIOValueTypeEnum.dynamic
].includes(item.value)
),
[t]
);
const showValueTypeSelect = variableType === VariableInputEnum.custom;
const onSubmit = useCallback(
({ variable }: { variable: VariableItemType }) => {
variable.key = variable.key.trim();
// check select
if (variable.type === VariableInputEnum.select) {
const enums = variable.enums.filter((item) => item.value);
if (enums.length === 0) {
toast({
status: 'warning',
title: t('common:core.module.variable.variable option is required')
});
return;
}
}
// check repeat key
const existingVariable = variables.find(
(item) => item.key === variable.key && item.id !== variable.id
);
if (existingVariable) {
toast({
status: 'warning',
title: t('common:core.module.variable.key already exists')
});
return;
}
// set valuetype based on variable.type
variable.valueType =
variable.type === VariableInputEnum.custom
? variable.valueType
: valueTypeMap[variable.type];
// set default required value based on variableType
if (variable.type === VariableInputEnum.custom) {
variable.required = false;
}
const onChangeVariable = [...variables];
// update
if (variable.id) {
const index = variables.findIndex((item) => item.id === variable.id);
onChangeVariable[index] = variable;
} else {
onChangeVariable.push({
...variable,
id: nanoid()
});
}
onChange(onChangeVariable);
onCloseEdit();
},
[onChange, onCloseEdit, t, toast, variables]
);
return ( return (
<Box> <Box>
{/* Row box */}
<Flex alignItems={'center'}> <Flex alignItems={'center'}>
<MyIcon name={'core/app/simpleMode/variable'} w={'20px'} /> <MyIcon name={'core/app/simpleMode/variable'} w={'20px'} />
<FormLabel ml={2}>{t('common:core.module.Variable')}</FormLabel> <FormLabel ml={2}>{t('common:core.module.Variable')}</FormLabel>
...@@ -117,6 +219,7 @@ const VariableEdit = ({ ...@@ -117,6 +219,7 @@ const VariableEdit = ({
{t('common:common.Add New')} {t('common:common.Add New')}
</Button> </Button>
</Flex> </Flex>
{/* Form render */}
{formatVariables.length > 0 && ( {formatVariables.length > 0 && (
<Box mt={2} borderRadius={'md'} overflow={'hidden'} borderWidth={'1px'} borderBottom="none"> <Box mt={2} borderRadius={'md'} overflow={'hidden'} borderWidth={'1px'} borderBottom="none">
<TableContainer> <TableContainer>
...@@ -171,6 +274,7 @@ const VariableEdit = ({ ...@@ -171,6 +274,7 @@ const VariableEdit = ({
</TableContainer> </TableContainer>
</Box> </Box>
)} )}
{/* Edit modal */}
<MyModal <MyModal
iconSrc="core/app/simpleMode/variable" iconSrc="core/app/simpleMode/variable"
title={t('common:core.module.Variable Setting')} title={t('common:core.module.Variable Setting')}
...@@ -201,6 +305,24 @@ const VariableEdit = ({ ...@@ -201,6 +305,24 @@ const VariableEdit = ({
})} })}
/> />
</Flex> </Flex>
<Flex mt={5} alignItems={'center'}>
<FormLabel w={'80px'}>{t('workflow:value_type')}</FormLabel>
{showValueTypeSelect ? (
<Box flex={1}>
<MySelect<WorkflowIOValueTypeEnum>
list={valueTypeSelectList.filter(
(item) => item.value !== WorkflowIOValueTypeEnum.arrayAny
)}
value={valueType}
onchange={(e) => {
setValue('variable.valueType', e);
}}
/>
</Box>
) : (
<Box fontSize={'14px'}>{valueTypeMap[variableType]}</Box>
)}
</Flex>
<FormLabel mt={5} mb={2}> <FormLabel mt={5} mb={2}>
{t('common:core.workflow.Variable.Variable type')} {t('common:core.workflow.Variable.Variable type')}
...@@ -299,57 +421,7 @@ const VariableEdit = ({ ...@@ -299,57 +421,7 @@ const VariableEdit = ({
<Button variant={'whiteBase'} mr={3} onClick={onCloseEdit}> <Button variant={'whiteBase'} mr={3} onClick={onCloseEdit}>
{t('common:common.Close')} {t('common:common.Close')}
</Button> </Button>
<Button <Button onClick={handleSubmitEdit(onSubmit)}>
onClick={handleSubmitEdit(({ variable }) => {
variable.key = variable.key.trim();
// check select
if (variable.type === VariableInputEnum.select) {
const enums = variable.enums.filter((item) => item.value);
if (enums.length === 0) {
toast({
status: 'warning',
title: t('common:core.module.variable.variable option is required')
});
return;
}
}
// check repeat key
const existingVariable = variables.find(
(item) => item.key === variable.key && item.id !== variable.id
);
if (existingVariable) {
toast({
status: 'warning',
title: t('common:core.module.variable.key already exists')
});
return;
}
// set valuetype based on variable.type
variable.valueType = valueTypeMap[variable.type];
// set default required value based on variableType
if (variable.type === VariableInputEnum.custom) {
variable.required = false;
}
const onChangeVariable = [...variables];
// update
if (variable.id) {
const index = variables.findIndex((item) => item.id === variable.id);
onChangeVariable[index] = variable;
} else {
onChangeVariable.push({
...variable,
id: nanoid()
});
}
onChange(onChangeVariable);
onCloseEdit();
})}
>
{getValuesEdit('variable.id') {getValuesEdit('variable.id')
? t('common:common.Confirm Update') ? t('common:common.Confirm Update')
: t('common:common.Add New')} : t('common:common.Add New')}
...@@ -361,24 +433,3 @@ const VariableEdit = ({ ...@@ -361,24 +433,3 @@ const VariableEdit = ({
}; };
export default React.memo(VariableEdit); export default React.memo(VariableEdit);
export const defaultVariable: VariableItemType = {
id: nanoid(),
key: 'key',
label: 'label',
type: VariableInputEnum.input,
required: true,
maxLen: 50,
enums: [{ value: '' }],
valueType: WorkflowIOValueTypeEnum.string
};
export const addVariable = () => {
const newVariable = { ...defaultVariable, key: '', id: '' };
return newVariable;
};
const valueTypeMap = {
[VariableInputEnum.input]: WorkflowIOValueTypeEnum.string,
[VariableInputEnum.select]: WorkflowIOValueTypeEnum.string,
[VariableInputEnum.textarea]: WorkflowIOValueTypeEnum.string,
[VariableInputEnum.custom]: WorkflowIOValueTypeEnum.any
};
...@@ -451,13 +451,12 @@ const PlanUsage = () => { ...@@ -451,13 +451,12 @@ const PlanUsage = () => {
</Button> </Button>
</Flex> </Flex>
<Box px={[5, 7]} pb={[3, 6]}> <Box px={[5, 7]} pb={[3, 6]}>
{isFreeTeam ? ( {isFreeTeam && (
<>
<Box mt="2" color={'#485264'} fontSize="sm"> <Box mt="2" color={'#485264'} fontSize="sm">
{t('common:info.free_plan')} {t('common:info.free_plan')}
</Box> </Box>
</> )}
) : ( {standardPlan.currentSubLevel !== StandardSubLevelEnum.free && (
<Flex mt="2" color={'#485264'} fontSize="xs"> <Flex mt="2" color={'#485264'} fontSize="xs">
<Box>{t('common:support.wallet.Plan expired time')}:</Box> <Box>{t('common:support.wallet.Plan expired time')}:</Box>
<Box ml={2}>{formatTime2YMD(standardPlan?.expiredTime)}</Box> <Box ml={2}>{formatTime2YMD(standardPlan?.expiredTime)}</Box>
......
...@@ -10,7 +10,7 @@ import { Background, NodeProps } from 'reactflow'; ...@@ -10,7 +10,7 @@ import { Background, NodeProps } from 'reactflow';
import NodeCard from '../render/NodeCard'; import NodeCard from '../render/NodeCard';
import Container from '../../components/Container'; import Container from '../../components/Container';
import IOTitle from '../../components/IOTitle'; import IOTitle from '../../components/IOTitle';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'next-i18next';
import RenderInput from '../render/RenderInput'; import RenderInput from '../render/RenderInput';
import { Box } from '@chakra-ui/react'; import { Box } from '@chakra-ui/react';
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel'; import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
......
...@@ -12,7 +12,7 @@ import { ...@@ -12,7 +12,7 @@ import {
import { useContextSelector } from 'use-context-selector'; import { useContextSelector } from 'use-context-selector';
import { WorkflowContext } from '../../../context'; import { WorkflowContext } from '../../../context';
import { AppContext } from '../../../../context'; import { AppContext } from '../../../../context';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'next-i18next';
import { getGlobalVariableNode } from '@/web/core/workflow/adapt'; import { getGlobalVariableNode } from '@/web/core/workflow/adapt';
const typeMap = { const typeMap = {
......
import { FlowNodeItemType } from '@fastgpt/global/core/workflow/type/node'; import { FlowNodeItemType } from '@fastgpt/global/core/workflow/type/node';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'next-i18next';
import { NodeProps } from 'reactflow'; import { NodeProps } from 'reactflow';
import NodeCard from '../render/NodeCard'; import NodeCard from '../render/NodeCard';
import EmptyTip from '@fastgpt/web/components/common/EmptyTip'; import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
......
...@@ -409,7 +409,7 @@ const FieldEditModal = ({ ...@@ -409,7 +409,7 @@ const FieldEditModal = ({
{/* value type */} {/* value type */}
<Flex alignItems={'center'}> <Flex alignItems={'center'}>
<FormLabel flex={'0 0 100px'} fontWeight={'medium'}> <FormLabel flex={'0 0 100px'} fontWeight={'medium'}>
{t('common:core.module.Data Type')} {t('workflow:value_type')}
</FormLabel> </FormLabel>
{showValueTypeSelect ? ( {showValueTypeSelect ? (
<Box flex={1}> <Box flex={1}>
......
...@@ -43,7 +43,6 @@ import LightRowTabs from '@fastgpt/web/components/common/Tabs/LightRowTabs'; ...@@ -43,7 +43,6 @@ import LightRowTabs from '@fastgpt/web/components/common/Tabs/LightRowTabs';
import { useSystem } from '@fastgpt/web/hooks/useSystem'; import { useSystem } from '@fastgpt/web/hooks/useSystem';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import TemplateMarketModal from './components/TemplateMarketModal'; import TemplateMarketModal from './components/TemplateMarketModal';
import { useSystemStore } from '@/web/common/system/useSystemStore';
const CreateModal = dynamic(() => import('./components/CreateModal')); const CreateModal = dynamic(() => import('./components/CreateModal'));
const EditFolderModal = dynamic( const EditFolderModal = dynamic(
...@@ -71,7 +70,6 @@ const MyApps = () => { ...@@ -71,7 +70,6 @@ const MyApps = () => {
setSearchKey setSearchKey
} = useContextSelector(AppListContext, (v) => v); } = useContextSelector(AppListContext, (v) => v);
const { userInfo } = useUserStore(); const { userInfo } = useUserStore();
const { setAppType } = useSystemStore();
const [createAppType, setCreateAppType] = useState<CreateAppType>(); const [createAppType, setCreateAppType] = useState<CreateAppType>();
const { const {
...@@ -173,13 +171,12 @@ const MyApps = () => { ...@@ -173,13 +171,12 @@ const MyApps = () => {
fontSize={['sm', 'md']} fontSize={['sm', 'md']}
flexShrink={0} flexShrink={0}
onChange={(e) => { onChange={(e) => {
setAppType(e); router.push({
// router.push({ query: {
// query: { ...router.query,
// ...router.query, type: e
// type: e }
// } });
// });
}} }}
/> />
<Box flex={1} /> <Box flex={1} />
......
import React, { useMemo, useState } from 'react'; import React, { useMemo } from 'react';
import { Box, Flex, Button, IconButton, Input, Textarea, HStack } from '@chakra-ui/react'; import { Box, Flex, Button } from '@chakra-ui/react';
import { DeleteIcon } from '@chakra-ui/icons';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { useRequest2 } from '@fastgpt/web/hooks/useRequest'; import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import { getDatasetCollectionById } from '@/web/core/dataset/api'; import { getDatasetCollectionById } from '@/web/core/dataset/api';
...@@ -33,7 +32,7 @@ const MetaDataCard = ({ datasetId }: { datasetId: string }) => { ...@@ -33,7 +32,7 @@ const MetaDataCard = ({ datasetId }: { datasetId: string }) => {
manual: false manual: false
} }
); );
const metadataList = useMemo(() => { const metadataList = useMemo<{ label?: string; value?: any }[]>(() => {
if (!collection) return []; if (!collection) return [];
const webSelector = const webSelector =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment