Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89c71fbfe6 | ||
|
|
7c88099ce1 | ||
|
|
cf9707326c | ||
|
|
93c5720769 | ||
|
|
a0e36e928d |
No files matched your search
@@ -79,6 +79,14 @@ jobs:
|
||||
releaseBody: |
|
||||
## ${{ github.ref_name }}
|
||||
|
||||
### 本次更新
|
||||
|
||||
- **高级设置**:原「子代理设置」升级为「高级设置」,聚合子代理模型指定、实验功能开关与 WebUI 快捷入口
|
||||
- **仪表盘热力图双击弹窗**:双击热力图方块即可查看当日模型用量分布,每种模型展示 Token / 请求次数 / 费用 / 命中率
|
||||
- **子代理模型指定(实验功能)**:为子代理绑定次主力模型,不再默认继承主模型;实验开关改为滑动开关并修复开启态隐形
|
||||
- **兼容 kimi-code 0.33+(v2 引擎)**:`loop_control` 写入新键名 `max_attempts_per_step`,旧配置自动迁移并保留旧键兼容 `KIMI_CODE_LEGACY_FLAG=1`;hooks 候选补充新事件
|
||||
- models.dev 模型数据同步;官网企业版视觉升级;出品公司标识统一
|
||||
|
||||
### Downloads by platform
|
||||
|
||||
- **Windows**: `.msi` installer
|
||||
@@ -87,7 +95,7 @@ jobs:
|
||||
|
||||
### macOS 安装说明(无开发者账号签名,需一次手动绕过)
|
||||
|
||||
1. 下载 `KimiSwitch_*.dmg`,双击挂载后把 `Kimi Switch.app` 拖入「应用程序」文件夹
|
||||
1. 下载 `Kimi.Switch_*.dmg`,双击挂载后把 `Kimi Switch.app` 拖入「应用程序」文件夹
|
||||
2. 下载本 Release 附带的 `install-macos.sh`,在终端运行:
|
||||
|
||||
```bash
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "kimiswitch",
|
||||
"private": true,
|
||||
"version": "0.7.2",
|
||||
"version": "0.7.4",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
## v0.7.2
|
||||
|
||||
### 高级设置与 WebUI(本次新增)
|
||||
|
||||
- 「子代理设置」升级为「**高级设置**」:聚合子代理模型指定、实验功能开关与 WebUI 快捷入口
|
||||
- 新增 **Kimi Code WebUI 快捷打开**:高级设置页可将新版 Web 界面以独立窗口在应用内打开,也可在系统浏览器打开(kimi-code 0.33+ 内置 code-app;需要 kimi 命令在 PATH 中)
|
||||
|
||||
### 子代理模型指定(实验功能)
|
||||
|
||||
- 新增「子代理模型(次主力模型)」指定:在实验功能设置中为子代理选择次主力模型后,子代理默认绑定该模型,不再继承主模型
|
||||
@@ -9,6 +14,7 @@
|
||||
### 模型数据与发布
|
||||
|
||||
- models.dev 模型列表与价格数据同步更新
|
||||
- 兼容 kimi-code 0.33+(v2 引擎):`loop_control` 改用新键名 `max_attempts_per_step`(旧配置自动迁移,并保留旧键兼容 `KIMI_CODE_LEGACY_FLAG=1`)
|
||||
- 官网企业版视觉升级;出品公司标识统一为 codingplan.site
|
||||
- macOS 发布优化:Release 附带 `install-macos.sh` 一键安装脚本(见下方说明)
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
## v0.7.3
|
||||
|
||||
### Kimi Code WebUI 应用内嵌窗口(本次新增)
|
||||
|
||||
- 高级设置页「在应用内打开」:新版 Web 界面以**独立顶层窗口**打开(1100×750、可缩放、居中),不再跳转到外部浏览器
|
||||
- **单例**:窗口最多一个,重复点击自动聚焦;最小化后再次打开可恢复
|
||||
- **服务器自动管理**:复用已在运行的 `kimi web` 本地服务(不重复拉起);自己启动的服务器在窗口关闭或应用退出时自动清理,不留残留进程
|
||||
- 两个入口并存:「在应用内打开」+「在浏览器打开」(浏览器入口复用已运行的本地服务器,直接打开 `http://127.0.0.1:58627`)
|
||||
|
||||
### 修复与打磨
|
||||
|
||||
- 窗口创建失败(快速双击竞态)时不再泄漏 `kimi web` 进程
|
||||
- WebUI 说明文案与发布说明同步更新
|
||||
|
||||
### Downloads by platform
|
||||
|
||||
- **Windows**: `.msi` installer
|
||||
- **macOS**: `.dmg` + `.app`(未签名,仅 Apple Silicon / M 系列芯片)
|
||||
- **Linux**: `.deb` / `.AppImage` / `.rpm`
|
||||
|
||||
### macOS 安装说明(无开发者账号签名,需一次手动绕过)
|
||||
|
||||
> 原因:macOS 包未做 Developer ID 签名与公证(无 Apple 开发者账号),系统会拦截从网络下载的未签名应用(Gatekeeper)。`install-macos.sh` 通过清除「下载隔离」属性绕过该拦截,不影响功能与安全。
|
||||
|
||||
1. 下载 `Kimi.Switch_0.7.3_aarch64.dmg`,双击挂载后把 `Kimi Switch.app` 拖入「应用程序」文件夹
|
||||
2. 下载本 Release 附带的 `install-macos.sh`,在终端运行:
|
||||
|
||||
```bash
|
||||
bash install-macos.sh
|
||||
```
|
||||
|
||||
脚本会自动清除下载隔离属性并启动应用,只需执行一次,之后正常使用。
|
||||
3. 手动替代方案:右键 `Kimi Switch.app` → 打开 → 弹窗点「打开」;或 系统设置 → 隐私与安全性 → 仍要打开
|
||||
@@ -0,0 +1,30 @@
|
||||
## v0.7.4
|
||||
|
||||
### 仪表盘热力图双击弹窗(本次新增)
|
||||
|
||||
- 热力图方块**双击**即可弹窗查看当日模型用量分布
|
||||
- 每种模型独立展示:**Token 用量 / 请求次数 / 费用 / 缓存命中率**(此前仅有 token 数)
|
||||
- 范围外日期(不在当前 7d / 30d / all 范围内的方块)不可双击、无放大效果
|
||||
- 弹窗内 Escape / 点击遮罩 / 关闭按钮均可关闭
|
||||
|
||||
### 数据结构升级
|
||||
|
||||
- 后端 `[dashboard] by_model` 从纯 token 数升级为结构化对象(含 requests / cost / cacheHitRate),弹窗和柱状图双击均展示全量指标
|
||||
|
||||
### Downloads by platform
|
||||
|
||||
- **Windows**: `.msi` installer
|
||||
- **macOS**: `.dmg` + `.app`(未签名,仅 Apple Silicon / M 系列芯片)
|
||||
- **Linux**: `.deb` / `.AppImage` / `.rpm`
|
||||
|
||||
### macOS 安装说明(无开发者账号签名,需一次手动绕过)
|
||||
|
||||
1. 下载 `Kimi.Switch_*.dmg`,双击挂载后把 `Kimi Switch.app` 拖入「应用程序」文件夹
|
||||
2. 下载本 Release 附带的 `install-macos.sh`,在终端运行:
|
||||
|
||||
```bash
|
||||
bash install-macos.sh
|
||||
```
|
||||
|
||||
脚本会自动清除下载隔离属性并启动应用,只需执行一次,之后正常使用。
|
||||
3. 手动替代方案:右键 `Kimi Switch.app` → 打开 → 弹窗点「打开」;或 系统设置 → 隐私与安全性 → 仍要打开
|
||||
Generated
+1
-1
@@ -1958,7 +1958,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kimiswitch"
|
||||
version = "0.7.2"
|
||||
version = "0.7.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "kimiswitch"
|
||||
version = "0.7.2"
|
||||
version = "0.7.4"
|
||||
description = "Kimi Switch - model config manager"
|
||||
authors = ["codingplan.site"]
|
||||
edition = "2021"
|
||||
|
||||
+169
-7
@@ -7,6 +7,7 @@ use serde::Serialize;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Mutex, OnceLock};
|
||||
use std::time::{Duration, Instant};
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_opener::OpenerExt;
|
||||
|
||||
fn fmt_anyhow(err: anyhow::Error) -> String {
|
||||
@@ -950,14 +951,19 @@ pub fn open_installer(app: tauri::AppHandle, path: String) -> Result<(), String>
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
/// Launch `kimi web` — starts the local Kimi Code Web UI server and opens it
|
||||
/// in the default browser (the code-app web bundle built into kimi-code 0.33+).
|
||||
/// The kimi CLI must be on PATH; the spawned process is detached so the server
|
||||
/// keeps running while Kimi Switch stays open.
|
||||
/// Open the Kimi Code WebUI in the system default browser. Reuses an
|
||||
/// already-running local `kimi web` server (embedded window, terminal, …);
|
||||
/// otherwise spawns `kimi web`, which starts the server and opens the browser.
|
||||
#[tauri::command]
|
||||
pub fn open_kimi_web() -> Result<(), String> {
|
||||
use std::process::Command;
|
||||
let mut cmd = Command::new("kimi");
|
||||
pub async fn open_kimi_web(app: tauri::AppHandle) -> Result<(), String> {
|
||||
if kimi_web_alive(Duration::from_millis(800)).await {
|
||||
// Server already running — just open the browser at the local origin.
|
||||
return app
|
||||
.opener()
|
||||
.open_url(kimi_web_url(), None::<&str>)
|
||||
.map_err(|e| e.to_string());
|
||||
}
|
||||
let mut cmd = std::process::Command::new("kimi");
|
||||
cmd.arg("web");
|
||||
#[cfg(windows)]
|
||||
{
|
||||
@@ -975,6 +981,162 @@ pub fn open_kimi_web() -> Result<(), String> {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Kimi Code WebUI — embedded in-app window
|
||||
//
|
||||
// `open_kimi_web_embedded` opens the Kimi Code Web UI inside a dedicated,
|
||||
// independent top-level window (no parent/child relationship with the main
|
||||
// window). At most one such window exists: re-invoking focuses it. The local
|
||||
// `kimi web` server is reused when already running; otherwise one is spawned
|
||||
// (`--no-open`) and terminated when the window closes or the app exits.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Shared state for the embedded WebUI window and the server we may have spawned.
|
||||
#[derive(Default)]
|
||||
pub struct KimiWebState {
|
||||
/// The embedded WebUI window (at most one).
|
||||
window: Mutex<Option<tauri::WebviewWindow>>,
|
||||
/// The `kimi web` child spawned by this app (None when reusing a server).
|
||||
child: Mutex<Option<std::process::Child>>,
|
||||
}
|
||||
|
||||
const KIMI_WEB_PORT: u16 = 58627;
|
||||
const KIMI_WEB_ORIGIN: &str = "http://127.0.0.1:58627";
|
||||
const KIMI_WEB_WINDOW_LABEL: &str = "kimi-web-ui";
|
||||
|
||||
/// Build the Web UI URL; the home-wide bearer token rides in the `#token=`
|
||||
/// fragment (same as the `kimi web` ready banner, see kimi-code
|
||||
/// `cli/sub/web/access-urls.ts`).
|
||||
fn kimi_web_url() -> String {
|
||||
let token = dirs::home_dir()
|
||||
.map(|h| h.join(".kimi-code").join("server.token"))
|
||||
.and_then(|p| std::fs::read_to_string(p).ok())
|
||||
.map(|s| s.trim().to_string())
|
||||
.filter(|s| !s.is_empty());
|
||||
match token {
|
||||
Some(t) => format!("{KIMI_WEB_ORIGIN}/#token={t}"),
|
||||
None => format!("{KIMI_WEB_ORIGIN}/"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Best-effort probe of the local Kimi web server root.
|
||||
async fn kimi_web_alive(timeout: Duration) -> bool {
|
||||
let Ok(client) = reqwest::Client::builder().timeout(timeout).build() else {
|
||||
return false;
|
||||
};
|
||||
client
|
||||
.get(KIMI_WEB_ORIGIN)
|
||||
.send()
|
||||
.await
|
||||
.map(|r| r.status().is_success())
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Kill the `kimi web` server spawned by this app (no-op when reusing one).
|
||||
pub fn kill_spawned_kimi_web(state: &tauri::State<'_, KimiWebState>) {
|
||||
if let Ok(mut guard) = state.child.lock() {
|
||||
if let Some(mut child) = guard.take() {
|
||||
let _ = child.kill();
|
||||
let _ = child.wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Open the Kimi Code WebUI in an embedded, independent top-level window.
|
||||
#[tauri::command]
|
||||
pub async fn open_kimi_web_embedded(
|
||||
app: tauri::AppHandle,
|
||||
state: tauri::State<'_, KimiWebState>,
|
||||
) -> Result<(), String> {
|
||||
// Singleton: focus the existing window instead of creating a second one.
|
||||
if let Ok(guard) = state.window.lock() {
|
||||
if let Some(w) = guard.as_ref() {
|
||||
if w.is_visible().unwrap_or(false) {
|
||||
let _ = w.unminimize();
|
||||
let _ = w.set_focus();
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reuse an already-running server, otherwise spawn `kimi web --no-open`.
|
||||
if !kimi_web_alive(Duration::from_millis(800)).await {
|
||||
let mut cmd = std::process::Command::new("kimi");
|
||||
cmd.args(["web", "--no-open", "--port", &KIMI_WEB_PORT.to_string()]);
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use std::os::windows::process::CommandExt;
|
||||
cmd.creation_flags(0x08000000); // CREATE_NO_WINDOW — no console flash
|
||||
}
|
||||
let child = cmd.spawn().map_err(|e| {
|
||||
if e.kind() == std::io::ErrorKind::NotFound {
|
||||
"kimi executable not found on PATH — install Kimi Code CLI first".to_string()
|
||||
} else {
|
||||
format!("failed to start `kimi web`: {e}")
|
||||
}
|
||||
})?;
|
||||
if let Ok(mut guard) = state.child.lock() {
|
||||
*guard = Some(child);
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for the server to come up (fresh start takes a moment).
|
||||
if !kimi_web_alive(Duration::from_secs(8)).await {
|
||||
kill_spawned_kimi_web(&state);
|
||||
return Err(format!("kimi web did not come up within 8s ({KIMI_WEB_ORIGIN})"));
|
||||
}
|
||||
|
||||
// Create the window on the main thread (required on macOS).
|
||||
let url: tauri::Url = match kimi_web_url().parse() {
|
||||
Ok(u) => u,
|
||||
Err(_) => return Err("invalid kimi web url".to_string()),
|
||||
};
|
||||
let app = app.clone();
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let builder_app = app.clone();
|
||||
let _ = app.run_on_main_thread(move || {
|
||||
match tauri::WebviewWindowBuilder::new(
|
||||
&builder_app,
|
||||
KIMI_WEB_WINDOW_LABEL,
|
||||
tauri::WebviewUrl::External(url),
|
||||
)
|
||||
.title("Kimi Code WebUI")
|
||||
.inner_size(1100.0, 750.0)
|
||||
.resizable(true)
|
||||
.center()
|
||||
.build()
|
||||
{
|
||||
Ok(window) => {
|
||||
// Track the window for the singleton check.
|
||||
if let Ok(mut guard) = builder_app.state::<KimiWebState>().window.lock() {
|
||||
*guard = Some(window.clone());
|
||||
}
|
||||
// Clean up when the window closes: forget it and stop the
|
||||
// `kimi web` server we spawned (reused servers are untouched).
|
||||
let w = window.clone();
|
||||
window.on_window_event(move |event| match event {
|
||||
tauri::WindowEvent::Destroyed => {
|
||||
let app = w.app_handle().clone();
|
||||
let state = app.state::<KimiWebState>();
|
||||
if let Ok(mut guard) = state.window.lock() {
|
||||
*guard = None;
|
||||
}
|
||||
kill_spawned_kimi_web(&state);
|
||||
}
|
||||
_ => {}
|
||||
});
|
||||
}
|
||||
Err(_) => {
|
||||
// Window creation failed (e.g. rapid double-click racing
|
||||
// the singleton check): don't leak the server we spawned.
|
||||
kill_spawned_kimi_web(&builder_app.state::<KimiWebState>());
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
/// Preference for Linux is AppImage (portable, no install). If the preferred
|
||||
/// extension is not present, returns None so the UI can fall back to
|
||||
/// "open release page" instead of guessing a less-preferred format.
|
||||
|
||||
@@ -132,8 +132,8 @@ pub struct DailyRow {
|
||||
pub cost_usd: f64,
|
||||
pub total_tokens: u64,
|
||||
pub cache_hit_rate: f64,
|
||||
/// Per-model token breakdown for stacked-bar rendering
|
||||
pub by_model: HashMap<String, u64>,
|
||||
/// Per-model structured breakdown (tokens / requests / cost / cacheHitRate).
|
||||
pub by_model: HashMap<String, TotalsRow>,
|
||||
/// Per-provider token breakdown for stacked-bar rendering
|
||||
pub by_provider: HashMap<String, u64>,
|
||||
/// Per-provider, per-model nested token breakdown (provider → model → tokens),
|
||||
@@ -980,7 +980,7 @@ fn aggregate(records: &[UsageRecord], range: &str, now_ms: u64) -> RangeStats {
|
||||
}
|
||||
|
||||
let mut totals = TotalsRow::default();
|
||||
let mut by_day: HashMap<String, (TotalsRow, HashMap<String, u64>, HashMap<String, HashMap<String, u64>>)> = HashMap::new();
|
||||
let mut by_day: HashMap<String, (TotalsRow, HashMap<String, TotalsRow>, HashMap<String, HashMap<String, u64>>)> = HashMap::new();
|
||||
let mut by_model: HashMap<String, (ModelRow, TotalsRow)> = HashMap::new();
|
||||
|
||||
for r in &filtered {
|
||||
@@ -988,8 +988,7 @@ fn aggregate(records: &[UsageRecord], range: &str, now_ms: u64) -> RangeStats {
|
||||
let dk = day_key(r.time);
|
||||
let (day_totals, day_models, day_prov_models) = by_day.entry(dk.clone()).or_default();
|
||||
day_totals.add(r);
|
||||
*day_models.entry(r.model.clone()).or_insert(0) +=
|
||||
r.input_other + r.output + r.input_cache_read + r.input_cache_creation;
|
||||
day_models.entry(r.model.clone()).or_default().add(r);
|
||||
let provider_key = r.provider.clone().unwrap_or_else(|| "unknown".to_string());
|
||||
*day_prov_models
|
||||
.entry(provider_key)
|
||||
@@ -1024,12 +1023,22 @@ fn aggregate(records: &[UsageRecord], range: &str, now_ms: u64) -> RangeStats {
|
||||
.map(|(date, (t, by_model, by_provider_model))| {
|
||||
let ti = t.input_other + t.input_cache_read + t.input_cache_creation;
|
||||
let ch = if ti > 0 { t.input_cache_read as f64 / ti as f64 } else { 0.0 };
|
||||
// Per-model cache_hit_rate (not cumulative; computed from the
|
||||
// model's own input token split).
|
||||
let by_model_finalized: HashMap<String, TotalsRow> = by_model
|
||||
.into_iter()
|
||||
.map(|(k, mut mt)| {
|
||||
let mi = mt.input_other + mt.input_cache_read + mt.input_cache_creation;
|
||||
mt.cache_hit_rate = if mi > 0 { mt.input_cache_read as f64 / mi as f64 } else { 0.0 };
|
||||
(k, mt)
|
||||
})
|
||||
.collect();
|
||||
DailyRow {
|
||||
date, requests: t.requests,
|
||||
input_other: t.input_other, output: t.output,
|
||||
input_cache_read: t.input_cache_read, input_cache_creation: t.input_cache_creation,
|
||||
cost_usd: t.cost_usd, total_tokens: t.total_tokens, cache_hit_rate: ch,
|
||||
by_model,
|
||||
by_model: by_model_finalized,
|
||||
by_provider: by_provider_model
|
||||
.iter()
|
||||
.map(|(p, m)| (p.clone(), m.values().sum::<u64>()))
|
||||
|
||||
+12
-2
@@ -110,6 +110,7 @@ pub fn run() {
|
||||
commands::open_installer,
|
||||
commands::open_external_url,
|
||||
commands::open_kimi_web,
|
||||
commands::open_kimi_web_embedded,
|
||||
commands::kimi_oauth_start,
|
||||
commands::kimi_oauth_poll,
|
||||
commands::get_experimental_env_status,
|
||||
@@ -123,6 +124,15 @@ pub fn run() {
|
||||
dashboard::delete_workspace,
|
||||
dashboard::get_session_preview,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
.manage(commands::KimiWebState::default())
|
||||
.build(tauri::generate_context!())
|
||||
.expect("error while running tauri application")
|
||||
.run(|app: &tauri::AppHandle, event| {
|
||||
// Ensure a `kimi web` server spawned for the embedded WebUI window
|
||||
// is stopped when the app exits (windows already destroyed first).
|
||||
if let tauri::RunEvent::Exit = event {
|
||||
let state = app.state::<commands::KimiWebState>();
|
||||
commands::kill_spawned_kimi_web(&state);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"productName": "Kimi Switch",
|
||||
"version": "0.7.2",
|
||||
"version": "0.7.4",
|
||||
"identifier": "com.kimiswitch.app",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
||||
@@ -164,6 +164,20 @@ export function SubagentSettingsPage({
|
||||
{/* Kimi Code WebUI quick open */}
|
||||
<Card title={t("webuiSection")}>
|
||||
<p className="text-xs text-content-muted">{t("webuiDesc")}</p>
|
||||
<div className="mt-3 flex flex-wrap gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={async () => {
|
||||
try {
|
||||
await invoke("open_kimi_web_embedded");
|
||||
} catch (err) {
|
||||
alert(err instanceof Error ? err.message : String(err));
|
||||
}
|
||||
}}
|
||||
className="px-3 py-1.5 text-sm rounded bg-blue-600 text-white hover:bg-blue-500 focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
||||
>
|
||||
{t("openWebUIEmbedded")}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={async () => {
|
||||
@@ -173,10 +187,11 @@ export function SubagentSettingsPage({
|
||||
alert(err instanceof Error ? err.message : String(err));
|
||||
}
|
||||
}}
|
||||
className="mt-3 px-3 py-1.5 text-sm rounded bg-blue-600 text-white hover:bg-blue-500 focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
||||
className="px-3 py-1.5 text-sm border border-border rounded hover:bg-hover-2 focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
||||
>
|
||||
{t("openWebUI")}
|
||||
{t("openWebUIBrowser")}
|
||||
</button>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{/* Subagent: secondary model picker + inherited settings */}
|
||||
|
||||
@@ -97,7 +97,12 @@ export function DailyBars({ daily, dimension, names, unknownProviderLabel }: Dai
|
||||
const h = Math.max(4, Math.round(((d.totalTokens || 0) / max) * 170));
|
||||
const total = d.totalTokens || 1;
|
||||
|
||||
const breakdown = dimension === "provider" ? d.byProvider : d.byModel;
|
||||
const breakdown =
|
||||
dimension === "provider"
|
||||
? d.byProvider
|
||||
: Object.fromEntries(
|
||||
Object.entries(d.byModel || {}).map(([k, v]) => [k, v.totalTokens])
|
||||
);
|
||||
const segments = Object.entries(breakdown || {})
|
||||
.map(([key, tokens]) => ({
|
||||
key,
|
||||
|
||||
@@ -48,12 +48,15 @@ export function DailyDetailModal({ day, dimension, colorMap, unknownProviderLabe
|
||||
const total = day.totalTokens || 1;
|
||||
const isProvider = dimension === "provider";
|
||||
|
||||
// Flat per-model breakdown (model tab)
|
||||
// Flat per-model breakdown (model tab) — structured TotalsRow per model
|
||||
const modelSegments = Object.entries(day.byModel || {})
|
||||
.map(([model, tokens]) => ({
|
||||
.map(([model, row]) => ({
|
||||
model,
|
||||
tokens,
|
||||
pct: (tokens / total) * 100,
|
||||
tokens: row.totalTokens,
|
||||
requests: row.requests,
|
||||
costUsd: row.costUsd,
|
||||
cacheHitRate: row.cacheHitRate,
|
||||
pct: ((row.totalTokens || 0) / total) * 100,
|
||||
}))
|
||||
.sort((a, b) => b.tokens - a.tokens);
|
||||
|
||||
@@ -165,20 +168,22 @@ export function DailyDetailModal({ day, dimension, colorMap, unknownProviderLabe
|
||||
{modelSegments.length === 0 ? (
|
||||
<div className="py-6 text-center text-sm text-content-muted">{t("noData")}</div>
|
||||
) : (
|
||||
<div className="space-y-1.5 max-h-72 overflow-y-auto pr-1">
|
||||
<div className="space-y-2 max-h-72 overflow-y-auto pr-1">
|
||||
{modelSegments.map((s, i) => (
|
||||
<div key={s.model} className="flex items-center gap-3 text-sm">
|
||||
<div key={s.model} className="rounded-lg bg-hover/50 px-3 py-2">
|
||||
<div className="flex items-center gap-2 text-sm">
|
||||
<span className="inline-block h-2.5 w-2.5 rounded-sm shrink-0" style={{ backgroundColor: modelColor(i) }} />
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex items-baseline justify-between gap-2">
|
||||
<span className="truncate text-content-primary" title={s.model}>{modelName(s.model)}</span>
|
||||
<span className="shrink-0 text-xs text-content-muted tabular-nums">
|
||||
{fmtTokens(s.tokens)} <span className="text-content-muted">· {s.pct.toFixed(1)}%</span>
|
||||
</span>
|
||||
<span className="truncate flex-1 text-content-primary" title={s.model}>{modelName(s.model)}</span>
|
||||
<span className="shrink-0 text-xs text-content-muted tabular-nums">{s.pct.toFixed(1)}%</span>
|
||||
</div>
|
||||
<div className="mt-1 h-1.5 w-full overflow-hidden rounded-full bg-border">
|
||||
<div className="mt-1.5 h-1.5 w-full overflow-hidden rounded-full bg-border">
|
||||
<div className="h-full rounded-full transition-all" style={{ width: `${Math.max(2, s.pct)}%`, backgroundColor: modelColor(i) }} />
|
||||
</div>
|
||||
<div className="mt-1.5 flex flex-wrap gap-x-4 gap-y-0.5 text-xs text-content-muted tabular-nums">
|
||||
<span>{t("totalTokens")}: <span className="text-content-primary font-medium">{fmtTokens(s.tokens)}</span></span>
|
||||
<span>{t("requests")}: <span className="text-content-primary font-medium">{s.requests.toLocaleString()}</span></span>
|
||||
{s.costUsd > 0 && <span>{t("cost")}: <span className="text-content-primary font-medium">{money(s.costUsd)}</span></span>}
|
||||
<span>{t("cacheHitRate")}: <span className="text-content-primary font-medium">{fmtPct(s.cacheHitRate)}</span></span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import { useState, type ReactNode } from "react";
|
||||
import { useMemo, useState, type ReactNode } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { useDashboard, type DashboardRange } from "../../hooks/useDashboard";
|
||||
import { useCurrency } from "../../hooks/useCurrency";
|
||||
import { useTranslation } from "../../i18n";
|
||||
import { fmtInt, fmtPct, fmtTime, fmtTokens } from "../../lib/dashboard-format";
|
||||
import { DailyBars } from "./DailyBars";
|
||||
import { DailyBars, modelColor } from "./DailyBars";
|
||||
import { DailyDetailModal } from "./DailyDetailModal";
|
||||
import { Heatmap } from "./Heatmap";
|
||||
import { TrendLineChart } from "./TrendLineChart";
|
||||
import type { DailyRow, HeatmapCell } from "../../types/dashboard";
|
||||
|
||||
const RANGES: DashboardRange[] = ["today", "7d", "30d", "all"];
|
||||
|
||||
@@ -56,6 +59,14 @@ export function DashboardPage() {
|
||||
const [showAllModels, setShowAllModels] = useState(false);
|
||||
const [recentPage, setRecentPage] = useState(1);
|
||||
const [trendTab, setTrendTab] = useState<"daily" | "model" | "provider">("daily");
|
||||
const [heatmapSelected, setHeatmapSelected] = useState<DailyRow | null>(null);
|
||||
|
||||
const daily = data?.stats.daily ?? [];
|
||||
const detailDates = useMemo(() => new Set(daily.map((d) => d.date)), [daily]);
|
||||
const heatmapColorMap = useMemo(() => {
|
||||
const unique = [...new Set(daily.flatMap((d) => Object.keys(d.byModel || {})))];
|
||||
return Object.fromEntries(unique.map((m, i) => [m, modelColor(i)]));
|
||||
}, [daily]);
|
||||
|
||||
const RANGE_LABELS: Record<DashboardRange, string> = {
|
||||
today: t("rangeToday"),
|
||||
@@ -92,13 +103,17 @@ export function DashboardPage() {
|
||||
if (!data) return null;
|
||||
|
||||
const totals = data.stats.totals;
|
||||
const daily = data.stats.daily;
|
||||
const models = data.stats.models;
|
||||
const recent = data.stats.recent;
|
||||
const heatmap = data.heatmap;
|
||||
const rangeTotals = data.rangeTotals;
|
||||
const visibleModels = showAllModels ? models : models.slice(0, 8);
|
||||
|
||||
const onHeatmapCellDoubleClick = (cell: HeatmapCell) => {
|
||||
const row = daily.find((d) => d.date === cell.date);
|
||||
if (row) setHeatmapSelected(row);
|
||||
};
|
||||
|
||||
// Recent pagination
|
||||
const RECENT_PAGE_SIZE = 30;
|
||||
const recentTotal = data.stats.recentTotal;
|
||||
@@ -206,7 +221,7 @@ export function DashboardPage() {
|
||||
|
||||
{/* Heatmap — full row */}
|
||||
<Card title={t("cardHeatmap")} subtitle={t("cardHeatmapSub")}>
|
||||
<Heatmap heatmap={heatmap} />
|
||||
<Heatmap heatmap={heatmap} detailDates={detailDates} onCellDoubleClick={onHeatmapCellDoubleClick} />
|
||||
</Card>
|
||||
|
||||
{/* Usage-trend tabs + Model table side by side */}
|
||||
@@ -451,6 +466,19 @@ export function DashboardPage() {
|
||||
{data.meta.home}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Heatmap double-click detail modal */}
|
||||
{heatmapSelected &&
|
||||
createPortal(
|
||||
<DailyDetailModal
|
||||
day={heatmapSelected}
|
||||
dimension="model"
|
||||
colorMap={heatmapColorMap}
|
||||
unknownProviderLabel={t("providerUnknown")}
|
||||
onClose={() => setHeatmapSelected(null)}
|
||||
/>,
|
||||
document.body,
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -7,6 +7,10 @@ import type { HeatmapCell, HeatmapData } from "../../types/dashboard";
|
||||
|
||||
interface HeatmapProps {
|
||||
heatmap: HeatmapData;
|
||||
/** Set of dates (YYYY-MM-DD) that have detail data in the current range. */
|
||||
detailDates?: Set<string>;
|
||||
/** Called when a cell with detail data is double-clicked. */
|
||||
onCellDoubleClick?: (cell: HeatmapCell) => void;
|
||||
}
|
||||
|
||||
const LEVEL_BG = [
|
||||
@@ -30,7 +34,7 @@ interface HoverState {
|
||||
y: number;
|
||||
}
|
||||
|
||||
export function Heatmap({ heatmap }: HeatmapProps) {
|
||||
export function Heatmap({ heatmap, detailDates, onCellDoubleClick }: HeatmapProps) {
|
||||
const { t, lang } = useTranslation();
|
||||
const cells = heatmap?.cells || [];
|
||||
const monthLabels = heatmap?.monthLabels || [];
|
||||
@@ -172,6 +176,7 @@ export function Heatmap({ heatmap }: HeatmapProps) {
|
||||
);
|
||||
}
|
||||
const level = cell.level ?? 0;
|
||||
const hasDetail = detailDates ? detailDates.has(cell.date) : level > 0;
|
||||
return (
|
||||
<button
|
||||
key={cell.date}
|
||||
@@ -182,7 +187,8 @@ export function Heatmap({ heatmap }: HeatmapProps) {
|
||||
onMouseLeave={hideTooltip}
|
||||
onFocus={() => showTooltipFromFocus(cell)}
|
||||
onBlur={hideTooltip}
|
||||
className={`rounded-[3px] ring-1 ring-inset ring-white/5 transition-transform hover:scale-[1.35] focus:scale-[1.35] outline-none ${LEVEL_BG[level] || LEVEL_BG[0]}`}
|
||||
onDoubleClick={hasDetail && onCellDoubleClick ? () => onCellDoubleClick(cell) : undefined}
|
||||
className={`rounded-[3px] ring-1 ring-inset ring-white/5 transition-transform outline-none ${LEVEL_BG[level] || LEVEL_BG[0]} ${hasDetail && onCellDoubleClick ? "cursor-pointer hover:scale-[1.35] focus:scale-[1.35]" : "cursor-default"}`}
|
||||
style={{ width: CELL, height: CELL }}
|
||||
/>
|
||||
);
|
||||
|
||||
+3
-2
@@ -482,6 +482,7 @@ export const enTranslations: Record<TranslationKey, string> = {
|
||||
// Kimi Code WebUI quick open
|
||||
webuiSection: "Kimi Code WebUI",
|
||||
webuiDesc:
|
||||
"Launch `kimi web` to open the new Web UI in your browser (built into kimi-code 0.33+). Requires the kimi CLI on PATH.",
|
||||
openWebUI: "Open WebUI",
|
||||
"Open the new Web UI in an independent in-app window, or in your system browser (built into kimi-code 0.33+). Requires the kimi CLI on PATH.",
|
||||
openWebUIEmbedded: "Open in App",
|
||||
openWebUIBrowser: "Open in Browser",
|
||||
};
|
||||
+3
-2
@@ -477,8 +477,9 @@ export const zhTranslations = {
|
||||
// Kimi Code WebUI quick open
|
||||
webuiSection: "Kimi Code WebUI",
|
||||
webuiDesc:
|
||||
"启动 kimi web,在浏览器中打开新版 Web 界面(kimi-code 0.33+ 内置 code-app)。需要 kimi 命令在 PATH 中。",
|
||||
openWebUI: "打开 WebUI",
|
||||
"以独立窗口在应用内打开新版 Web 界面,也可以选择在系统浏览器打开(kimi-code 0.33+ 内置 code-app;需要 kimi 命令在 PATH 中)。",
|
||||
openWebUIEmbedded: "在应用内打开",
|
||||
openWebUIBrowser: "在浏览器打开",
|
||||
} as const;
|
||||
|
||||
export type TranslationKey = keyof typeof zhTranslations;
|
||||
+1343
-176
File diff suppressed because it is too large.
Load diff
+1138
-143
File diff suppressed because it is too large.
Load diff
@@ -13,7 +13,8 @@ export interface TotalsRow {
|
||||
|
||||
export interface DailyRow extends TotalsRow {
|
||||
date: string;
|
||||
byModel: Record<string, number>;
|
||||
/** Per-model structured breakdown (tokens / requests / cost / cacheHitRate). */
|
||||
byModel: Record<string, TotalsRow>;
|
||||
byProvider: Record<string, number>;
|
||||
byProviderModel: Record<string, Record<string, number>>;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { recommendLinks } from "../data/recommendLinks";
|
||||
import { useLang } from "../i18n";
|
||||
import { asset } from "../lib/asset";
|
||||
@@ -12,8 +13,62 @@ const logoFor: Record<string, string> = {
|
||||
"基元律动": "logos/tokenrhythm.svg",
|
||||
};
|
||||
|
||||
// 下载统计:只拉 GitHub(公开 API 带 CORS),镜像站 Gitea 未开 CORS 不计入。
|
||||
const STATS_URL =
|
||||
"https://api.github.com/repos/billowliu2/KimiSwitch/releases?per_page=100";
|
||||
const STATS_CACHE_KEY = "kimi-switch-downloads";
|
||||
const STATS_CACHE_TTL = 60 * 60 * 1000; // 1 hour
|
||||
|
||||
/** GitHub Release 全部资产 download_count 之和;拉取失败返回 null(不展示)。 */
|
||||
function useDownloadCount(): number | null {
|
||||
const [count, setCount] = useState<number | null>(null);
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
try {
|
||||
const cached = localStorage.getItem(STATS_CACHE_KEY);
|
||||
if (cached) {
|
||||
const { ts, total } = JSON.parse(cached) as { ts: number; total: number };
|
||||
if (Date.now() - ts < STATS_CACHE_TTL) {
|
||||
setCount(total);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
/* ignore corrupt cache */
|
||||
}
|
||||
fetch(STATS_URL)
|
||||
.then((r) => (r.ok ? r.json() : Promise.reject(new Error(String(r.status)))))
|
||||
.then((releases: Array<{ assets?: Array<{ download_count?: number }> }>) => {
|
||||
if (cancelled) return;
|
||||
const total = (releases ?? []).reduce(
|
||||
(sum, rel) =>
|
||||
sum +
|
||||
(rel.assets ?? []).reduce((s, a) => s + (a.download_count ?? 0), 0),
|
||||
0
|
||||
);
|
||||
setCount(total);
|
||||
try {
|
||||
localStorage.setItem(
|
||||
STATS_CACHE_KEY,
|
||||
JSON.stringify({ ts: Date.now(), total })
|
||||
);
|
||||
} catch {
|
||||
/* ignore quota errors */
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
/* 拉取失败则不显示 */
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, []);
|
||||
return count;
|
||||
}
|
||||
|
||||
export default function Footer() {
|
||||
const { t } = useLang();
|
||||
const downloadCount = useDownloadCount();
|
||||
return (
|
||||
<footer className="border-t border-border py-12">
|
||||
<div className="container-page space-y-8">
|
||||
@@ -86,6 +141,15 @@ export default function Footer() {
|
||||
{t.footer.mirror}
|
||||
</a>{" "}
|
||||
· MIT License
|
||||
{downloadCount !== null && (
|
||||
<>
|
||||
{" "}
|
||||
·{" "}
|
||||
<span className="opacity-60">
|
||||
{t.footer.downloads.replace("{n}", downloadCount.toLocaleString())}
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className="text-xs opacity-80">
|
||||
{t.footer.creditBefore}
|
||||
|
||||
+52
-6
@@ -16,10 +16,10 @@ const zh = {
|
||||
performance: "性能",
|
||||
changelog: "更新日志",
|
||||
download: "下载",
|
||||
downloadBtn: "下载 v0.7.2",
|
||||
downloadBtn: "下载 v0.7.4",
|
||||
},
|
||||
hero: {
|
||||
badge: "v0.7.2 · 开源 MIT · Windows / macOS / Linux",
|
||||
badge: "v0.7.4 · 开源 MIT · Windows / macOS / Linux",
|
||||
titleBefore: "统一管理你的",
|
||||
titleAccent: "AI 供应商",
|
||||
titleAfter: "",
|
||||
@@ -140,12 +140,34 @@ const zh = {
|
||||
syncedNote: "数据已同步 GitHub Releases",
|
||||
fallbackNote: "内置版本记录",
|
||||
entries: [
|
||||
{
|
||||
version: "v0.7.4",
|
||||
date: "2026-08-09",
|
||||
items: [
|
||||
"仪表盘热力图双击弹窗:双击方块查看当日模型用量分布,每种模型展示 Token / 请求次数 / 费用 / 命中率",
|
||||
"后端 by_model 数据结构升级:从纯 token 数升级为结构化对象,柱状图双击弹窗也同步展示全量指标",
|
||||
"范围外日期不可双击、无放大效果",
|
||||
],
|
||||
},
|
||||
{
|
||||
version: "v0.7.3",
|
||||
date: "2026-08-07",
|
||||
items: [
|
||||
"高级设置新增 Kimi Code WebUI 应用内嵌窗口:新版 Web 界面以独立顶层窗口打开(单例、可缩放、居中),不再跳转外部浏览器",
|
||||
"WebUI 两个入口并存:应用内独立窗口 / 系统浏览器(复用已运行的 kimi web 服务器,不重复拉起)",
|
||||
"服务器进程自动管理:自己启动的服务器随窗口关闭/应用退出清理,不留残留;窗口创建失败不再泄漏进程",
|
||||
"最小化窗口再次打开可恢复;发布说明文案同步更新",
|
||||
],
|
||||
},
|
||||
{
|
||||
version: "v0.7.2",
|
||||
date: "2026-08-07",
|
||||
items: [
|
||||
"「子代理设置」升级为「高级设置」:聚合子代理模型指定、实验功能开关与 WebUI 快捷入口",
|
||||
"新增 Kimi Code WebUI 快捷打开:高级设置页可将新版 Web 界面以独立窗口在应用内打开,也可在系统浏览器打开(kimi-code 0.33+)",
|
||||
"子代理模型指定(实验功能):设置中为子代理选择次主力模型,子代理不再默认继承主模型",
|
||||
"实验开关改为滑动开关,修复开启态因样式缺失而不可见的问题",
|
||||
"兼容 kimi-code 0.33+(v2 引擎):循环控制改用新键 max_attempts_per_step,旧配置自动迁移",
|
||||
"models.dev 模型列表与价格数据同步更新",
|
||||
"官网企业版视觉升级;出品公司标识统一为 codingplan.site",
|
||||
"macOS 安装优化:Release 附带 install-macos.sh 一键脚本,自动清除下载隔离,免去手动右键打开",
|
||||
@@ -289,7 +311,7 @@ const zh = {
|
||||
},
|
||||
download: {
|
||||
title: "下载 Kimi Switch",
|
||||
subtitle: "当前版本 v0.7.2 · Windows / macOS / Linux 三平台已发布",
|
||||
subtitle: "当前版本 v0.7.4 · Windows / macOS / Linux 三平台已发布",
|
||||
autoUpdate: "应用内置自动检测更新,新版本发布后在设置页一键升级。",
|
||||
ready: "已发布",
|
||||
wip: "开发中",
|
||||
@@ -332,6 +354,7 @@ const zh = {
|
||||
footer: {
|
||||
recommend: "推荐供应商",
|
||||
mirror: "国内镜像",
|
||||
downloads: "GitHub 累计下载 {n} 次",
|
||||
creditBefore: "仪表盘与会话管理功能基于 ",
|
||||
creditAfter: " (MIT, © JochenYang) 移植",
|
||||
recommendText: {
|
||||
@@ -357,10 +380,10 @@ const en: Dict = {
|
||||
performance: "Performance",
|
||||
changelog: "Changelog",
|
||||
download: "Download",
|
||||
downloadBtn: "Download v0.7.2",
|
||||
downloadBtn: "Download v0.7.4",
|
||||
},
|
||||
hero: {
|
||||
badge: "v0.7.2 · Open source MIT · Windows / macOS / Linux",
|
||||
badge: "v0.7.4 · Open source MIT · Windows / macOS / Linux",
|
||||
titleBefore: "One app for all your ",
|
||||
titleAccent: "AI providers",
|
||||
titleAfter: "",
|
||||
@@ -481,12 +504,34 @@ const en: Dict = {
|
||||
syncedNote: "Synced from GitHub Releases",
|
||||
fallbackNote: "Built-in release notes",
|
||||
entries: [
|
||||
{
|
||||
version: "v0.7.4",
|
||||
date: "2026-08-09",
|
||||
items: [
|
||||
"Dashboard heatmap double-click: click any heatmap cell to see per-model breakdown with Token / requests / cost / cache hit rate",
|
||||
"Backend by_model data structure upgraded from plain token counts to structured objects; bar chart double-click modal also shows full metrics",
|
||||
"Out-of-range dates are not double-clickable and have no hover zoom",
|
||||
],
|
||||
},
|
||||
{
|
||||
version: "v0.7.3",
|
||||
date: "2026-08-07",
|
||||
items: [
|
||||
"Advanced Settings gains an embedded Kimi Code WebUI window: the new Web UI opens in an independent top-level window (singleton, resizable, centered) instead of the external browser",
|
||||
"Two WebUI entries coexist: in-app independent window / system browser (reuses an already-running kimi web server, no duplicate spawn)",
|
||||
"Server process is managed automatically: servers we start are cleaned up when the window closes or the app exits; a failed window creation no longer leaks the process",
|
||||
"Re-opening focuses and restores a minimized window; release notes wording synced",
|
||||
],
|
||||
},
|
||||
{
|
||||
version: "v0.7.2",
|
||||
date: "2026-08-07",
|
||||
items: [
|
||||
"Subagent settings upgraded to an Advanced Settings page: subagent model assignment, experimental toggles and a WebUI quick launcher",
|
||||
"New Kimi Code WebUI quick open: open the new Web UI in an independent in-app window from Advanced Settings, or in your system browser (kimi-code 0.33+)",
|
||||
"Subagent model assignment (experimental): pick a secondary model for subagents so they no longer inherit the main model by default",
|
||||
"Experiment toggle converted to a sliding switch, fixing the invisible enabled state",
|
||||
"Compatible with kimi-code 0.33+ (v2 engine): loop control now writes max_attempts_per_step with auto-migration",
|
||||
"models.dev model list and pricing snapshot synced",
|
||||
"Enterprise-style website refresh; publisher identity unified as codingplan.site",
|
||||
"macOS install polish: releases now ship install-macos.sh, a one-click script that clears the download quarantine",
|
||||
@@ -629,7 +674,7 @@ const en: Dict = {
|
||||
},
|
||||
download: {
|
||||
title: "Download Kimi Switch",
|
||||
subtitle: "Current version v0.7.2 · Windows, macOS and Linux now released",
|
||||
subtitle: "Current version v0.7.4 · Windows, macOS and Linux now released",
|
||||
autoUpdate: "Built-in update detection: upgrade in one click from Settings when a new version ships.",
|
||||
ready: "Available",
|
||||
wip: "In development",
|
||||
@@ -672,6 +717,7 @@ const en: Dict = {
|
||||
footer: {
|
||||
recommend: "Recommended Providers",
|
||||
mirror: "China mirror",
|
||||
downloads: "Total GitHub downloads: {n}",
|
||||
creditBefore: "Dashboard & session management adapted from ",
|
||||
creditAfter: " (MIT, © JochenYang)",
|
||||
recommendText: {
|
||||
|
||||
@@ -8,27 +8,27 @@ const icons: Record<string, Icon> = {
|
||||
linux: LinuxLogo,
|
||||
};
|
||||
|
||||
const VERSION = "0.7.2";
|
||||
const VERSION = "0.7.4";
|
||||
const GITHUB = "https://github.com/billowliu2/KimiSwitch";
|
||||
const MIRROR_RELEASES = "https://git.codingplan.site/admin/KimiCodeSwitch/releases";
|
||||
const dl = (file: string) => `${GITHUB}/releases/download/v${VERSION}/${file}`;
|
||||
|
||||
/** Per-platform download assets for the current release (names match the CI
|
||||
* release workflow. NOTE: tauri-bundler keeps the productName verbatim, so the
|
||||
* real asset is "Kimi Switch_0.7.2_…" (space), URL-encoded as %20. */
|
||||
* release workflow exactly — verified against the published v0.7.4 assets:
|
||||
* tauri-bundler on CI produces `Kimi.Switch_…` (dots) on every platform). */
|
||||
const assets: Record<string, { label: string; href: string }[]> = {
|
||||
windows: [
|
||||
{ label: "MSI", href: dl("Kimi%20Switch_0.7.2_x64_en-US.msi") },
|
||||
{ label: "MSI", href: dl("Kimi.Switch_0.7.4_x64_en-US.msi") },
|
||||
{ label: "镜像", href: MIRROR_RELEASES },
|
||||
],
|
||||
macos: [
|
||||
{ label: "Apple Silicon (.dmg)", href: dl("Kimi%20Switch_0.7.2_aarch64.dmg") },
|
||||
{ label: "Apple Silicon (.dmg)", href: dl("Kimi.Switch_0.7.4_aarch64.dmg") },
|
||||
{ label: "安装脚本", href: dl("install-macos.sh") },
|
||||
],
|
||||
linux: [
|
||||
{ label: ".deb", href: dl("Kimi%20Switch_0.7.2_amd64.deb") },
|
||||
{ label: ".AppImage", href: dl("Kimi%20Switch_0.7.2_amd64.AppImage") },
|
||||
{ label: ".rpm", href: dl("Kimi%20Switch-0.7.2-1.x86_64.rpm") },
|
||||
{ label: ".deb", href: dl("Kimi.Switch_0.7.4_amd64.deb") },
|
||||
{ label: ".AppImage", href: dl("Kimi.Switch_0.7.4_amd64.AppImage") },
|
||||
{ label: ".rpm", href: dl("Kimi.Switch-0.7.4-1.x86_64.rpm") },
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user