|
|
@ -147,7 +147,7 @@ const clearPromptTemplate = () => {
|
|
|
|
message.success(t('common.clearSuccess'))
|
|
|
|
message.success(t('common.clearSuccess'))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const importPromptTemplate = () => {
|
|
|
|
const importPromptTemplate = (from = 'online') => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const jsonData = JSON.parse(tempPromptValue.value)
|
|
|
|
const jsonData = JSON.parse(tempPromptValue.value)
|
|
|
|
let key = ''
|
|
|
|
let key = ''
|
|
|
@ -168,7 +168,7 @@ const importPromptTemplate = () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (const i of jsonData) {
|
|
|
|
for (const i of jsonData) {
|
|
|
|
if (!('key' in i) || !('value' in i))
|
|
|
|
if (!(key in i) || !(value in i))
|
|
|
|
throw new Error(t('store.importError'))
|
|
|
|
throw new Error(t('store.importError'))
|
|
|
|
let safe = true
|
|
|
|
let safe = true
|
|
|
|
for (const j of promptList.value) {
|
|
|
|
for (const j of promptList.value) {
|
|
|
@ -191,6 +191,8 @@ const importPromptTemplate = () => {
|
|
|
|
catch {
|
|
|
|
catch {
|
|
|
|
message.error('JSON 格式错误,请检查 JSON 格式')
|
|
|
|
message.error('JSON 格式错误,请检查 JSON 格式')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (from === 'local')
|
|
|
|
|
|
|
|
showModal.value = !showModal.value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 模板导出
|
|
|
|
// 模板导出
|
|
|
@ -469,7 +471,7 @@ const dataSource = computed(() => {
|
|
|
|
block
|
|
|
|
block
|
|
|
|
type="primary"
|
|
|
|
type="primary"
|
|
|
|
:disabled="inputStatus"
|
|
|
|
:disabled="inputStatus"
|
|
|
|
@click="() => { importPromptTemplate() }"
|
|
|
|
@click="() => { importPromptTemplate('local') }"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{{ t('common.import') }}
|
|
|
|
{{ t('common.import') }}
|
|
|
|
</NButton>
|
|
|
|
</NButton>
|
|
|
|