diff --git a/web/package.json b/web/package.json index 4662fc7f..4395bdaf 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "thoughts", - "version": "0.12.1", + "version": "0.13.1", "private": true, "description": "一个简洁的思维导图", "author": "街角小林<1013335014@qq.com>", diff --git a/web/src/lang/en_us.js b/web/src/lang/en_us.js index 0b692313..56d9e50c 100644 --- a/web/src/lang/en_us.js +++ b/web/src/lang/en_us.js @@ -80,13 +80,17 @@ export default { enableAutoEnterTextEditWhenKeydown: 'Auto enter text edit when keydown', confirm: 'Confirm', cancel: 'Cancel', - changeRichTextTip: 'This operation will clear all historical modification records and modify the mind map data. Do you want to continue?', + changeRichTextTip: + 'This operation will clear all historical modification records and modify the mind map data. Do you want to continue?', changeRichTextTip2: 'Do you want to switch to rich text mode?', changeRichTextTip3: 'Do you want to switch to non rich text mode?', - enableDragImport: 'Is it allowed to directly drag and drop files to the page for import', + enableDragImport: + 'Is it allowed to directly drag and drop files to the page for import', imgTextMargin: 'Node image and text margin', textContentMargin: 'Node contents margin', - enableInheritAncestorLineStyle: 'Node connection style inherits the style of ancestor nodes', + enableInheritAncestorLineStyle: + 'Node connection style inherits the style of ancestor nodes', + enableAi: 'Is enable AI function' }, color: { moreColor: 'More color' @@ -276,7 +280,7 @@ export default { bottom: 'Bottom', left: 'Left', right: 'Right', - tag: 'Tag', + tag: 'Tag' }, theme: { title: 'Theme', @@ -350,7 +354,8 @@ export default { dragTip: 'Release here to import the file', emptyTip: 'The file content is empty, use default data rendering', deleteNodeImgTip: 'Are you sure to delete the node image?', - autoOpenNodeRichTextTip: 'Detected imported rich text content, automatically enabled rich text mode' + autoOpenNodeRichTextTip: + 'Detected imported rich text content, automatically enabled rich text mode' }, mouseAction: { tip1: @@ -436,16 +441,20 @@ export default { connectFailedTip: 'Client connection failed, please check:', connectFailedCheckTip1: '1. Have you installed the mind mapping client? If not, please click here to install:', - connectFailedCheckTip2: '2. If the client is installed, please confirm if the client is opened.', + connectFailedCheckTip2: + '2. If the client is installed, please confirm if the client is opened.', connectFailedCheckTip3: 'If it has already been installed and started, you can try closing and restarting it.', - connectFailedCheckTip4: 'After completing the above steps, you can click on:', + connectFailedCheckTip4: + 'After completing the above steps, you can click on:', baiduNetdisk: 'Baidu Netdisk', createMindMapTitle: 'One click generation of mind maps', createTip: 'Please enter a theme, and AI will generate a mind map based on your theme, such as: Hangzhou weekend travel plan.', - importantTip: 'Important note: One click generation will overwrite existing data. It is recommended to export the current data first.', - wantModifyAiConfigTip: 'Do you want to modify the AI configuration? Please click on:', + importantTip: + 'Important note: One click generation will overwrite existing data. It is recommended to export the current data first.', + wantModifyAiConfigTip: + 'Do you want to modify the AI configuration? Please click on:', modifyAIConfiguration: 'Modify AI configuration', chatInputPlaceholder: 'Enter to send, Shift+Enter to wrap.', send: 'Send', @@ -455,7 +464,8 @@ export default { stoppedGenerating: 'Stopped generating', AIConfiguration: 'AI configuration', VolcanoArkLargeModelConfiguration: 'Volcano Ark Large Model Configuration:', - configTip: 'At present, only the Volcano Ark model is supported, and you need to obtain the key yourself. For detailed operation steps, please refer to:', + configTip: + 'At present, only the Volcano Ark model is supported, and you need to obtain the key yourself. For detailed operation steps, please refer to:', course: 'Course', inferenceAccessPoint: 'Inference access point', mindMappingClientConfiguration: 'Mind mapping client configuration:', @@ -478,7 +488,8 @@ export default { aiCreateMsgPostfix: '】. It needs to be returned in Markdown format and can only use two syntax: Markdown title and unordered list. It can support multiple layers of nesting. Just return the content.', aiCreatePartMsgPrefix: 'I have a theme for【', - aiCreatePartMsgCenter: '】Can you help me continue writing one of the contents of the mind map【', + aiCreatePartMsgCenter: + '】Can you help me continue writing one of the contents of the mind map【', aiCreatePartMsgPostfix: '】The subordinate content of the node needs to be returned in Markdown format and can only use two syntax: Markdown title and unordered list. It can support multi-level nesting. Just return the content.' } diff --git a/web/src/lang/zh_cn.js b/web/src/lang/zh_cn.js index b7b984fb..5ef2b6d5 100644 --- a/web/src/lang/zh_cn.js +++ b/web/src/lang/zh_cn.js @@ -85,7 +85,8 @@ export default { changeRichTextTip3: '是否切换为非富文本模式?', enableDragImport: '是否允许直接拖拽文件到页面进行导入', imgTextMargin: '节点图片和文本间隔', - textContentMargin: '节点各种内容间隔' + textContentMargin: '节点各种内容间隔', + enableAi: '是否开启AI功能' }, color: { moreColor: '更多颜色' diff --git a/web/src/lang/zh_tw.js b/web/src/lang/zh_tw.js index e1b3cac5..6b2a2366 100644 --- a/web/src/lang/zh_tw.js +++ b/web/src/lang/zh_tw.js @@ -86,7 +86,8 @@ export default { textContentMargin: '節點各種內容間隔', enableAutoEnterTextEditWhenKeydown: '鍵盤輸入時自動進入文本編輯', enableInheritAncestorLineStyle: '節點連線樣式繼承祖先節點的樣式', - alwaysShowExpandBtn: '是否壹直顯示展開收起按鈕' + alwaysShowExpandBtn: '是否壹直顯示展開收起按鈕', + enableAi: '是否開啓AI功能' }, color: { moreColor: '更多顏色' diff --git a/web/src/pages/Edit/components/AiCreate.vue b/web/src/pages/Edit/components/AiCreate.vue index e30220d3..79bec324 100644 --- a/web/src/pages/Edit/components/AiCreate.vue +++ b/web/src/pages/Edit/components/AiCreate.vue @@ -238,15 +238,15 @@ export default { ] }, content => { - if (content && /\n$/.test(content)) { - this.aiCreatingContent = content + if (content) { + const arr = content.split(/\n+/) + this.aiCreatingContent = arr.splice(0, arr.length - 1).join('\n') } this.loopRenderOnAiCreating() }, content => { this.aiCreatingContent = content this.resetOnAiCreatingStop() - this.$message.success(this.$t('ai.aiGenerationSuccess')) }, () => { this.resetOnAiCreatingStop() @@ -319,6 +319,7 @@ export default { // 还要触发一遍渲染,否则会丢失数据 this.mindMap.updateData(treeData) this.resetOnRenderEnd() + this.$message.success(this.$t('ai.aiGenerationSuccess')) } } this.mindMap.on('node_tree_render_end', onRenderEnd) @@ -401,15 +402,16 @@ export default { ] }, content => { - if (content && /\n$/.test(content)) { - this.aiCreatingContent = content + if (content) { + const arr = content.split(/\n+/) + this.aiCreatingContent = arr.splice(0, arr.length - 1).join('\n') } + this.loopRenderOnAiCreatingPart() }, content => { this.aiCreatingContent = content this.resetOnAiCreatingStop() - this.$message.success(this.$t('ai.aiGenerationSuccess')) }, () => { this.resetOnAiCreatingStop() @@ -482,6 +484,7 @@ export default { } else { this.mindMap.updateData(treeData) this.resetOnRenderEnd() + this.$message.success(this.$t('ai.aiGenerationSuccess')) } } this.mindMap.on('node_tree_render_end', onRenderEnd) diff --git a/web/src/pages/Edit/components/Contextmenu.vue b/web/src/pages/Edit/components/Contextmenu.vue index 7541be26..353e943c 100644 --- a/web/src/pages/Edit/components/Contextmenu.vue +++ b/web/src/pages/Edit/components/Contextmenu.vue @@ -262,7 +262,7 @@ export default { isDark: state => state.localConfig.isDark, supportNumbers: state => state.supportNumbers, supportCheckbox: state => state.supportCheckbox, - enableAi: state => state.enableAi + enableAi: state => state.localConfig.enableAi }), expandList() { return [ diff --git a/web/src/pages/Edit/components/Edit.vue b/web/src/pages/Edit/components/Edit.vue index 7b9a7692..0e1b5f98 100644 --- a/web/src/pages/Edit/components/Edit.vue +++ b/web/src/pages/Edit/components/Edit.vue @@ -234,8 +234,8 @@ export default { isUseMomentum: state => state.localConfig.isUseMomentum, extraTextOnExport: state => state.extraTextOnExport, isDragOutlineTreeNode: state => state.isDragOutlineTreeNode, - enableAi: state => state.enableAi, - isDark: state => state.localConfig.isDark + isDark: state => state.localConfig.isDark, + enableAi: state => state.localConfig.enableAi }) }, watch: { @@ -268,11 +268,6 @@ export default { } } }, - created() { - if (this.$route.query && this.$route.query.ai) { - this.setEnableAi(true) - } - }, async mounted() { showLoading() // this.showNewFeatureInfo() @@ -310,7 +305,7 @@ export default { this.mindMap.destroy() }, methods: { - ...mapMutations(['setFileName', 'setIsUnSave', 'setEnableAi']), + ...mapMutations(['setFileName', 'setIsUnSave']), handleStartTextEdit() { this.mindMap.renderer.startTextEdit() diff --git a/web/src/pages/Edit/components/Setting.vue b/web/src/pages/Edit/components/Setting.vue index cbcb2ba8..a4309c95 100644 --- a/web/src/pages/Edit/components/Setting.vue +++ b/web/src/pages/Edit/components/Setting.vue @@ -246,6 +246,16 @@ > + +
+
+ {{ $t('setting.enableAi') }} +
+
@@ -435,7 +445,8 @@ export default { isShowScrollbar: false, isUseHandDrawnLikeStyle: false, isUseMomentum: false, - enableDragImport: false + enableDragImport: false, + enableAi: false } } }, diff --git a/web/src/pages/Edit/components/SidebarTrigger.vue b/web/src/pages/Edit/components/SidebarTrigger.vue index 9a98742c..a721d11b 100644 --- a/web/src/pages/Edit/components/SidebarTrigger.vue +++ b/web/src/pages/Edit/components/SidebarTrigger.vue @@ -45,7 +45,7 @@ export default { isDark: state => state.localConfig.isDark, activeSidebar: state => state.activeSidebar, isReadonly: state => state.isReadonly, - enableAi: state => state.enableAi + enableAi: state => state.localConfig.enableAi }), triggerList() { diff --git a/web/src/pages/Edit/components/Toolbar.vue b/web/src/pages/Edit/components/Toolbar.vue index b33b6e2a..aa119206 100644 --- a/web/src/pages/Edit/components/Toolbar.vue +++ b/web/src/pages/Edit/components/Toolbar.vue @@ -241,7 +241,7 @@ export default { isDark: state => state.localConfig.isDark, isHandleLocalFile: state => state.isHandleLocalFile, openNodeRichText: state => state.localConfig.openNodeRichText, - enableAi: state => state.enableAi + enableAi: state => state.localConfig.enableAi }), btnLit() { diff --git a/web/src/pages/Workbenche/components/AboutDialog.vue b/web/src/pages/Workbenche/components/AboutDialog.vue index 83b79f78..e01f42dc 100644 --- a/web/src/pages/Workbenche/components/AboutDialog.vue +++ b/web/src/pages/Workbenche/components/AboutDialog.vue @@ -23,6 +23,7 @@ 百度云 releases

+

如需进微信交流群参与讨论,可微信添加:wanglinguanfang。备注:客户端

diff --git a/web/src/store.js b/web/src/store.js index 03518d06..395f871d 100644 --- a/web/src/store.js +++ b/web/src/store.js @@ -25,7 +25,9 @@ const store = new Vuex.Store({ // 是否开启动量效果 isUseMomentum: true, // 是否是暗黑模式 - isDark: false + isDark: false, + // 是否开启AI功能 + enableAi: true }, activeSidebar: '', // 当前显示的侧边栏 localEditList: [], // 客户端中正在编辑的思维导图列表 @@ -49,7 +51,6 @@ const store = new Vuex.Store({ port: 3456, method: 'POST' }, - enableAi: false, // 是否开启AI功能 currentFolder: '' // 当前打开的目录 }, mutations: { @@ -171,11 +172,6 @@ const store = new Vuex.Store({ // 设置树节点拖拽 setIsDragOutlineTreeNode(state, data) { state.isDragOutlineTreeNode = data - }, - - // 设置是否启用AI功能 - setEnableAi(state, data) { - state.enableAi = data } }, actions: {