mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-07-03 13:41:28 +08:00
feat: prepare v0.18.0 release
This commit is contained in:
@@ -11,6 +11,28 @@ import { toast } from '../components/toast.js'
|
||||
import { t } from './i18n.js'
|
||||
import { getKernelSnapshot } from './kernel.js'
|
||||
|
||||
async function resolveKernelUpgradePolicy(snap) {
|
||||
try {
|
||||
const info = await api.getVersionInfo()
|
||||
const source = String(info?.source || '').toLowerCase()
|
||||
const cliSource = String(info?.cli_source || '').toLowerCase()
|
||||
const variant = source === 'chinese' || cliSource === 'standalone' || cliSource === 'npm-zh'
|
||||
? 'chinese'
|
||||
: source === 'official' || cliSource === 'npm-official' || cliSource === 'npm-global'
|
||||
? 'official'
|
||||
: (snap.variant === 'chinese' ? 'chinese' : 'official')
|
||||
return {
|
||||
variant,
|
||||
targetVersion: info?.recommended || snap.target || '',
|
||||
}
|
||||
} catch {
|
||||
return {
|
||||
variant: snap.variant === 'chinese' ? 'chinese' : 'official',
|
||||
targetVersion: snap.target || '',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发一键升级。会自动检测当前内核 variant(官方/汉化)选择源,调推荐版本。
|
||||
*
|
||||
@@ -26,8 +48,7 @@ export async function triggerKernelUpgrade(opts = {}) {
|
||||
return false
|
||||
}
|
||||
|
||||
const variant = snap.variant === 'chinese' ? 'chinese' : 'official'
|
||||
const targetVersion = snap.target || ''
|
||||
const { variant, targetVersion } = await resolveKernelUpgradePolicy(snap)
|
||||
|
||||
// 1. 确认对话框
|
||||
if (!opts.skipConfirm) {
|
||||
|
||||
@@ -23,7 +23,7 @@ export const PROVIDER_PRESETS = [
|
||||
{ key: 'volcengine', label: '火山引擎', baseUrl: 'https://ark.cn-beijing.volces.com/api/v3', api: 'openai-completions', site: 'https://volcengine.com/L/Ph1OP5I3_GY', desc: '字节跳动旗下云平台,支持豆包等模型' },
|
||||
{ key: 'aliyun', label: '阿里云百炼', baseUrl: 'https://dashscope.aliyuncs.com/compatible-mode/v1', api: 'openai-completions', site: 'https://www.aliyun.com/benefit/ai/aistar?userCode=keahn2zr&clubBiz=subTask..12435175..10263..', desc: '阿里云 AI 大模型平台,支持通义千问全系列' },
|
||||
{ key: 'zhipu', label: '智谱 AI', baseUrl: 'https://open.bigmodel.cn/api/paas/v4', api: 'openai-completions', site: 'https://www.bigmodel.cn/glm-coding?ic=3F6F9XYKTS', desc: '国产大模型领军企业,支持 GLM-4 全系列' },
|
||||
{ key: 'minimax', label: 'MiniMax', baseUrl: 'https://api.minimax.io/v1', api: 'openai-completions', site: 'https://platform.minimaxi.com/user-center/basic-information/interface-key', desc: '国产多模态大模型,支持 MiniMax-M2.7 / M2.5 系列' },
|
||||
{ key: 'minimax', label: 'MiniMax', baseUrl: 'https://api.minimax.io/v1', api: 'openai-completions', site: 'https://platform.minimaxi.com/user-center/basic-information/interface-key', desc: '国产多模态大模型,支持 MiniMax-M3 / M2.7 系列' },
|
||||
{ key: 'moonshot', label: 'Moonshot / Kimi', baseUrl: 'https://api.moonshot.ai/v1', api: 'openai-completions', site: 'https://platform.moonshot.ai/console/api-keys', desc: 'Kimi 大模型平台,支持超长上下文' },
|
||||
{ key: 'openai', label: 'OpenAI 官方', baseUrl: 'https://api.openai.com/v1', api: 'openai-completions', site: 'https://platform.openai.com/api-keys' },
|
||||
{ key: 'anthropic', label: 'Anthropic 官方', baseUrl: 'https://api.anthropic.com/v1', api: 'anthropic-messages', site: 'https://console.anthropic.com/settings/keys' },
|
||||
@@ -78,10 +78,9 @@ export const MODEL_PRESETS = {
|
||||
{ id: 'gemini-2.5-flash', name: 'Gemini 2.5 Flash', contextWindow: 1000000 },
|
||||
],
|
||||
minimax: [
|
||||
{ id: 'MiniMax-M3', name: 'MiniMax M3', contextWindow: 524288 },
|
||||
{ id: 'MiniMax-M2.7', name: 'MiniMax M2.7', contextWindow: 1000000 },
|
||||
{ id: 'MiniMax-M2.7-highspeed', name: 'MiniMax M2.7 Highspeed', contextWindow: 1000000 },
|
||||
{ id: 'MiniMax-M2.5', name: 'MiniMax M2.5', contextWindow: 204000 },
|
||||
{ id: 'MiniMax-M2.5-highspeed', name: 'MiniMax M2.5 Highspeed', contextWindow: 204000 },
|
||||
],
|
||||
moonshot: [
|
||||
{ id: 'kimi-k2.5', name: 'Kimi K2.5', contextWindow: 131072 },
|
||||
|
||||
@@ -255,6 +255,7 @@ export async function checkBackendHealth() {
|
||||
let _reloadTimer = null
|
||||
function _debouncedReloadGateway() {
|
||||
clearTimeout(_reloadTimer)
|
||||
if (!isTauriRuntime()) return
|
||||
_reloadTimer = setTimeout(() => { invoke('reload_gateway').catch(() => {}) }, 3000)
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* 5. 从 snapshot.sessionDefaults.mainSessionKey 获取 sessionKey
|
||||
* 6. 开始正常通信
|
||||
*/
|
||||
import { api } from './tauri-api.js'
|
||||
import { api, isTauriRuntime } from './tauri-api.js'
|
||||
import { t } from './i18n.js'
|
||||
import { KERNEL_TARGET } from './feature-catalog.js'
|
||||
|
||||
@@ -590,12 +590,16 @@ export class WsClient {
|
||||
const result = await api.autoPairDevice()
|
||||
console.log('[ws] 配对结果:', result)
|
||||
|
||||
// 配对后需要 reload Gateway 使 allowedOrigins 生效
|
||||
try {
|
||||
await api.reloadGateway()
|
||||
console.log('[ws] Gateway 已重载')
|
||||
} catch (e) {
|
||||
console.warn('[ws] reloadGateway 失败(非致命):', e)
|
||||
// 配对后桌面端需要 reload Gateway 使 allowedOrigins 生效;Web/headless 不能隐式重载反代后的服务。
|
||||
if (isTauriRuntime()) {
|
||||
try {
|
||||
await api.reloadGateway()
|
||||
console.log('[ws] Gateway 已重载')
|
||||
} catch (e) {
|
||||
console.warn('[ws] reloadGateway 失败(非致命):', e)
|
||||
}
|
||||
} else {
|
||||
console.log('[ws] Web/headless 模式跳过自动 reload Gateway')
|
||||
}
|
||||
|
||||
// 修复 #160: 不调用 reconnect()(它会重置 _autoPairAttempts 导致无限循环),
|
||||
|
||||
Reference in New Issue
Block a user