Skip to content

Commit 4fd6502

Browse files
SilenceZenchenzhen-patsnapclaude
authored
feat: 为自定义Headers功能添加国际化支持 (#487)
* feat: 增加AI配置自定义请求头功能 - 在AiConfig接口中添加customHeaders字段 - 在createOpenAIClient中合并自定义headers到默认请求头 - 在AI配置页面为自定义配置添加Headers编辑功能 - 修复自定义headers保存逻辑,改为失焦时保存 - 优化代码结构,直接在defaultHeaders中合并自定义headers 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * feat: 增加AI配置自定义请求头功能 - 在AiConfig接口中添加customHeaders字段 - 在createOpenAIClient中合并自定义headers到默认请求头 - 在AI配置页面为自定义配置添加Headers编辑功能 - 修复自定义headers保存逻辑,改为失焦时保存 - 优化代码结构,直接在defaultHeaders中合并自定义headers 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * feat: 为自定义Headers功能添加国际化支持 - 添加中文、英文、日文翻译 - 更新AI配置页面使用国际化文本 --------- Co-authored-by: Zen <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent 7bf24ad commit 4fd6502

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

messages/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,9 @@
341341
"modelBaseUrlDesc": "You only need to configure the version number, for example: https://api.openai.com/v1, the suffix will be automatically added.",
342342
"modelDesc": "Some models support getting model list, if not supported please manually configure.",
343343
"temperatureDesc": "Controls randomness of output. Lower values make generated content more deterministic.",
344-
"topPDesc": "A nucleus sampling method, where the model considers the results of tokens with top_p probability mass. So 0.1 means only consider the top 10% probability mass. Usually we suggest to change this or temperature but not both."
344+
"topPDesc": "A nucleus sampling method, where the model considers the results of tokens with top_p probability mass. So 0.1 means only consider the top 10% probability mass. Usually we suggest to change this or temperature but not both.",
345+
"customHeaders": "Custom Headers",
346+
"customHeadersDesc": "Add custom HTTP headers as JSON object. "
345347
},
346348
"ocr": {
347349
"title": "OCR",

messages/ja.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,9 @@
339339
"modelBaseUrlDesc": "バージョン番号まで設定すればOKです(例:https://api.openai.com/v1)。サフィックスは自動で追加されます。",
340340
"modelDesc": "一部モデルはリスト取得に対応しています。未対応の場合は手動で設定してください。",
341341
"temperatureDesc": "サンプリング温度は0から2の間で設定します。高い値(例:0.8)は出力をよりランダムに、低い値(例:0.2)はより決定的にします。通常、この値かtop_pのみを調整してください。",
342-
"topPDesc": "top_p(核サンプリング)は温度の代替手法です。top_p=0.1なら上位10%確率のトークンのみ考慮します。通常、この値かtemperatureのみを調整してください。"
342+
"topPDesc": "top_p(核サンプリング)は温度の代替手法です。top_p=0.1なら上位10%確率のトークンのみ考慮します。通常、この値かtemperatureのみを調整してください。",
343+
"customHeaders": "カスタムヘッダー",
344+
"customHeadersDesc": "JSONオブジェクト形式でカスタムHTTPヘッダーを追加します。"
343345
},
344346
"ocr": {
345347
"title": "OCR",

messages/zh.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,9 @@
323323
"modelBaseUrlDesc": "你只需要配置到版本号即可,例如:https://api.openai.com/v1,后缀会自动添加。",
324324
"modelDesc": "部分模型支持获取模型列表,如果不支持请手动配置。",
325325
"temperatureDesc": "使用什么采样温度,介于 0 和 2 之间。较高的值(如 0.8)将使输出更加随机,而较低的值(如 0.2)将使输出更加集中和确定。 我们通常建议改变这个或top_p但不是两者。",
326-
"topPDesc": "一种替代温度采样的方法,称为核采样,其中模型考虑具有 top_p 概率质量的标记的结果。所以 0.1 意味着只考虑构成前 10% 概率质量的标记。 我们通常建议改变这个或temperature但不是两者。"
326+
"topPDesc": "一种替代温度采样的方法,称为核采样,其中模型考虑具有 top_p 概率质量的标记的结果。所以 0.1 意味着只考虑构成前 10% 概率质量的标记。 我们通常建议改变这个或temperature但不是两者。",
327+
"customHeaders": "自定义请求头",
328+
"customHeadersDesc": "添加自定义 HTTP 请求头,格式为 JSON 对象。"
327329
},
328330
"imageMethod": {
329331
"title": "图像识别",

src/app/core/setting/ai/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ export default function AiPage() {
291291
{/* 自定义Headers */}
292292
{!baseAiConfig.find(config => config.baseURL === baseURL) && (
293293
<SettingRow>
294-
<FormItem title="自定义Headers" desc="自定义请求头 (JSON格式)">
294+
<FormItem title={t('customHeaders')} desc={t('customHeadersDesc')}>
295295
<Textarea
296296
value={customHeaders}
297297
onChange={(e) => {

0 commit comments

Comments
 (0)