Demo:优化AI生成逻辑
This commit is contained in:
parent
4f2d4f8e36
commit
2577da10d0
@ -80,13 +80,17 @@ export default {
|
|||||||
enableAutoEnterTextEditWhenKeydown: 'Auto enter text edit when keydown',
|
enableAutoEnterTextEditWhenKeydown: 'Auto enter text edit when keydown',
|
||||||
confirm: 'Confirm',
|
confirm: 'Confirm',
|
||||||
cancel: 'Cancel',
|
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?',
|
changeRichTextTip2: 'Do you want to switch to rich text mode?',
|
||||||
changeRichTextTip3: 'Do you want to switch to non 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',
|
imgTextMargin: 'Node image and text margin',
|
||||||
textContentMargin: 'Node contents 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: {
|
color: {
|
||||||
moreColor: 'More color'
|
moreColor: 'More color'
|
||||||
@ -275,7 +279,7 @@ export default {
|
|||||||
bottom: 'Bottom',
|
bottom: 'Bottom',
|
||||||
left: 'Left',
|
left: 'Left',
|
||||||
right: 'Right',
|
right: 'Right',
|
||||||
tag: 'Tag',
|
tag: 'Tag'
|
||||||
},
|
},
|
||||||
theme: {
|
theme: {
|
||||||
title: 'Theme',
|
title: 'Theme',
|
||||||
@ -345,7 +349,8 @@ export default {
|
|||||||
exportError: 'Export failed',
|
exportError: 'Export failed',
|
||||||
dragTip: 'Release here to import the file',
|
dragTip: 'Release here to import the file',
|
||||||
deleteNodeImgTip: 'Are you sure to delete the node image?',
|
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: {
|
mouseAction: {
|
||||||
tip1:
|
tip1:
|
||||||
@ -430,16 +435,20 @@ export default {
|
|||||||
connectFailedTip: 'Client connection failed, please check:',
|
connectFailedTip: 'Client connection failed, please check:',
|
||||||
connectFailedCheckTip1:
|
connectFailedCheckTip1:
|
||||||
'1. Have you installed the mind mapping client? If not, please click here to install:',
|
'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:
|
connectFailedCheckTip3:
|
||||||
'If it has already been installed and started, you can try closing and restarting it.',
|
'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',
|
baiduNetdisk: 'Baidu Netdisk',
|
||||||
createMindMapTitle: 'One click generation of mind maps',
|
createMindMapTitle: 'One click generation of mind maps',
|
||||||
createTip:
|
createTip:
|
||||||
'Please enter a theme, and AI will generate a mind map based on your theme, such as: Hangzhou weekend travel plan.',
|
'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.',
|
importantTip:
|
||||||
wantModifyAiConfigTip: 'Do you want to modify the AI configuration? Please click on:',
|
'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',
|
modifyAIConfiguration: 'Modify AI configuration',
|
||||||
chatInputPlaceholder: 'Enter to send, Shift+Enter to wrap.',
|
chatInputPlaceholder: 'Enter to send, Shift+Enter to wrap.',
|
||||||
send: 'Send',
|
send: 'Send',
|
||||||
@ -449,7 +458,8 @@ export default {
|
|||||||
stoppedGenerating: 'Stopped generating',
|
stoppedGenerating: 'Stopped generating',
|
||||||
AIConfiguration: 'AI configuration',
|
AIConfiguration: 'AI configuration',
|
||||||
VolcanoArkLargeModelConfiguration: 'Volcano Ark Large Model 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',
|
course: 'Course',
|
||||||
inferenceAccessPoint: 'Inference access point',
|
inferenceAccessPoint: 'Inference access point',
|
||||||
mindMappingClientConfiguration: 'Mind mapping client configuration:',
|
mindMappingClientConfiguration: 'Mind mapping client configuration:',
|
||||||
@ -472,7 +482,8 @@ export default {
|
|||||||
aiCreateMsgPostfix:
|
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.',
|
'】. 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【',
|
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:
|
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.'
|
'】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.'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,7 +85,8 @@ export default {
|
|||||||
changeRichTextTip3: '是否切换为非富文本模式?',
|
changeRichTextTip3: '是否切换为非富文本模式?',
|
||||||
enableDragImport: '是否允许直接拖拽文件到页面进行导入',
|
enableDragImport: '是否允许直接拖拽文件到页面进行导入',
|
||||||
imgTextMargin: '节点图片和文本间隔',
|
imgTextMargin: '节点图片和文本间隔',
|
||||||
textContentMargin: '节点各种内容间隔'
|
textContentMargin: '节点各种内容间隔',
|
||||||
|
enableAi: '是否开启AI功能'
|
||||||
},
|
},
|
||||||
color: {
|
color: {
|
||||||
moreColor: '更多颜色'
|
moreColor: '更多颜色'
|
||||||
|
|||||||
@ -86,7 +86,8 @@ export default {
|
|||||||
textContentMargin: '節點各種內容間隔',
|
textContentMargin: '節點各種內容間隔',
|
||||||
enableAutoEnterTextEditWhenKeydown: '鍵盤輸入時自動進入文本編輯',
|
enableAutoEnterTextEditWhenKeydown: '鍵盤輸入時自動進入文本編輯',
|
||||||
enableInheritAncestorLineStyle: '節點連線樣式繼承祖先節點的樣式',
|
enableInheritAncestorLineStyle: '節點連線樣式繼承祖先節點的樣式',
|
||||||
alwaysShowExpandBtn: '是否壹直顯示展開收起按鈕'
|
alwaysShowExpandBtn: '是否壹直顯示展開收起按鈕',
|
||||||
|
enableAi: '是否開啓AI功能'
|
||||||
},
|
},
|
||||||
color: {
|
color: {
|
||||||
moreColor: '更多顏色'
|
moreColor: '更多顏色'
|
||||||
|
|||||||
@ -238,15 +238,15 @@ export default {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
content => {
|
content => {
|
||||||
if (content && /\n$/.test(content)) {
|
if (content) {
|
||||||
this.aiCreatingContent = content
|
const arr = content.split(/\n+/)
|
||||||
|
this.aiCreatingContent = arr.splice(0, arr.length - 1).join('\n')
|
||||||
}
|
}
|
||||||
this.loopRenderOnAiCreating()
|
this.loopRenderOnAiCreating()
|
||||||
},
|
},
|
||||||
content => {
|
content => {
|
||||||
this.aiCreatingContent = content
|
this.aiCreatingContent = content
|
||||||
this.resetOnAiCreatingStop()
|
this.resetOnAiCreatingStop()
|
||||||
this.$message.success(this.$t('ai.aiGenerationSuccess'))
|
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.resetOnAiCreatingStop()
|
this.resetOnAiCreatingStop()
|
||||||
@ -319,6 +319,7 @@ export default {
|
|||||||
// 还要触发一遍渲染,否则会丢失数据
|
// 还要触发一遍渲染,否则会丢失数据
|
||||||
this.mindMap.updateData(treeData)
|
this.mindMap.updateData(treeData)
|
||||||
this.resetOnRenderEnd()
|
this.resetOnRenderEnd()
|
||||||
|
this.$message.success(this.$t('ai.aiGenerationSuccess'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.mindMap.on('node_tree_render_end', onRenderEnd)
|
this.mindMap.on('node_tree_render_end', onRenderEnd)
|
||||||
@ -401,15 +402,16 @@ export default {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
content => {
|
content => {
|
||||||
if (content && /\n$/.test(content)) {
|
if (content) {
|
||||||
this.aiCreatingContent = content
|
const arr = content.split(/\n+/)
|
||||||
|
this.aiCreatingContent = arr.splice(0, arr.length - 1).join('\n')
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loopRenderOnAiCreatingPart()
|
this.loopRenderOnAiCreatingPart()
|
||||||
},
|
},
|
||||||
content => {
|
content => {
|
||||||
this.aiCreatingContent = content
|
this.aiCreatingContent = content
|
||||||
this.resetOnAiCreatingStop()
|
this.resetOnAiCreatingStop()
|
||||||
this.$message.success(this.$t('ai.aiGenerationSuccess'))
|
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.resetOnAiCreatingStop()
|
this.resetOnAiCreatingStop()
|
||||||
@ -482,6 +484,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.mindMap.updateData(treeData)
|
this.mindMap.updateData(treeData)
|
||||||
this.resetOnRenderEnd()
|
this.resetOnRenderEnd()
|
||||||
|
this.$message.success(this.$t('ai.aiGenerationSuccess'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.mindMap.on('node_tree_render_end', onRenderEnd)
|
this.mindMap.on('node_tree_render_end', onRenderEnd)
|
||||||
|
|||||||
@ -258,7 +258,7 @@ export default {
|
|||||||
isDark: state => state.localConfig.isDark,
|
isDark: state => state.localConfig.isDark,
|
||||||
supportNumbers: state => state.supportNumbers,
|
supportNumbers: state => state.supportNumbers,
|
||||||
supportCheckbox: state => state.supportCheckbox,
|
supportCheckbox: state => state.supportCheckbox,
|
||||||
enableAi: state => state.enableAi
|
enableAi: state => state.localConfig.enableAi
|
||||||
}),
|
}),
|
||||||
expandList() {
|
expandList() {
|
||||||
return [
|
return [
|
||||||
|
|||||||
@ -218,7 +218,7 @@ export default {
|
|||||||
isUseMomentum: state => state.localConfig.isUseMomentum,
|
isUseMomentum: state => state.localConfig.isUseMomentum,
|
||||||
extraTextOnExport: state => state.extraTextOnExport,
|
extraTextOnExport: state => state.extraTextOnExport,
|
||||||
isDragOutlineTreeNode: state => state.isDragOutlineTreeNode,
|
isDragOutlineTreeNode: state => state.isDragOutlineTreeNode,
|
||||||
enableAi: state => state.enableAi
|
enableAi: state => state.localConfig.enableAi
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -251,11 +251,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
|
||||||
if (this.$route.query && this.$route.query.ai) {
|
|
||||||
this.setEnableAi(true)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
showLoading()
|
showLoading()
|
||||||
// this.showNewFeatureInfo()
|
// this.showNewFeatureInfo()
|
||||||
@ -288,8 +283,6 @@ export default {
|
|||||||
this.mindMap.destroy()
|
this.mindMap.destroy()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['setEnableAi']),
|
|
||||||
|
|
||||||
handleStartTextEdit() {
|
handleStartTextEdit() {
|
||||||
this.mindMap.renderer.startTextEdit()
|
this.mindMap.renderer.startTextEdit()
|
||||||
},
|
},
|
||||||
|
|||||||
@ -246,6 +246,16 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 是否开启ai功能 -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="rowItem">
|
||||||
|
<el-checkbox
|
||||||
|
v-model="localConfigs.enableAi"
|
||||||
|
@change="updateLocalConfig('enableAi', $event)"
|
||||||
|
>{{ $t('setting.enableAi') }}</el-checkbox
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!-- 是否开启手绘风格 -->
|
<!-- 是否开启手绘风格 -->
|
||||||
<div class="row" v-if="supportHandDrawnLikeStyle">
|
<div class="row" v-if="supportHandDrawnLikeStyle">
|
||||||
<div class="rowItem">
|
<div class="rowItem">
|
||||||
@ -435,7 +445,8 @@ export default {
|
|||||||
isShowScrollbar: false,
|
isShowScrollbar: false,
|
||||||
isUseHandDrawnLikeStyle: false,
|
isUseHandDrawnLikeStyle: false,
|
||||||
isUseMomentum: false,
|
isUseMomentum: false,
|
||||||
enableDragImport: false
|
enableDragImport: false,
|
||||||
|
enableAi: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -45,7 +45,7 @@ export default {
|
|||||||
isDark: state => state.localConfig.isDark,
|
isDark: state => state.localConfig.isDark,
|
||||||
activeSidebar: state => state.activeSidebar,
|
activeSidebar: state => state.activeSidebar,
|
||||||
isReadonly: state => state.isReadonly,
|
isReadonly: state => state.isReadonly,
|
||||||
enableAi: state => state.enableAi
|
enableAi: state => state.localConfig.enableAi
|
||||||
}),
|
}),
|
||||||
|
|
||||||
triggerList() {
|
triggerList() {
|
||||||
|
|||||||
@ -219,7 +219,7 @@ export default {
|
|||||||
isDark: state => state.localConfig.isDark,
|
isDark: state => state.localConfig.isDark,
|
||||||
isHandleLocalFile: state => state.isHandleLocalFile,
|
isHandleLocalFile: state => state.isHandleLocalFile,
|
||||||
openNodeRichText: state => state.localConfig.openNodeRichText,
|
openNodeRichText: state => state.localConfig.openNodeRichText,
|
||||||
enableAi: state => state.enableAi
|
enableAi: state => state.localConfig.enableAi
|
||||||
}),
|
}),
|
||||||
|
|
||||||
btnLit() {
|
btnLit() {
|
||||||
|
|||||||
@ -23,7 +23,9 @@ const store = new Vuex.Store({
|
|||||||
// 是否开启动量效果
|
// 是否开启动量效果
|
||||||
isUseMomentum: true,
|
isUseMomentum: true,
|
||||||
// 是否是暗黑模式
|
// 是否是暗黑模式
|
||||||
isDark: false
|
isDark: false,
|
||||||
|
// 是否开启AI功能
|
||||||
|
enableAi: true
|
||||||
},
|
},
|
||||||
activeSidebar: '', // 当前显示的侧边栏
|
activeSidebar: '', // 当前显示的侧边栏
|
||||||
isOutlineEdit: false, // 是否是大纲编辑模式
|
isOutlineEdit: false, // 是否是大纲编辑模式
|
||||||
@ -45,8 +47,7 @@ const store = new Vuex.Store({
|
|||||||
model: '',
|
model: '',
|
||||||
port: 3456,
|
port: 3456,
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
},
|
}
|
||||||
enableAi: false // 是否开启AI功能
|
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
// 设置思维导图数据
|
// 设置思维导图数据
|
||||||
@ -143,11 +144,6 @@ const store = new Vuex.Store({
|
|||||||
// 设置树节点拖拽
|
// 设置树节点拖拽
|
||||||
setIsDragOutlineTreeNode(state, data) {
|
setIsDragOutlineTreeNode(state, data) {
|
||||||
state.isDragOutlineTreeNode = data
|
state.isDragOutlineTreeNode = data
|
||||||
},
|
|
||||||
|
|
||||||
// 设置是否启用AI功能
|
|
||||||
setEnableAi(state, data) {
|
|
||||||
state.enableAi = data
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user