File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/components/common/PromptStore Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ const clearPromptTemplate = () => {
147147 message .success (t (' common.clearSuccess' ))
148148}
149149
150- const importPromptTemplate = () => {
150+ const importPromptTemplate = (from = ' online ' ) => {
151151 try {
152152 const jsonData = JSON .parse (tempPromptValue .value )
153153 let key = ' '
@@ -168,7 +168,7 @@ const importPromptTemplate = () => {
168168 }
169169
170170 for (const i of jsonData ) {
171- if (! (' key' in i ) || ! (' value' in i ))
171+ if (! (key in i ) || ! (value in i ))
172172 throw new Error (t (' store.importError' ))
173173 let safe = true
174174 for (const j of promptList .value ) {
@@ -191,6 +191,8 @@ const importPromptTemplate = () => {
191191 catch {
192192 message .error (' JSON 格式错误,请检查 JSON 格式' )
193193 }
194+ if (from === ' local' )
195+ showModal .value = ! showModal .value
194196}
195197
196198// 模板导出
@@ -469,7 +471,7 @@ const dataSource = computed(() => {
469471 block
470472 type =" primary"
471473 :disabled =" inputStatus"
472- @click =" () => { importPromptTemplate() }"
474+ @click =" () => { importPromptTemplate('local' ) }"
473475 >
474476 {{ t('common.import') }}
475477 </NButton >
You can’t perform that action at this time.
0 commit comments