Skip to content

Commit 9d8ebef

Browse files
committed
chore: version compatibility
1 parent 6e167aa commit 9d8ebef

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/config.mjs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ import { languages } from 'countries-list'
1313
* @type {Object.<string,Model>}
1414
*/
1515
export const Models = {
16-
chatgptFree: { value: 'text-davinci-002-render-sha', desc: 'ChatGPT (Web)' },
17-
chatgptPlus: { value: 'gpt-4', desc: 'ChatGPT (Web, GPT-4)' },
16+
chatgptFree35: { value: 'text-davinci-002-render-sha', desc: 'ChatGPT (Web)' },
17+
chatgptPlus4: { value: 'gpt-4', desc: 'ChatGPT (Web, GPT-4)' },
1818
chatgptApi35: { value: 'gpt-3.5-turbo', desc: 'ChatGPT (GPT-3.5-turbo)' },
1919
chatgptApi4_8k: { value: 'gpt-4', desc: 'ChatGPT (GPT-4-8k)' },
2020
chatgptApi4_32k: { value: 'gpt-4-32k', desc: 'ChatGPT (GPT-4-32k)' },
2121
gptApiDavinci: { value: 'text-davinci-003', desc: 'GPT-3.5' },
2222
}
2323

24-
export const chatgptWebModelKeys = ['chatgptFree', 'chatgptPlus']
25-
export const gptApiModelKeys = ['gptDavinci']
24+
export const chatgptWebModelKeys = ['chatgptFree35', 'chatgptPlus4']
25+
export const gptApiModelKeys = ['gptApiDavinci']
2626
export const chatgptApiModelKeys = ['chatgptApi35', 'chatgptApi4_8k', 'chatgptApi4_32k']
2727

2828
export const TriggerMode = {
@@ -52,7 +52,7 @@ export const defaultConfig = {
5252
/** @type {keyof ThemeMode}*/
5353
themeMode: 'auto',
5454
/** @type {keyof Models}*/
55-
modelName: 'chatgptFree',
55+
modelName: 'chatgptFree35',
5656
apiKey: '',
5757
preferredLanguage: navigator.language.substring(0, 2),
5858
insertAtTop: isMobile(),
@@ -116,6 +116,12 @@ export function isUsingApiKey(config) {
116116
*/
117117
export async function getUserConfig() {
118118
const options = await Browser.storage.local.get(Object.keys(defaultConfig))
119+
120+
// version compatibility
121+
if (options.modelName === 'chatgptFree') options.modelName = 'chatgptFree35'
122+
else if (options.modelName === 'chatgptApi') options.modelName = 'chatgptApi35'
123+
else if (options.modelName === 'gptDavinci') options.modelName = 'gptApiDavinci'
124+
119125
return defaults(options, defaultConfig)
120126
}
121127

0 commit comments

Comments
 (0)