Skip to content

Commit e2eeee4

Browse files
authored
fix: local import error and NModal not as expected (#938)
1 parent 32ad204 commit e2eeee4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/components/common/PromptStore/index.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff 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>

0 commit comments

Comments
 (0)