mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-04 23:18:44 +08:00
fix: refine ai assistant settings feedback
This commit is contained in:
@@ -1355,8 +1355,6 @@ export default {
|
|||||||
llmTestReplyPreviewValue: 'Reply Preview: {value}',
|
llmTestReplyPreviewValue: 'Reply Preview: {value}',
|
||||||
llmTestErrorMessage: 'Error Message',
|
llmTestErrorMessage: 'Error Message',
|
||||||
llmTestErrorMessageValue: 'Error Message: {value}',
|
llmTestErrorMessageValue: 'Error Message: {value}',
|
||||||
llmTestSuccessDialogTitle: 'AI Assistant Test Succeeded',
|
|
||||||
llmTestSuccessDialogDesc: 'The saved LLM configuration is reachable and returned a valid response.',
|
|
||||||
llmTestSuccessToast: 'LLM test call succeeded',
|
llmTestSuccessToast: 'LLM test call succeeded',
|
||||||
llmTestFailedToast: 'LLM test call failed',
|
llmTestFailedToast: 'LLM test call failed',
|
||||||
aiAgentGlobal: 'Global AI Assistant',
|
aiAgentGlobal: 'Global AI Assistant',
|
||||||
|
|||||||
@@ -1353,8 +1353,6 @@ export default {
|
|||||||
llmTestReplyPreviewValue: '结果摘要:{value}',
|
llmTestReplyPreviewValue: '结果摘要:{value}',
|
||||||
llmTestErrorMessage: '错误信息',
|
llmTestErrorMessage: '错误信息',
|
||||||
llmTestErrorMessageValue: '错误信息:{value}',
|
llmTestErrorMessageValue: '错误信息:{value}',
|
||||||
llmTestSuccessDialogTitle: '智能助手测试成功',
|
|
||||||
llmTestSuccessDialogDesc: '当前已保存的 LLM 配置可以正常连通并返回结果。',
|
|
||||||
llmTestSuccessToast: 'LLM 调用测试成功',
|
llmTestSuccessToast: 'LLM 调用测试成功',
|
||||||
llmTestFailedToast: 'LLM 调用测试失败',
|
llmTestFailedToast: 'LLM 调用测试失败',
|
||||||
aiAgentGlobal: '全局智能助手',
|
aiAgentGlobal: '全局智能助手',
|
||||||
|
|||||||
@@ -1355,8 +1355,6 @@ export default {
|
|||||||
llmTestReplyPreviewValue: '結果摘要:{value}',
|
llmTestReplyPreviewValue: '結果摘要:{value}',
|
||||||
llmTestErrorMessage: '錯誤信息',
|
llmTestErrorMessage: '錯誤信息',
|
||||||
llmTestErrorMessageValue: '錯誤信息:{value}',
|
llmTestErrorMessageValue: '錯誤信息:{value}',
|
||||||
llmTestSuccessDialogTitle: '智能助手測試成功',
|
|
||||||
llmTestSuccessDialogDesc: '當前已保存的 LLM 配置可以正常連通並返回結果。',
|
|
||||||
llmTestSuccessToast: 'LLM 調用測試成功',
|
llmTestSuccessToast: 'LLM 調用測試成功',
|
||||||
llmTestFailedToast: 'LLM 調用測試失敗',
|
llmTestFailedToast: 'LLM 調用測試失敗',
|
||||||
aiAgentGlobal: '全局智能助手',
|
aiAgentGlobal: '全局智能助手',
|
||||||
|
|||||||
@@ -161,7 +161,6 @@ const llmModels = ref<string[]>([])
|
|||||||
const loadingModels = ref(false)
|
const loadingModels = ref(false)
|
||||||
const savingBasic = ref(false)
|
const savingBasic = ref(false)
|
||||||
const testingLlm = ref(false)
|
const testingLlm = ref(false)
|
||||||
const llmTestSuccessDialog = ref(false)
|
|
||||||
|
|
||||||
type LlmSettingsSnapshot = {
|
type LlmSettingsSnapshot = {
|
||||||
AI_AGENT_ENABLE: boolean
|
AI_AGENT_ENABLE: boolean
|
||||||
@@ -205,7 +204,6 @@ function invalidateLlmTestState() {
|
|||||||
llmTestAbortController = null
|
llmTestAbortController = null
|
||||||
}
|
}
|
||||||
testingLlm.value = false
|
testingLlm.value = false
|
||||||
llmTestSuccessDialog.value = false
|
|
||||||
llmTestResult.value = null
|
llmTestResult.value = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,7 +439,6 @@ async function testLlmConnection() {
|
|||||||
llmTestAbortController = abortController
|
llmTestAbortController = abortController
|
||||||
|
|
||||||
testingLlm.value = true
|
testingLlm.value = true
|
||||||
llmTestSuccessDialog.value = false
|
|
||||||
llmTestResult.value = null
|
llmTestResult.value = null
|
||||||
try {
|
try {
|
||||||
const result: { [key: string]: any } = await api.post('system/llm-test', null, {
|
const result: { [key: string]: any } = await api.post('system/llm-test', null, {
|
||||||
@@ -460,8 +457,7 @@ async function testLlmConnection() {
|
|||||||
reply_preview: data.reply_preview,
|
reply_preview: data.reply_preview,
|
||||||
message: result?.message,
|
message: result?.message,
|
||||||
}
|
}
|
||||||
if (result?.success) llmTestSuccessDialog.value = true
|
if (!result?.success) $toast.error(t('setting.system.llmTestFailedToast'))
|
||||||
else $toast.error(t('setting.system.llmTestFailedToast'))
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (requestId !== llmTestRequestId || abortController.signal.aborted || currentLlmSnapshotKey.value !== snapshotKey) {
|
if (requestId !== llmTestRequestId || abortController.signal.aborted || currentLlmSnapshotKey.value !== snapshotKey) {
|
||||||
return
|
return
|
||||||
@@ -1060,14 +1056,14 @@ watch(
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<VAlert
|
<VAlert
|
||||||
v-if="llmTestResult && !llmTestResult.success"
|
v-if="llmTestResult"
|
||||||
type="error"
|
:type="llmTestResult.success ? 'success' : 'error'"
|
||||||
variant="tonal"
|
variant="tonal"
|
||||||
density="comfortable"
|
density="comfortable"
|
||||||
class="mt-4"
|
class="mt-4"
|
||||||
>
|
>
|
||||||
<div class="text-subtitle-2 mb-2">
|
<div class="text-subtitle-2 mb-2">
|
||||||
{{ t('setting.system.llmTestFailed') }}
|
{{ llmTestResult.success ? t('setting.system.llmTestSuccess') : t('setting.system.llmTestFailed') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-body-2">
|
<div class="text-body-2">
|
||||||
{{ t('setting.system.llmTestProviderValue', { value: llmTestResult.provider }) }}
|
{{ t('setting.system.llmTestProviderValue', { value: llmTestResult.provider }) }}
|
||||||
@@ -1078,7 +1074,10 @@ watch(
|
|||||||
<div v-if="llmTestResult.duration_ms !== undefined" class="text-body-2">
|
<div v-if="llmTestResult.duration_ms !== undefined" class="text-body-2">
|
||||||
{{ t('setting.system.llmTestDurationValue', { duration: llmTestResult.duration_ms }) }}
|
{{ t('setting.system.llmTestDurationValue', { duration: llmTestResult.duration_ms }) }}
|
||||||
</div>
|
</div>
|
||||||
<div v-if="llmTestResult.message" class="text-body-2">
|
<div v-if="llmTestResult.success && llmTestResult.reply_preview" class="text-body-2">
|
||||||
|
{{ t('setting.system.llmTestReplyPreviewValue', { value: llmTestResult.reply_preview }) }}
|
||||||
|
</div>
|
||||||
|
<div v-else-if="llmTestResult.message" class="text-body-2">
|
||||||
{{ t('setting.system.llmTestErrorMessageValue', { value: llmTestResult.message }) }}
|
{{ t('setting.system.llmTestErrorMessageValue', { value: llmTestResult.message }) }}
|
||||||
</div>
|
</div>
|
||||||
</VAlert>
|
</VAlert>
|
||||||
@@ -1092,7 +1091,6 @@ watch(
|
|||||||
prepend-icon="mdi-content-save"
|
prepend-icon="mdi-content-save"
|
||||||
:loading="savingBasic"
|
:loading="savingBasic"
|
||||||
:disabled="testingLlm"
|
:disabled="testingLlm"
|
||||||
:block="!display.smAndUp.value"
|
|
||||||
class="text-no-wrap"
|
class="text-no-wrap"
|
||||||
>
|
>
|
||||||
{{ t('common.save') }}
|
{{ t('common.save') }}
|
||||||
@@ -1102,7 +1100,6 @@ watch(
|
|||||||
@click="advancedDialog = true"
|
@click="advancedDialog = true"
|
||||||
prepend-icon="mdi-cog"
|
prepend-icon="mdi-cog"
|
||||||
append-icon="mdi-dots-horizontal"
|
append-icon="mdi-dots-horizontal"
|
||||||
:block="!display.smAndUp.value"
|
|
||||||
class="text-no-wrap setting-actions__secondary"
|
class="text-no-wrap setting-actions__secondary"
|
||||||
>
|
>
|
||||||
{{ t('setting.system.advancedSettings') }}
|
{{ t('setting.system.advancedSettings') }}
|
||||||
@@ -1215,53 +1212,6 @@ watch(
|
|||||||
</VCol>
|
</VCol>
|
||||||
</VRow>
|
</VRow>
|
||||||
|
|
||||||
<VDialog
|
|
||||||
v-if="llmTestSuccessDialog && llmTestResult?.success"
|
|
||||||
v-model="llmTestSuccessDialog"
|
|
||||||
max-width="34rem"
|
|
||||||
:fullscreen="display.xs.value"
|
|
||||||
>
|
|
||||||
<VCard>
|
|
||||||
<VCardItem class="py-3">
|
|
||||||
<template #prepend>
|
|
||||||
<VIcon icon="mdi-check-circle" color="success" class="me-2" />
|
|
||||||
</template>
|
|
||||||
<VCardTitle>{{ t('setting.system.llmTestSuccessDialogTitle') }}</VCardTitle>
|
|
||||||
<VCardSubtitle>{{ t('setting.system.llmTestSuccessDialogDesc') }}</VCardSubtitle>
|
|
||||||
</VCardItem>
|
|
||||||
<VDialogCloseBtn @click="llmTestSuccessDialog = false" />
|
|
||||||
<VCardText>
|
|
||||||
<VAlert
|
|
||||||
type="success"
|
|
||||||
variant="tonal"
|
|
||||||
density="comfortable"
|
|
||||||
>
|
|
||||||
{{ t('setting.system.llmTestSuccessToast') }}
|
|
||||||
</VAlert>
|
|
||||||
<div class="d-flex flex-column gap-2 mt-4">
|
|
||||||
<div class="text-body-1">
|
|
||||||
{{ t('setting.system.llmTestProviderValue', { value: llmTestResult.provider }) }}
|
|
||||||
</div>
|
|
||||||
<div class="text-body-1">
|
|
||||||
{{ t('setting.system.llmTestModelValue', { value: llmTestResult.model }) }}
|
|
||||||
</div>
|
|
||||||
<div v-if="llmTestResult.duration_ms !== undefined" class="text-body-1">
|
|
||||||
{{ t('setting.system.llmTestDurationValue', { duration: llmTestResult.duration_ms }) }}
|
|
||||||
</div>
|
|
||||||
<div v-if="llmTestResult.reply_preview" class="text-body-2 text-medium-emphasis">
|
|
||||||
{{ t('setting.system.llmTestReplyPreviewValue', { value: llmTestResult.reply_preview }) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</VCardText>
|
|
||||||
<VCardActions class="px-6 pb-6">
|
|
||||||
<VSpacer />
|
|
||||||
<VBtn color="primary" @click="llmTestSuccessDialog = false">
|
|
||||||
{{ t('common.close') }}
|
|
||||||
</VBtn>
|
|
||||||
</VCardActions>
|
|
||||||
</VCard>
|
|
||||||
</VDialog>
|
|
||||||
|
|
||||||
<!-- 高级系统设置 -->
|
<!-- 高级系统设置 -->
|
||||||
<VDialog
|
<VDialog
|
||||||
v-if="advancedDialog"
|
v-if="advancedDialog"
|
||||||
|
|||||||
Reference in New Issue
Block a user