feat:LLM上下文窗口设置

This commit is contained in:
jxxghp
2026-01-23 22:35:03 +08:00
parent 64a4a7aff5
commit b88d4f0ecb
5 changed files with 72 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "moviepilot", "name": "moviepilot",
"version": "2.9.5", "version": "2.9.6",
"private": true, "private": true,
"type": "module", "type": "module",
"bin": "dist/service.js", "bin": "dist/service.js",

View File

@@ -1292,23 +1292,29 @@ export default {
llmProviderHint: 'Select the LLM service provider to use', llmProviderHint: 'Select the LLM service provider to use',
llmModel: 'LLM Model Name', llmModel: 'LLM Model Name',
llmModelHint: 'Specify the LLM model to use, such as gpt-3.5-turbo, deepseek-chat, etc.', llmModelHint: 'Specify the LLM model to use, such as gpt-3.5-turbo, deepseek-chat, etc.',
llmMaxContextTokens: 'LLM Max Context Tokens (K)',
llmMaxContextTokensHint:
'Set the maximum number of context tokens (in thousands) for the LLM. Exceeding this limit will trigger context trimming.',
llmApiKey: 'LLM API Key', llmApiKey: 'LLM API Key',
llmApiKeyHint: 'API key from the LLM service provider for authentication', llmApiKeyHint: 'API key from the LLM service provider for authentication',
llmApiKeyPlaceholder: 'Please enter API key', llmApiKeyPlaceholder: 'Please enter API key',
llmBaseUrl: 'LLM Base URL', llmBaseUrl: 'LLM Base URL',
llmBaseUrlHint: 'Base URL for LLM API, used for custom API endpoints', llmBaseUrlHint: 'Base URL for LLM API, used for custom API endpoints',
aiAgentGlobal: 'Global AI Assistant', aiAgentGlobal: 'Global AI Assistant',
aiAgentGlobalHint: 'Enable global AI assistant functionality, all message conversations will be answered by the AI agent without using the /ai command', aiAgentGlobalHint:
'Enable global AI assistant functionality, all message conversations will be answered by the AI agent without using the /ai command',
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',
downloadersDesc: 'Only the default downloader will be used by default.', downloadersDesc: 'Only the default downloader will be used by default.',
aiRecommendEnabled: 'AI Search Recommendation', aiRecommendEnabled: 'AI Search Recommendation',
aiRecommendEnabledHint: 'Enable AI search recommendation. When enabled, an AI recommendation button will be displayed on the search result page, recommending resources based on user preferences.', aiRecommendEnabledHint:
'Enable AI search recommendation. When enabled, an AI recommendation button will be displayed on the search result page, recommending resources based on user preferences.',
aiRecommendUserPreference: 'User Preference', aiRecommendUserPreference: 'User Preference',
aiRecommendUserPreferenceHint: 'Set user preferences for AI recommendation, e.g., 4K WEB-DL Dolby Vision', aiRecommendUserPreferenceHint: 'Set user preferences for AI recommendation, e.g., 4K WEB-DL Dolby Vision',
aiRecommendMaxItems: 'AI Recommendation Analysis Limit', aiRecommendMaxItems: 'AI Recommendation Analysis Limit',
aiRecommendMaxItemsHint: 'Limit the number of search results sent to the AI assistant for analysis. More items mean slower analysis and more token consumption. It is recommended to manually filter to a general range before using AI recommendation.', aiRecommendMaxItemsHint:
'Limit the number of search results sent to the AI assistant for analysis. More items mean slower analysis and more token consumption. It is recommended to manually filter to a general range before using AI recommendation.',
mediaServers: 'Media Servers', mediaServers: 'Media Servers',
mediaServersDesc: 'All enabled media servers will be used.', mediaServersDesc: 'All enabled media servers will be used.',
trimeMedia: 'TrimeMedia', trimeMedia: 'TrimeMedia',
@@ -2617,7 +2623,8 @@ export default {
passkeyManagement: 'Passkey Management', passkeyManagement: 'Passkey Management',
registerNewPasskey: 'Register New Passkey', registerNewPasskey: 'Register New Passkey',
passkeyDescription: 'Passkeys allow you to sign in quickly and securely without a password.', passkeyDescription: 'Passkeys allow you to sign in quickly and securely without a password.',
passkeyAppDescription: 'Passkeys are a simpler, more secure way to sign in, serving as an alternative to passwords. You can authenticate using passkey-supported apps like iCloud Keychain, Bitwarden, or hardware keys.', passkeyAppDescription:
'Passkeys are a simpler, more secure way to sign in, serving as an alternative to passwords. You can authenticate using passkey-supported apps like iCloud Keychain, Bitwarden, or hardware keys.',
passkeyName: 'Passkey Name', passkeyName: 'Passkey Name',
passkeyNamePlaceholder: 'e.g.: iPhone, Windows Hello', passkeyNamePlaceholder: 'e.g.: iPhone, Windows Hello',
registerPasskey: 'Register Passkey', registerPasskey: 'Register Passkey',
@@ -2631,8 +2638,10 @@ export default {
passkeyDeleteSuccess: 'Passkey deleted', passkeyDeleteSuccess: 'Passkey deleted',
passkeyDeleteFailed: 'Delete failed', passkeyDeleteFailed: 'Delete failed',
deletePasskey: 'Delete Passkey', deletePasskey: 'Delete Passkey',
passkeyDomainWarning: 'The availability of PassKeys is closely related to the {domain}. In a public network environment, please make sure to configure the correct access domain name in "Basic Settings". Domain changes or configuration errors will cause the PassKey to be unusable.', passkeyDomainWarning:
otpRequiredForPasskey: 'For security reasons, you must first enable {otp} before you can register a PassKey. This is to ensure that you can still log in to your account via OTP code if the PassKey becomes invalid due to domain configuration changes.', 'The availability of PassKeys is closely related to the {domain}. In a public network environment, please make sure to configure the correct access domain name in "Basic Settings". Domain changes or configuration errors will cause the PassKey to be unusable.',
otpRequiredForPasskey:
'For security reasons, you must first enable {otp} before you can register a PassKey. This is to ensure that you can still log in to your account via OTP code if the PassKey becomes invalid due to domain configuration changes.',
accessDomain: 'access domain name', accessDomain: 'access domain name',
otpAuthenticator: 'OTP Authenticator', otpAuthenticator: 'OTP Authenticator',
otpGenerateFailed: 'Failed to get OTP URI: {message}!', otpGenerateFailed: 'Failed to get OTP URI: {message}!',
@@ -2641,8 +2650,10 @@ export default {
otpCodeRequired: 'Please enter the 6-digit verification code', otpCodeRequired: 'Please enter the 6-digit verification code',
otpEnableSuccess: 'Two-factor authentication enabled successfully!', otpEnableSuccess: 'Two-factor authentication enabled successfully!',
otpEnableFailed: 'Failed to enable OTP: {message}!', otpEnableFailed: 'Failed to enable OTP: {message}!',
otpDisableRestrictedByPasskey: 'You have registered Passkeys. Please delete all Passkeys before disabling OTP verification.', otpDisableRestrictedByPasskey:
confirmToDisableOtp: 'For security reasons, verifying your login password is required to disable two-factor authentication.', 'You have registered Passkeys. Please delete all Passkeys before disabling OTP verification.',
confirmToDisableOtp:
'For security reasons, verifying your login password is required to disable two-factor authentication.',
confirmToDeletePasskey: 'For security reasons, verifying your login password is required to delete a Passkey.', confirmToDeletePasskey: 'For security reasons, verifying your login password is required to delete a Passkey.',
authenticatorAppDescription: authenticatorAppDescription:
'Use an authenticator app like Google Authenticator, Microsoft Authenticator, Authy, or 1Password to scan the QR code and generate a 6-digit code.', 'Use an authenticator app like Google Authenticator, Microsoft Authenticator, Authy, or 1Password to scan the QR code and generate a 6-digit code.',

View File

@@ -1288,6 +1288,9 @@ export default {
llmProviderHint: '选择使用的LLM服务提供商', llmProviderHint: '选择使用的LLM服务提供商',
llmModel: 'LLM模型名称', llmModel: 'LLM模型名称',
llmModelHint: '指定使用的LLM模型如gpt-3.5-turbo、deepseek-chat等', llmModelHint: '指定使用的LLM模型如gpt-3.5-turbo、deepseek-chat等',
llmMaxContextTokens: 'LLM 最大上下文 Token 数量 (K)',
llmMaxContextTokensHint:
'设定 LLM 记录会话历史的最大 Token 数量上限(千),超出后将自动修整历史记录以节省 Token 消耗及防止超出 LLM 限制',
llmApiKey: 'LLM API密钥', llmApiKey: 'LLM API密钥',
llmApiKeyHint: 'LLM服务提供商的API密钥用于身份验证', llmApiKeyHint: 'LLM服务提供商的API密钥用于身份验证',
llmApiKeyPlaceholder: '请输入API密钥', llmApiKeyPlaceholder: '请输入API密钥',
@@ -1300,11 +1303,13 @@ export default {
downloaders: '下载器', downloaders: '下载器',
downloadersDesc: '只有默认下载器才会被默认使用。', downloadersDesc: '只有默认下载器才会被默认使用。',
aiRecommendEnabled: '搜索结果智能推荐', aiRecommendEnabled: '搜索结果智能推荐',
aiRecommendEnabledHint: '启用搜索结果智能推荐功能,开启后将在搜索结果页面显示智能推荐按钮,可根据用户偏好智能推荐资源', aiRecommendEnabledHint:
'启用搜索结果智能推荐功能,开启后将在搜索结果页面显示智能推荐按钮,可根据用户偏好智能推荐资源',
aiRecommendUserPreference: '用户偏好', aiRecommendUserPreference: '用户偏好',
aiRecommendUserPreferenceHint: '设置智能推荐时的用户偏好例如4K WEB-DL Dolby Vision', aiRecommendUserPreferenceHint: '设置智能推荐时的用户偏好例如4K WEB-DL Dolby Vision',
aiRecommendMaxItems: '智能推荐分析条目上限', aiRecommendMaxItems: '智能推荐分析条目上限',
aiRecommendMaxItemsHint: '限制发送给智能助手进行分析的搜索结果数量,数量越多分析越慢且消耗 Token 越多,建议先手动筛选,筛选出大致范围后再进行智能推荐', aiRecommendMaxItemsHint:
'限制发送给智能助手进行分析的搜索结果数量,数量越多分析越慢且消耗 Token 越多,建议先手动筛选,筛选出大致范围后再进行智能推荐',
mediaServers: '媒体服务器', mediaServers: '媒体服务器',
mediaServersDesc: '所有启用的媒体服务器都会被使用。', mediaServersDesc: '所有启用的媒体服务器都会被使用。',
trimeMedia: '飞牛影视', trimeMedia: '飞牛影视',
@@ -2585,7 +2590,8 @@ export default {
passkeyManagement: '通行密钥管理', passkeyManagement: '通行密钥管理',
registerNewPasskey: '注册新通行密钥', registerNewPasskey: '注册新通行密钥',
passkeyDescription: '通行密钥可以让您无需密码即可快速安全地登录。', passkeyDescription: '通行密钥可以让您无需密码即可快速安全地登录。',
passkeyAppDescription: '通行密钥是一种更简单、更安全的登录方式,可以替代密码进行登录。您可以使用 iCloud 钥匙串、Bitwarden 等支持通行密钥的应用程序或硬件密钥完成验证。', passkeyAppDescription:
'通行密钥是一种更简单、更安全的登录方式,可以替代密码进行登录。您可以使用 iCloud 钥匙串、Bitwarden 等支持通行密钥的应用程序或硬件密钥完成验证。',
passkeyName: '通行密钥名称', passkeyName: '通行密钥名称',
passkeyNamePlaceholder: '例如iPhone、Windows Hello', passkeyNamePlaceholder: '例如iPhone、Windows Hello',
registerPasskey: '注册通行密钥', registerPasskey: '注册通行密钥',
@@ -2599,8 +2605,10 @@ export default {
passkeyDeleteSuccess: '通行密钥已删除', passkeyDeleteSuccess: '通行密钥已删除',
passkeyDeleteFailed: '删除失败', passkeyDeleteFailed: '删除失败',
deletePasskey: '删除通行密钥', deletePasskey: '删除通行密钥',
passkeyDomainWarning: '通行密钥PassKey的可用性与 {domain} 紧密相关。在公网环境下,请务必在“基础设置”中配置正确的访问域名。域名变更或配置错误将导致通行密钥无法使用。', passkeyDomainWarning:
otpRequiredForPasskey: '为了安全起见,您必须先启用 {otp} 验证码,然后才能注册通行密钥。这是为了防止在域名配置变动导致 PassKey 失效时,您仍能通过 OTP 码登录账户。', '通行密钥(PassKey)的可用性与 {domain} 紧密相关。在公网环境下,请务必在“基础设置”中配置正确的访问域名。域名变更或配置错误将导致通行密钥无法使用。',
otpRequiredForPasskey:
'为了安全起见,您必须先启用 {otp} 验证码,然后才能注册通行密钥。这是为了防止在域名配置变动导致 PassKey 失效时,您仍能通过 OTP 码登录账户。',
accessDomain: '访问域名', accessDomain: '访问域名',
otpAuthenticator: 'OTP 身份验证器', otpAuthenticator: 'OTP 身份验证器',
otpGenerateFailed: '获取otp uri失败{message}', otpGenerateFailed: '获取otp uri失败{message}',

View File

@@ -1289,6 +1289,9 @@ export default {
llmProviderHint: '選擇使用的LLM服務提供商', llmProviderHint: '選擇使用的LLM服務提供商',
llmModel: 'LLM模型名稱', llmModel: 'LLM模型名稱',
llmModelHint: '指定使用的LLM模型如gpt-3.5-turbo、deepseek-chat等', llmModelHint: '指定使用的LLM模型如gpt-3.5-turbo、deepseek-chat等',
llmMaxContextTokens: 'LLM 最大上下文 Token 數量 (K)',
llmMaxContextTokensHint:
'設定 LLM 記錄會話歷史的最大 Token 數量上限(千),超出後將自動修整歷史記錄以節省 Token 消耗及防止超出 LLM 限制',
llmApiKey: 'LLM API密鑰', llmApiKey: 'LLM API密鑰',
llmApiKeyHint: 'LLM服務提供商的API密鑰用於身份驗證', llmApiKeyHint: 'LLM服務提供商的API密鑰用於身份驗證',
llmApiKeyPlaceholder: '請輸入API密鑰', llmApiKeyPlaceholder: '請輸入API密鑰',
@@ -1301,11 +1304,13 @@ export default {
downloaders: '下載器', downloaders: '下載器',
downloadersDesc: '只有默認下載器才會被默認使用。', downloadersDesc: '只有默認下載器才會被默認使用。',
aiRecommendEnabled: '搜索結果智能推薦', aiRecommendEnabled: '搜索結果智能推薦',
aiRecommendEnabledHint: '啟用搜索結果智能推薦功能,開啟後將在搜索結果頁面顯示智能推薦按鈕,可根據用戶偏好智能推薦資源', aiRecommendEnabledHint:
'啟用搜索結果智能推薦功能,開啟後將在搜索結果頁面顯示智能推薦按鈕,可根據用戶偏好智能推薦資源',
aiRecommendUserPreference: '用戶偏好', aiRecommendUserPreference: '用戶偏好',
aiRecommendUserPreferenceHint: '設置智能推薦時的用戶偏好例如4K WEB-DL Dolby Vision', aiRecommendUserPreferenceHint: '設置智能推薦時的用戶偏好例如4K WEB-DL Dolby Vision',
aiRecommendMaxItems: '智能推薦分析條目上限', aiRecommendMaxItems: '智能推薦分析條目上限',
aiRecommendMaxItemsHint: '限制發送給智能助手進行分析的搜索結果數量,數量越多分析越慢且消耗 Token 越多,建議先手動篩選,篩選出大致範圍後再進行智能推薦', aiRecommendMaxItemsHint:
'限制發送給智能助手進行分析的搜索結果數量,數量越多分析越慢且消耗 Token 越多,建議先手動篩選,篩選出大致範圍後再進行智能推薦',
mediaServers: '媒體服務器', mediaServers: '媒體服務器',
mediaServersDesc: '所有啟用的媒體服務器都會被使用。', mediaServersDesc: '所有啟用的媒體服務器都會被使用。',
trimeMedia: '飛牛影視', trimeMedia: '飛牛影視',
@@ -2586,7 +2591,8 @@ export default {
passkeyManagement: '通行密鑰管理', passkeyManagement: '通行密鑰管理',
registerNewPasskey: '註冊新通行密鑰', registerNewPasskey: '註冊新通行密鑰',
passkeyDescription: '通行密鑰可以讓您無需密碼即可快速安全地登入。', passkeyDescription: '通行密鑰可以讓您無需密碼即可快速安全地登入。',
passkeyAppDescription: '通行密鑰是一種更簡單、更安全的登入方式,可以替代密碼進行登入。您可以使用 iCloud 鑰匙圈、Bitwarden 等支援通行密鑰的應用程式或硬體金鑰完成驗證。', passkeyAppDescription:
'通行密鑰是一種更簡單、更安全的登入方式,可以替代密碼進行登入。您可以使用 iCloud 鑰匙圈、Bitwarden 等支援通行密鑰的應用程式或硬體金鑰完成驗證。',
passkeyName: '通行密鑰名稱', passkeyName: '通行密鑰名稱',
passkeyNamePlaceholder: '例如iPhone、Windows Hello', passkeyNamePlaceholder: '例如iPhone、Windows Hello',
registerPasskey: '註冊通行密鑰', registerPasskey: '註冊通行密鑰',

View File

@@ -40,6 +40,7 @@ const SystemSettings = ref<any>({
AI_RECOMMEND_ENABLED: false, AI_RECOMMEND_ENABLED: false,
AI_RECOMMEND_USER_PREFERENCE: null, AI_RECOMMEND_USER_PREFERENCE: null,
AI_RECOMMEND_MAX_ITEMS: 50, AI_RECOMMEND_MAX_ITEMS: 50,
LLM_MAX_CONTEXT_TOKENS: 64,
}, },
// 高级系统设置 // 高级系统设置
Advanced: { Advanced: {
@@ -647,7 +648,7 @@ onDeactivated(() => {
</VRow> </VRow>
<VDivider class="my-4" /> <VDivider class="my-4" />
<VRow> <VRow>
<VCol cols="12"> <VCol cols="12" md="6">
<VSwitch <VSwitch
v-model="SystemSettings.Basic.AI_AGENT_ENABLE" v-model="SystemSettings.Basic.AI_AGENT_ENABLE"
:label="t('setting.system.aiAgentEnable')" :label="t('setting.system.aiAgentEnable')"
@@ -655,6 +656,14 @@ onDeactivated(() => {
persistent-hint persistent-hint
/> />
</VCol> </VCol>
<VCol v-if="SystemSettings.Basic.AI_AGENT_ENABLE" cols="12" md="6">
<VSwitch
v-model="SystemSettings.Basic.AI_AGENT_GLOBAL"
:label="t('setting.system.aiAgentGlobal')"
:hint="t('setting.system.aiAgentGlobalHint')"
persistent-hint
/>
</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">
<VSelect <VSelect
v-model="SystemSettings.Basic.LLM_PROVIDER" v-model="SystemSettings.Basic.LLM_PROVIDER"
@@ -713,14 +722,16 @@ onDeactivated(() => {
</VCombobox> </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">
<VSwitch <VTextField
v-model="SystemSettings.Basic.AI_AGENT_GLOBAL" v-model.number="SystemSettings.Basic.LLM_MAX_CONTEXT_TOKENS"
:label="t('setting.system.aiAgentGlobal')" :label="t('setting.system.llmMaxContextTokens')"
:hint="t('setting.system.aiAgentGlobalHint')" :hint="t('setting.system.llmMaxContextTokensHint')"
persistent-hint persistent-hint
type="number"
prepend-inner-icon="mdi-counter"
/> />
</VCol> </VCol>
<VCol v-if="SystemSettings.Basic.AI_AGENT_ENABLE" cols="12" md="6"> <VCol v-if="SystemSettings.Basic.AI_AGENT_ENABLE" cols="12">
<VSwitch <VSwitch
v-model="SystemSettings.Basic.AI_RECOMMEND_ENABLED" v-model="SystemSettings.Basic.AI_RECOMMEND_ENABLED"
:label="t('setting.system.aiRecommendEnabled')" :label="t('setting.system.aiRecommendEnabled')"
@@ -728,7 +739,11 @@ onDeactivated(() => {
persistent-hint persistent-hint
/> />
</VCol> </VCol>
<VCol v-if="SystemSettings.Basic.AI_AGENT_ENABLE && SystemSettings.Basic.AI_RECOMMEND_ENABLED" cols="12"> <VCol
v-if="SystemSettings.Basic.AI_AGENT_ENABLE && SystemSettings.Basic.AI_RECOMMEND_ENABLED"
cols="12"
md="6"
>
<VTextarea <VTextarea
v-model="SystemSettings.Basic.AI_RECOMMEND_USER_PREFERENCE" v-model="SystemSettings.Basic.AI_RECOMMEND_USER_PREFERENCE"
:label="t('setting.system.aiRecommendUserPreference')" :label="t('setting.system.aiRecommendUserPreference')"
@@ -1414,7 +1429,10 @@ onDeactivated(() => {
min="1" min="1"
type="number" type="number"
:suffix="t('setting.system.mb')" :suffix="t('setting.system.mb')"
:rules="[(v: any) => v === 0 || !!v || t('setting.system.logMaxFileSizeRequired'), (v: any) => v >= 1 || t('setting.system.logMaxFileSizeMin')]" :rules="[
(v: any) => v === 0 || !!v || t('setting.system.logMaxFileSizeRequired'),
(v: any) => v >= 1 || t('setting.system.logMaxFileSizeMin'),
]"
prepend-inner-icon="mdi-file-document" prepend-inner-icon="mdi-file-document"
/> />
</VCol> </VCol>
@@ -1426,7 +1444,10 @@ onDeactivated(() => {
persistent-hint persistent-hint
min="1" min="1"
type="number" type="number"
:rules="[(v: any) => v === 0 || !!v || t('setting.system.logBackupCountRequired'), (v: any) => v >= 1 || t('setting.system.logBackupCountMin')]" :rules="[
(v: any) => v === 0 || !!v || t('setting.system.logBackupCountRequired'),
(v: any) => v >= 1 || t('setting.system.logBackupCountMin'),
]"
prepend-inner-icon="mdi-backup-restore" prepend-inner-icon="mdi-backup-restore"
/> />
</VCol> </VCol>