Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function VariableLabelPlugin({
const nodeAvatar = currentVariable?.parent?.avatar || '';
return $createVariableLabelNode(textNode.getTextContent(), variableLabel, nodeAvatar);
},
[t, variables]
[t]
);

const getVariableMatch = useCallback((text: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,26 @@ export default function VariablePlugin({ variables }: { variables: EditorVariabl
return variables.map((item) => item.key);
}, [variables]);

const createVariableNode = useCallback(
(textNode: TextNode): VariableNode => {
const currentVariable = variables.find(
(item) => item.key === textNode.getTextContent().replace(/[{}]/g, '')
);
const variableLabel = currentVariable?.label;
return $createVariableNode(textNode.getTextContent(), variableLabel || '');
},
[variables]
);

const getVariableMatch = useCallback(
(text: string) => {
const matches = REGEX.exec(text);
if (!matches) return null;
if (variableKeys.indexOf(matches[3]) === -1) return null;
const hashtagLength = matches[3].length + 4;
const startOffset = matches.index;
const endOffset = startOffset + hashtagLength;
return {
end: endOffset,
start: startOffset
};
},
[variableKeys]
);
const createVariableNode = useCallback((textNode: TextNode): VariableNode => {
const currentVariable = variables.find(
(item) => item.key === textNode.getTextContent().replace(/[{}]/g, '')
);
const variableLabel = currentVariable?.label;
return $createVariableNode(textNode.getTextContent(), variableLabel || '');
}, []);

const getVariableMatch = useCallback((text: string) => {
const matches = REGEX.exec(text);
if (!matches) return null;
if (variableKeys.indexOf(matches[3]) === -1) return null;
const hashtagLength = matches[3].length + 4;
const startOffset = matches.index;
const endOffset = startOffset + hashtagLength;
return {
end: endOffset,
start: startOffset
};
}, []);

useEffect(() => {
mergeRegister(
Expand Down
1 change: 1 addition & 0 deletions packages/web/i18n/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"confirm_copy_app_tip": "The system will create an app with the same configuration for you, but permissions will not be copied. Please confirm!",
"confirm_del_app_tip": "Are you sure you want to delete 【{{name}}】 and all of its chat history?",
"confirm_delete_folder_tip": "Confirm to delete this folder? All apps and corresponding conversation records under it will be deleted. Please confirm!",
"copilot_config_message": "Current Node Configuration Information: \n Code Type: {{codeType}} \n Current Code: \\\\`\\\\`\\\\`{{codeType}} \n{{code}} \\\\`\\\\`\\\\` \n Input Parameters: {{inputs}} \n Output Parameters: {{outputs}}",
"copilot_confirm_message": "The original configuration has been received to understand the current code structure and input and output parameters. \nPlease explain your optimization requirements.",
"copy_one_app": "Create Duplicate",
"core.app.QG.Switch": "Enable guess what you want to ask",
Expand Down
1 change: 1 addition & 0 deletions packages/web/i18n/zh-Hant/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"confirm_copy_app_tip": "系統將為您建立一個相同設定的應用程式,但權限不會複製,請確認!",
"confirm_del_app_tip": "確認刪除【{{name}}】及其所有聊天紀錄?",
"confirm_delete_folder_tip": "確認刪除這個資料夾?將會刪除它底下所有應用程式及對應的對話紀錄,請確認!",
"copilot_config_message": "當前節點配置信息: \n代碼類型:{{codeType}} \n當前代碼: \\\\`\\\\`\\\\`{{codeType}} \n{{code}} \\\\`\\\\`\\\\` \n輸入參數: {{inputs}} \n輸出參數: {{outputs}}",
"copilot_confirm_message": "已接收到原始配置,了解當前代碼結構和輸入輸出參數。\n請說明您的優化需求。",
"copy_one_app": "建立副本",
"core.app.QG.Switch": "啟用猜你想問",
Expand Down
Loading