mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
增加自动拉取可用ai模型的易用性功能
This commit is contained in:
@@ -119,6 +119,10 @@ const progressDialog = ref(false)
|
|||||||
// 高级设置对话框
|
// 高级设置对话框
|
||||||
const advancedDialog = ref(false)
|
const advancedDialog = ref(false)
|
||||||
|
|
||||||
|
// LLM 模型列表
|
||||||
|
const llmModels = ref<string[]>([])
|
||||||
|
const loadingModels = ref(false)
|
||||||
|
|
||||||
const activeTab = ref('system')
|
const activeTab = ref('system')
|
||||||
|
|
||||||
// 元数据语言
|
// 元数据语言
|
||||||
@@ -154,6 +158,32 @@ const logLevelItems = [
|
|||||||
// 安全域名添加变量
|
// 安全域名添加变量
|
||||||
const newSecurityDomain = ref('')
|
const newSecurityDomain = ref('')
|
||||||
|
|
||||||
|
// 加载LLM模型列表
|
||||||
|
async function loadLlmModels() {
|
||||||
|
loadingModels.value = true
|
||||||
|
try {
|
||||||
|
const result: { [key: string]: any } = await api.get('system/llm-models', {
|
||||||
|
params: {
|
||||||
|
provider: SystemSettings.value.Basic.LLM_PROVIDER,
|
||||||
|
api_key: SystemSettings.value.Basic.LLM_API_KEY,
|
||||||
|
base_url: SystemSettings.value.Basic.LLM_BASE_URL,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if (result.success) {
|
||||||
|
llmModels.value = result.data
|
||||||
|
if (llmModels.value.length > 0)
|
||||||
|
SystemSettings.value.Basic.LLM_MODEL = llmModels.value[0]
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$toast.error(result.message)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
loadingModels.value = false
|
||||||
|
}
|
||||||
|
|
||||||
// 添加安全域名
|
// 添加安全域名
|
||||||
function addSecurityDomain() {
|
function addSecurityDomain() {
|
||||||
if (
|
if (
|
||||||
@@ -637,14 +667,26 @@ onDeactivated(() => {
|
|||||||
/>
|
/>
|
||||||
</VCol>
|
</VCol>
|
||||||
<VCol v-if="SystemSettings.Basic.AI_AGENT_ENABLE" cols="12" md="6">
|
<VCol v-if="SystemSettings.Basic.AI_AGENT_ENABLE" cols="12" md="6">
|
||||||
<VTextField
|
<VCombobox
|
||||||
v-model="SystemSettings.Basic.LLM_MODEL"
|
v-model="SystemSettings.Basic.LLM_MODEL"
|
||||||
:label="t('setting.system.llmModel')"
|
:label="t('setting.system.llmModel')"
|
||||||
:hint="t('setting.system.llmModelHint')"
|
:hint="t('setting.system.llmModelHint')"
|
||||||
placeholder="gpt-3.5-turbo"
|
:placeholder="t('setting.system.llmModelHint')"
|
||||||
persistent-hint
|
persistent-hint
|
||||||
|
:items="llmModels"
|
||||||
|
:loading="loadingModels"
|
||||||
prepend-inner-icon="mdi-brain"
|
prepend-inner-icon="mdi-brain"
|
||||||
|
>
|
||||||
|
<template #append-inner>
|
||||||
|
<VBtn
|
||||||
|
variant="text"
|
||||||
|
icon="mdi-refresh"
|
||||||
|
size="small"
|
||||||
|
@click="loadLlmModels"
|
||||||
|
:disabled="!SystemSettings.Basic.LLM_API_KEY"
|
||||||
/>
|
/>
|
||||||
|
</template>
|
||||||
|
</VCombobox>
|
||||||
</VCol>
|
</VCol>
|
||||||
<VCol v-if="SystemSettings.Basic.AI_AGENT_ENABLE" cols="12" md="6">
|
<VCol v-if="SystemSettings.Basic.AI_AGENT_ENABLE" cols="12" md="6">
|
||||||
<VTextField
|
<VTextField
|
||||||
|
|||||||
Reference in New Issue
Block a user