feat: Add AI agent settings and localization support for LLM configuration

This commit is contained in:
jxxghp
2025-10-31 11:46:45 +08:00
parent 4a7425a947
commit 69d314bce3
4 changed files with 100 additions and 0 deletions
+12
View File
@@ -1242,6 +1242,18 @@ export default {
'Used to increase the rate limit threshold when plugins access Github APIit is recommended to configure, otherwise plugins may not work properly', 'Used to increase the rate limit threshold when plugins access Github APIit is recommended to configure, otherwise plugins may not work properly',
ocrHost: 'OCR Server', ocrHost: 'OCR Server',
ocrHostHint: 'Used for site check-in, updating site cookies and other captcha recognition', ocrHostHint: 'Used for site check-in, updating site cookies and other captcha recognition',
aiAgent: 'Enable AI Assistant',
aiAgentEnable: 'Enable AI Assistant',
aiAgentEnableHint: 'Enable AI assistant functionality, requires LLM configuration',
llmProvider: 'LLM Provider',
llmProviderHint: 'Select the LLM service provider to use',
llmModel: 'LLM Model Name',
llmModelHint: 'Specify the LLM model to use, such as gpt-3.5-turbo, deepseek-chat, etc.',
llmApiKey: 'LLM API Key',
llmApiKeyHint: 'API key from the LLM service provider for authentication',
llmApiKeyPlaceholder: 'Please enter API key',
llmBaseUrl: 'LLM Base URL',
llmBaseUrlHint: 'Base URL for LLM API, used for custom API endpoints',
advancedSettings: 'Advanced Settings', advancedSettings: 'Advanced Settings',
advancedSettingsDesc: 'System advanced settings, only need to be adjusted in special cases', advancedSettingsDesc: 'System advanced settings, only need to be adjusted in special cases',
downloaders: 'Downloaders', downloaders: 'Downloaders',
+12
View File
@@ -1238,6 +1238,18 @@ export default {
githubTokenHint: '用于提高插件等访问Github API时的限流阈值,建议配置,否则插件可能无法正常使用', githubTokenHint: '用于提高插件等访问Github API时的限流阈值,建议配置,否则插件可能无法正常使用',
ocrHost: '验证码识别服务器', ocrHost: '验证码识别服务器',
ocrHostHint: '用于站点签到、更新站点Cookie等识别验证码', ocrHostHint: '用于站点签到、更新站点Cookie等识别验证码',
aiAgent: '启用智能助手',
aiAgentEnable: '启用智能助手',
aiAgentEnableHint: '启用后可使用智能助手功能,需要配置LLM相关参数',
llmProvider: 'LLM提供商',
llmProviderHint: '选择使用的LLM服务提供商',
llmModel: 'LLM模型名称',
llmModelHint: '指定使用的LLM模型,如gpt-3.5-turbo、deepseek-chat等',
llmApiKey: 'LLM API密钥',
llmApiKeyHint: 'LLM服务提供商的API密钥,用于身份验证',
llmApiKeyPlaceholder: '请输入API密钥',
llmBaseUrl: 'LLM基础URL',
llmBaseUrlHint: 'LLM API的基础URL地址,用于自定义API端点',
advancedSettings: '高级设置', advancedSettings: '高级设置',
advancedSettingsDesc: '系统进阶设置,特殊情况下才需要调整', advancedSettingsDesc: '系统进阶设置,特殊情况下才需要调整',
downloaders: '下载器', downloaders: '下载器',
+12
View File
@@ -1226,6 +1226,18 @@ export default {
githubTokenHint: '用於提高插件等訪問Github API時的限流閾值,建議配置,否則插件可能無法正常使用', githubTokenHint: '用於提高插件等訪問Github API時的限流閾值,建議配置,否則插件可能無法正常使用',
ocrHost: '驗證碼識別服務器', ocrHost: '驗證碼識別服務器',
ocrHostHint: '用於站點簽到、更新站點Cookie等識別驗證碼', ocrHostHint: '用於站點簽到、更新站點Cookie等識別驗證碼',
aiAgent: '啟用智能助手',
aiAgentEnable: '啟用智能助手',
aiAgentEnableHint: '啟用後可使用智能助手功能,需要配置LLM相關參數',
llmProvider: 'LLM提供商',
llmProviderHint: '選擇使用的LLM服務提供商',
llmModel: 'LLM模型名稱',
llmModelHint: '指定使用的LLM模型,如gpt-3.5-turbo、deepseek-chat等',
llmApiKey: 'LLM API密鑰',
llmApiKeyHint: 'LLM服務提供商的API密鑰,用於身份驗證',
llmApiKeyPlaceholder: '請輸入API密鑰',
llmBaseUrl: 'LLM基礎URL',
llmBaseUrlHint: 'LLM API的基礎URL地址,用於自定義API端點',
advancedSettings: '高級設置', advancedSettings: '高級設置',
advancedSettingsDesc: '系統進階設置,特殊情況下才需要調整', advancedSettingsDesc: '系統進階設置,特殊情況下才需要調整',
downloaders: '下載器', downloaders: '下載器',
@@ -31,6 +31,11 @@ const SystemSettings = ref<any>({
GITHUB_TOKEN: null, GITHUB_TOKEN: null,
OCR_HOST: null, OCR_HOST: null,
CUSTOMIZE_WALLPAPER_API_URL: null, CUSTOMIZE_WALLPAPER_API_URL: null,
AI_AGENT_ENABLE: false,
LLM_PROVIDER: 'deepseek',
LLM_MODEL: 'deepseek-chat',
LLM_API_KEY: null,
LLM_BASE_URL: 'https://api.deepseek.com',
}, },
// 高级系统设置 // 高级系统设置
Advanced: { Advanced: {
@@ -607,6 +612,65 @@ onDeactivated(() => {
/> />
</VCol> </VCol>
</VRow> </VRow>
<VDivider class="my-4" />
<VRow>
<VCol cols="12">
<VListSubheader class="text-lg">{{ t('setting.system.aiAgent') }}</VListSubheader>
</VCol>
<VCol cols="12" md="6">
<VSwitch
v-model="SystemSettings.Basic.AI_AGENT_ENABLE"
:label="t('setting.system.aiAgentEnable')"
:hint="t('setting.system.aiAgentEnableHint')"
persistent-hint
/>
</VCol>
<VCol v-if="SystemSettings.Basic.AI_AGENT_ENABLE" cols="12" md="6">
<VSelect
v-model="SystemSettings.Basic.LLM_PROVIDER"
:label="t('setting.system.llmProvider')"
:hint="t('setting.system.llmProviderHint')"
persistent-hint
:items="[
{ title: 'OpenAI', value: 'openai' },
{ title: 'Google', value: 'google' },
{ title: 'DeepSeek', value: 'deepseek' },
]"
prepend-inner-icon="mdi-robot"
/>
</VCol>
<VCol v-if="SystemSettings.Basic.AI_AGENT_ENABLE" cols="12" md="6">
<VTextField
v-model="SystemSettings.Basic.LLM_MODEL"
:label="t('setting.system.llmModel')"
:hint="t('setting.system.llmModelHint')"
placeholder="gpt-3.5-turbo"
persistent-hint
prepend-inner-icon="mdi-brain"
/>
</VCol>
<VCol v-if="SystemSettings.Basic.AI_AGENT_ENABLE" cols="12" md="6">
<VTextField
v-model="SystemSettings.Basic.LLM_API_KEY"
:label="t('setting.system.llmApiKey')"
:hint="t('setting.system.llmApiKeyHint')"
:placeholder="t('setting.system.llmApiKeyPlaceholder')"
persistent-hint
type="password"
prepend-inner-icon="mdi-key-variant"
/>
</VCol>
<VCol v-if="SystemSettings.Basic.AI_AGENT_ENABLE" cols="12" md="6">
<VTextField
v-model="SystemSettings.Basic.LLM_BASE_URL"
:label="t('setting.system.llmBaseUrl')"
:hint="t('setting.system.llmBaseUrlHint')"
placeholder="https://api.deepseek.com"
persistent-hint
prepend-inner-icon="mdi-link"
/>
</VCol>
</VRow>
</VForm> </VForm>
</VCardText> </VCardText>
<VCardText> <VCardText>