-
Notifications
You must be signed in to change notification settings - Fork 852
Correct LLM provider naming for OpenAI/Anthropic API modes #928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -133,7 +133,8 @@ | |||||
| "Generating...": "生成中...", | ||||||
| "moonshot token required, please login at https://kimi.com first, and then click the retry button": "moonshotトークンが必要です。最初に https://kimi.com にログインしてから、再試行ボタンをクリックしてください", | ||||||
| "Hide context menu of this extension": "この拡張機能のコンテキストメニューを非表示", | ||||||
| "Custom Claude API Url": "カスタムClaude APIのURL", | ||||||
| "Custom Anthropic API Url": "カスタムAnthropic APIのURL", | ||||||
| "Anthropic API Key": "Anthropic API キー", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor spacing inconsistency in Japanese translation.
🛠️ Suggested fix- "Anthropic API Key": "Anthropic API キー",
+ "Anthropic API Key": "Anthropic APIキー",📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| "Cancel": "キャンセル", | ||||||
| "Name is required": "名前は必須です", | ||||||
| "Prompt template should include {{selection}}": "プロンプトテンプレートには {{selection}} を含める必要があります", | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ import { | |
| } from '../services/apis/chatgpt-web' | ||
| import { generateAnswersWithBingWebApi } from '../services/apis/bing-web.mjs' | ||
| import { | ||
| generateAnswersWithChatgptApi, | ||
| generateAnswersWithOpenAiApi, | ||
| generateAnswersWithGptCompletionApi, | ||
| } from '../services/apis/openai-api' | ||
| import { generateAnswersWithCustomApi } from '../services/apis/custom-api.mjs' | ||
|
|
@@ -65,7 +65,7 @@ const RECONNECT_CONFIG = { | |
| } | ||
|
|
||
| const SENSITIVE_KEYWORDS = [ | ||
| 'apikey', // Covers apiKey, customApiKey, claudeApiKey, etc. | ||
| 'apikey', // Covers apiKey, customApiKey, anthropicApiKey, etc. | ||
| 'token', // Covers accessToken, refreshToken, etc. | ||
| 'secret', | ||
| 'password', | ||
|
|
@@ -582,10 +582,10 @@ async function executeApi(session, port, config) { | |
| const cookies = await getBardCookies() | ||
| await generateAnswersWithBardWebApi(port, session.question, session, cookies) | ||
| } else if (isUsingChatgptApiModel(session)) { | ||
| console.debug('[background] Using ChatGPT API Model') | ||
| await generateAnswersWithChatgptApi(port, session.question, session, config.apiKey) | ||
| console.debug('[background] Using OpenAI API Model') | ||
| await generateAnswersWithOpenAiApi(port, session.question, session, config.apiKey) | ||
|
Comment on lines
584
to
+586
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Find all usages of isUsingChatgptApiModel to scope the rename effort
rg -n "isUsingChatgptApiModel" --type=js --type=mjs -g '*.mjs' -g '*.js' -g '*.jsx'Repository: ChatGPTBox-dev/chatGPTBox Length of output: 96 🏁 Script executed: #!/bin/bash
# Find all usages of isUsingChatgptApiModel using glob patterns
rg -n "isUsingChatgptApiModel" -g '*.mjs' -g '*.js' -g '*.jsx'Repository: ChatGPTBox-dev/chatGPTBox Length of output: 407 🏁 Script executed: #!/bin/bash
# View the function definition and related code
sed -n '655,675p' src/config/index.mjsRepository: ChatGPTBox-dev/chatGPTBox Length of output: 723 🏁 Script executed: #!/bin/bash
# View the context around line 584 in src/background/index.mjs
sed -n '570,600p' src/background/index.mjsRepository: ChatGPTBox-dev/chatGPTBox Length of output: 1709 🏁 Script executed: #!/bin/bash
# Search for isUsingGptCompletionApiModel in background file
rg -n "isUsingGptCompletionApiModel" -A 3 src/background/index.mjsRepository: ChatGPTBox-dev/chatGPTBox Length of output: 482 The log message should specifically say "Using ChatGPT API Model" instead of "Using OpenAI API Model". The guard condition at line 584 ( 🤖 Prompt for AI Agents |
||
| } else if (isUsingClaudeApiModel(session)) { | ||
| console.debug('[background] Using Claude API Model') | ||
| console.debug('[background] Using Anthropic API Model') | ||
| await generateAnswersWithClaudeApi(port, session.question, session) | ||
|
Comment on lines
587
to
589
|
||
| } else if (isUsingMoonshotApiModel(session)) { | ||
| console.debug('[background] Using Moonshot API Model') | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -156,11 +156,11 @@ export const ModelGroups = { | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| chatgptApiModelKeys: { | ||||||||||||||||||||||||||||||||
| value: chatgptApiModelKeys, | ||||||||||||||||||||||||||||||||
| desc: 'ChatGPT (API)', | ||||||||||||||||||||||||||||||||
| desc: 'OpenAI (API)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| claudeApiModelKeys: { | ||||||||||||||||||||||||||||||||
| value: claudeApiModelKeys, | ||||||||||||||||||||||||||||||||
| desc: 'Claude.ai (API)', | ||||||||||||||||||||||||||||||||
| desc: 'Anthropic (API)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| moonshotApiModelKeys: { | ||||||||||||||||||||||||||||||||
| value: moonshotApiModelKeys, | ||||||||||||||||||||||||||||||||
|
|
@@ -176,7 +176,7 @@ export const ModelGroups = { | |||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| azureOpenAiApiModelKeys: { | ||||||||||||||||||||||||||||||||
| value: azureOpenAiApiModelKeys, | ||||||||||||||||||||||||||||||||
| desc: 'ChatGPT (Azure API)', | ||||||||||||||||||||||||||||||||
| desc: 'Azure OpenAI (API)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| gptApiModelKeys: { | ||||||||||||||||||||||||||||||||
| value: gptApiModelKeys, | ||||||||||||||||||||||||||||||||
|
|
@@ -220,75 +220,75 @@ export const Models = { | |||||||||||||||||||||||||||||||
| chatgptPlus4: { value: 'gpt-4', desc: 'ChatGPT (Web, GPT-4)' }, | ||||||||||||||||||||||||||||||||
| chatgptPlus4Browsing: { value: 'gpt-4', desc: 'ChatGPT (Web, GPT-4)' }, // for compatibility | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| chatgptApi35: { value: 'gpt-3.5-turbo', desc: 'ChatGPT (GPT-3.5-turbo)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi35_16k: { value: 'gpt-3.5-turbo-16k', desc: 'ChatGPT (GPT-3.5-turbo-16k)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi35: { value: 'gpt-3.5-turbo', desc: 'OpenAI (GPT-3.5-turbo)' }, | ||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Renaming model descriptors like Useful? React with 👍 / 👎. |
||||||||||||||||||||||||||||||||
| chatgptApi35_16k: { value: 'gpt-3.5-turbo-16k', desc: 'OpenAI (GPT-3.5-turbo-16k)' }, | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| chatgptApi4o_128k: { value: 'gpt-4o', desc: 'ChatGPT (GPT-4o, 128k)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi4oMini: { value: 'gpt-4o-mini', desc: 'ChatGPT (GPT-4o mini)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi4_8k: { value: 'gpt-4', desc: 'ChatGPT (GPT-4-8k)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi4o_128k: { value: 'gpt-4o', desc: 'OpenAI (GPT-4o, 128k)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi4oMini: { value: 'gpt-4o-mini', desc: 'OpenAI (GPT-4o mini)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi4_8k: { value: 'gpt-4', desc: 'OpenAI (GPT-4-8k)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi4_128k: { | ||||||||||||||||||||||||||||||||
| value: 'gpt-4-turbo', | ||||||||||||||||||||||||||||||||
| desc: 'ChatGPT (GPT-4-Turbo 128k)', | ||||||||||||||||||||||||||||||||
| desc: 'OpenAI (GPT-4-Turbo 128k)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| chatgptApi4_128k_preview: { | ||||||||||||||||||||||||||||||||
| value: 'gpt-4-turbo-preview', | ||||||||||||||||||||||||||||||||
| desc: 'ChatGPT (GPT-4-Turbo 128k Preview)', | ||||||||||||||||||||||||||||||||
| desc: 'OpenAI (GPT-4-Turbo 128k Preview)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| chatgptApi4_128k_1106_preview: { | ||||||||||||||||||||||||||||||||
| value: 'gpt-4-1106-preview', | ||||||||||||||||||||||||||||||||
| desc: 'ChatGPT (GPT-4-Turbo 128k 1106 Preview)', | ||||||||||||||||||||||||||||||||
| desc: 'OpenAI (GPT-4-Turbo 128k 1106 Preview)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| chatgptApi4_128k_0125_preview: { | ||||||||||||||||||||||||||||||||
| value: 'gpt-4-0125-preview', | ||||||||||||||||||||||||||||||||
| desc: 'ChatGPT (GPT-4-Turbo 128k 0125 Preview)', | ||||||||||||||||||||||||||||||||
| desc: 'OpenAI (GPT-4-Turbo 128k 0125 Preview)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| chatgptApi5Latest: { value: 'gpt-5-chat-latest', desc: 'ChatGPT (ChatGPT-5 latest)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi5_1Latest: { value: 'gpt-5.1-chat-latest', desc: 'ChatGPT (ChatGPT-5.1 latest)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi5Latest: { value: 'gpt-5-chat-latest', desc: 'OpenAI (GPT-5 latest)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi5_1Latest: { value: 'gpt-5.1-chat-latest', desc: 'OpenAI (GPT-5.1 latest)' }, | ||||||||||||||||||||||||||||||||
|
Comment on lines
+245
to
+246
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: Current OpenAI API docs for
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| chatgptApi4_1: { value: 'gpt-4.1', desc: 'ChatGPT (GPT-4.1)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi4_1_mini: { value: 'gpt-4.1-mini', desc: 'ChatGPT (GPT-4.1 mini)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi4_1_nano: { value: 'gpt-4.1-nano', desc: 'ChatGPT (GPT-4.1 nano)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi4_1: { value: 'gpt-4.1', desc: 'OpenAI (GPT-4.1)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi4_1_mini: { value: 'gpt-4.1-mini', desc: 'OpenAI (GPT-4.1 mini)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi4_1_nano: { value: 'gpt-4.1-nano', desc: 'OpenAI (GPT-4.1 nano)' }, | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| claude2WebFree: { value: '', desc: 'Claude.ai (Web)' }, | ||||||||||||||||||||||||||||||||
| claude3HaikuApi: { | ||||||||||||||||||||||||||||||||
| value: 'claude-3-haiku-20240307', | ||||||||||||||||||||||||||||||||
| desc: 'Claude.ai (API, Claude 3 Haiku)', | ||||||||||||||||||||||||||||||||
| desc: 'Anthropic (API, Claude 3 Haiku)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| claude35HaikuApi: { | ||||||||||||||||||||||||||||||||
| value: 'claude-3-5-haiku-20241022', | ||||||||||||||||||||||||||||||||
| desc: 'Claude.ai (API, Claude 3.5 Haiku)', | ||||||||||||||||||||||||||||||||
| desc: 'Anthropic (API, Claude 3.5 Haiku)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| claude37SonnetApi: { | ||||||||||||||||||||||||||||||||
| value: 'claude-3-7-sonnet-20250219', | ||||||||||||||||||||||||||||||||
| desc: 'Claude.ai (API, Claude 3.7 Sonnet)', | ||||||||||||||||||||||||||||||||
| desc: 'Anthropic (API, Claude 3.7 Sonnet)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| claudeOpus4Api: { | ||||||||||||||||||||||||||||||||
| value: 'claude-opus-4-20250514', | ||||||||||||||||||||||||||||||||
| desc: 'Claude.ai (API, Claude Opus 4)', | ||||||||||||||||||||||||||||||||
| desc: 'Anthropic (API, Claude Opus 4)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| claudeOpus41Api: { | ||||||||||||||||||||||||||||||||
| value: 'claude-opus-4-1-20250805', | ||||||||||||||||||||||||||||||||
| desc: 'Claude.ai (API, Claude Opus 4.1)', | ||||||||||||||||||||||||||||||||
| desc: 'Anthropic (API, Claude Opus 4.1)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| claudeOpus45Api: { | ||||||||||||||||||||||||||||||||
| value: 'claude-opus-4-5', | ||||||||||||||||||||||||||||||||
| desc: 'Claude.ai (API, Claude Opus 4.5)', | ||||||||||||||||||||||||||||||||
| desc: 'Anthropic (API, Claude Opus 4.5)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| claudeOpus46Api: { | ||||||||||||||||||||||||||||||||
| value: 'claude-opus-4-6', | ||||||||||||||||||||||||||||||||
| desc: 'Claude.ai (API, Claude Opus 4.6)', | ||||||||||||||||||||||||||||||||
| desc: 'Anthropic (API, Claude Opus 4.6)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| claudeSonnet4Api: { | ||||||||||||||||||||||||||||||||
| value: 'claude-sonnet-4-20250514', | ||||||||||||||||||||||||||||||||
| desc: 'Claude.ai (API, Claude Sonnet 4)', | ||||||||||||||||||||||||||||||||
| desc: 'Anthropic (API, Claude Sonnet 4)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| claudeSonnet45Api: { | ||||||||||||||||||||||||||||||||
| value: 'claude-sonnet-4-5-20250929', | ||||||||||||||||||||||||||||||||
| desc: 'Claude.ai (API, Claude Sonnet 4.5)', | ||||||||||||||||||||||||||||||||
| desc: 'Anthropic (API, Claude Sonnet 4.5)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| claudeHaiku45Api: { | ||||||||||||||||||||||||||||||||
| value: 'claude-haiku-4-5-20251001', | ||||||||||||||||||||||||||||||||
| desc: 'Claude.ai (API, Claude Haiku 4.5)', | ||||||||||||||||||||||||||||||||
| desc: 'Anthropic (API, Claude Haiku 4.5)', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| bingFree4: { value: '', desc: 'Bing (Web, GPT-4)' }, | ||||||||||||||||||||||||||||||||
|
|
@@ -311,15 +311,15 @@ export const Models = { | |||||||||||||||||||||||||||||||
| chatgptFree35Mobile: { value: 'text-davinci-002-render-sha-mobile', desc: 'ChatGPT (Mobile)' }, | ||||||||||||||||||||||||||||||||
| chatgptPlus4Mobile: { value: 'gpt-4-mobile', desc: 'ChatGPT (Mobile, GPT-4)' }, | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| chatgptApi35_1106: { value: 'gpt-3.5-turbo-1106', desc: 'ChatGPT (GPT-3.5-turbo 1106)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi35_0125: { value: 'gpt-3.5-turbo-0125', desc: 'ChatGPT (GPT-3.5-turbo 0125)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi4_8k_0613: { value: 'gpt-4', desc: 'ChatGPT (GPT-4-8k 0613)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi35_1106: { value: 'gpt-3.5-turbo-1106', desc: 'OpenAI (GPT-3.5-turbo 1106)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi35_0125: { value: 'gpt-3.5-turbo-0125', desc: 'OpenAI (GPT-3.5-turbo 0125)' }, | ||||||||||||||||||||||||||||||||
| chatgptApi4_8k_0613: { value: 'gpt-4', desc: 'OpenAI (GPT-4-8k 0613)' }, | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| gptApiInstruct: { value: 'gpt-3.5-turbo-instruct', desc: 'GPT-3.5-turbo Instruct' }, | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| customModel: { value: '', desc: 'Custom Model' }, | ||||||||||||||||||||||||||||||||
| ollamaModel: { value: '', desc: 'Ollama API' }, | ||||||||||||||||||||||||||||||||
| azureOpenAi: { value: '', desc: 'ChatGPT (Azure)' }, | ||||||||||||||||||||||||||||||||
| azureOpenAi: { value: '', desc: 'Azure OpenAI' }, | ||||||||||||||||||||||||||||||||
| waylaidwandererApi: { value: '', desc: 'Waylaidwanderer API (Github)' }, | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| poeAiWebSage: { value: 'Assistant', desc: 'Poe AI (Web, Assistant)' }, | ||||||||||||||||||||||||||||||||
|
|
@@ -481,7 +481,7 @@ export const defaultConfig = { | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| poeCustomBotName: '', | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| claudeApiKey: '', | ||||||||||||||||||||||||||||||||
| anthropicApiKey: '', | ||||||||||||||||||||||||||||||||
| chatglmApiKey: '', | ||||||||||||||||||||||||||||||||
| moonshotApiKey: '', | ||||||||||||||||||||||||||||||||
| deepSeekApiKey: '', | ||||||||||||||||||||||||||||||||
|
|
@@ -511,7 +511,7 @@ export const defaultConfig = { | |||||||||||||||||||||||||||||||
| customChatGptWebApiUrl: 'https://chatgpt.com', | ||||||||||||||||||||||||||||||||
| customChatGptWebApiPath: '/backend-api/conversation', | ||||||||||||||||||||||||||||||||
| customOpenAiApiUrl: 'https://api.openai.com', | ||||||||||||||||||||||||||||||||
| customClaudeApiUrl: 'https://api.anthropic.com', | ||||||||||||||||||||||||||||||||
| customAnthropicApiUrl: 'https://api.anthropic.com', | ||||||||||||||||||||||||||||||||
| disableWebModeHistory: true, | ||||||||||||||||||||||||||||||||
| hideContextMenu: false, | ||||||||||||||||||||||||||||||||
| cropText: true, | ||||||||||||||||||||||||||||||||
|
|
@@ -727,9 +727,28 @@ export async function getPreferredLanguageKey() { | |||||||||||||||||||||||||||||||
| * @returns {Promise<UserConfig>} | ||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||
| export async function getUserConfig() { | ||||||||||||||||||||||||||||||||
| const options = await Browser.storage.local.get(Object.keys(defaultConfig)) | ||||||||||||||||||||||||||||||||
| // Also fetch old keys for migration | ||||||||||||||||||||||||||||||||
| const options = await Browser.storage.local.get([ | ||||||||||||||||||||||||||||||||
| ...Object.keys(defaultConfig), | ||||||||||||||||||||||||||||||||
| 'claudeApiKey', | ||||||||||||||||||||||||||||||||
| 'customClaudeApiUrl', | ||||||||||||||||||||||||||||||||
| ]) | ||||||||||||||||||||||||||||||||
| if (options.customChatGptWebApiUrl === 'https://chat.openai.com') | ||||||||||||||||||||||||||||||||
| options.customChatGptWebApiUrl = 'https://chatgpt.com' | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Migrate old keys to new names (persist new keys before removing old ones) | ||||||||||||||||||||||||||||||||
| // Always migrate if old key exists to handle import of legacy backups | ||||||||||||||||||||||||||||||||
| if (options.claudeApiKey !== undefined) { | ||||||||||||||||||||||||||||||||
| options.anthropicApiKey = options.claudeApiKey | ||||||||||||||||||||||||||||||||
| await Browser.storage.local.set({ anthropicApiKey: options.claudeApiKey }) | ||||||||||||||||||||||||||||||||
|
Comment on lines
+740
to
+743
|
||||||||||||||||||||||||||||||||
| // Always migrate if old key exists to handle import of legacy backups | |
| if (options.claudeApiKey !== undefined) { | |
| options.anthropicApiKey = options.claudeApiKey | |
| await Browser.storage.local.set({ anthropicApiKey: options.claudeApiKey }) | |
| // Only backfill anthropicApiKey from claudeApiKey if the new key is missing/empty | |
| if (options.claudeApiKey !== undefined) { | |
| const hasAnthropicApiKey = | |
| options.anthropicApiKey !== undefined && | |
| options.anthropicApiKey !== null && | |
| options.anthropicApiKey !== '' | |
| if (!hasAnthropicApiKey) { | |
| options.anthropicApiKey = options.claudeApiKey | |
| await Browser.storage.local.set({ anthropicApiKey: options.claudeApiKey }) | |
| } |
Copilot
AI
Feb 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New storage migration behavior was added for claudeApiKey/customClaudeApiUrl, but there are existing unit tests for getUserConfig migrations (e.g., the chat.openai.com -> chatgpt.com URL case). Please add tests covering the new key migrations (including that the old keys are removed and the new keys are set, and that newer keys are not overwritten when both exist).
Copilot
AI
Feb 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue for the custom URL migration: if both customAnthropicApiUrl and legacy customClaudeApiUrl are present in storage, this logic will overwrite the newer URL. Consider only migrating when the new key is not set (or keep the new value and only remove the legacy key).
| options.customAnthropicApiUrl = options.customClaudeApiUrl | |
| await Browser.storage.local.set({ customAnthropicApiUrl: options.customClaudeApiUrl }) | |
| // Only migrate URL if new key is not already set; otherwise keep the newer value | |
| if (options.customAnthropicApiUrl === undefined) { | |
| options.customAnthropicApiUrl = options.customClaudeApiUrl | |
| await Browser.storage.local.set({ | |
| customAnthropicApiUrl: options.customClaudeApiUrl, | |
| }) | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: ChatGPTBox-dev/chatGPTBox
Length of output: 324
Key rename in
en/main.jsonviolates the "Do not change keys" guideline.Per coding guidelines, keys in
src/_locales/en/main.jsonshould not be changed; instead, new strings should be added and propagated to other locales. This PR changed"Custom Claude API Url"to"Custom Anthropic API Url", which is a key rename rather than adding a new key.Verification confirms the migration is complete across all in-tree files:
While the implementation is comprehensive and correct, the guideline exists to prevent breaking changes in localization keys. Future PRs should add new keys alongside old ones to maintain backward compatibility.
🤖 Prompt for AI Agents