mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-20 05:27:59 +08:00
fix: rename zhipu bot_type, persist bot_type in web config, fix re.sub escape error
- Rename ZHIPU_AI bot type from glm-4 to zhipu to avoid confusion with model names - Add bot_type persistence in web config to fix provider dropdown resetting on refresh - Change OpenAI provider key to chatGPT to match bot_factory routing - Add DEEPSEEK constant and route it to ChatGPTBot (OpenAI-compatible API) - Keep backward compatibility for legacy bot_type glm-4 in bot_factory - Fix re.sub bad escape error on Windows paths by using lambda replacement - Remove unused pydantic import in minimax_bot.py Made-with: Cursor
This commit is contained in:
@@ -908,7 +908,9 @@ function initConfigView(data) {
|
||||
const providerOpts = Object.entries(configProviders).map(([pid, p]) => ({ value: pid, label: p.label }));
|
||||
|
||||
// if use_linkai is enabled, always select linkai as the provider
|
||||
const detected = data.use_linkai ? 'linkai' : detectProvider(configCurrentModel);
|
||||
// Otherwise prefer bot_type from config, fall back to model-based detection
|
||||
const detected = data.use_linkai ? 'linkai'
|
||||
: (data.bot_type && configProviders[data.bot_type] ? data.bot_type : detectProvider(configCurrentModel));
|
||||
cfgProviderValue = detected || (providerOpts[0] ? providerOpts[0].value : '');
|
||||
|
||||
initDropdown(providerEl, providerOpts, cfgProviderValue, onProviderChange);
|
||||
@@ -1062,6 +1064,14 @@ function saveModelConfig() {
|
||||
const updates = { model: model };
|
||||
const p = configProviders[cfgProviderValue];
|
||||
updates.use_linkai = (cfgProviderValue === 'linkai');
|
||||
// Save bot_type for bot_factory routing.
|
||||
// Most providers use their key directly as bot_type.
|
||||
// linkai uses use_linkai flag instead of bot_type.
|
||||
if (cfgProviderValue === 'linkai') {
|
||||
updates.bot_type = '';
|
||||
} else {
|
||||
updates.bot_type = cfgProviderValue;
|
||||
}
|
||||
if (p && p.api_base_key) {
|
||||
const base = document.getElementById('cfg-api-base').value.trim();
|
||||
if (base) updates[p.api_base_key] = base;
|
||||
|
||||
Reference in New Issue
Block a user