83 lines
3.3 KiB
JavaScript
83 lines
3.3 KiB
JavaScript
// Probe lt-fl (platform.lantian.pro) models: thinking / vision / developer-role / max_tokens cap.
|
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
|
|
const KEY = "sk-yXtdmUJNnJQKHPKhZGsDrTgbQtg46choVzfqueBnIyuXMybB";
|
|
const BASE = "https://platform.lantian.pro/v1";
|
|
const B64 = readFileSync("C:/Users/12914/Desktop/vscode/.mimo2codex-audit/red64.png").toString("base64");
|
|
const MODELS = ["glm-5.3-flash", "qwen3.8-flash"];
|
|
|
|
async function call(model, extra = {}, messages = null, maxTokens = 900) {
|
|
const body = {
|
|
model,
|
|
messages: messages ?? [{ role: "user", content: "只回答一个数字:2+3=?" }],
|
|
max_tokens: maxTokens,
|
|
stream: false,
|
|
...extra,
|
|
};
|
|
const started = Date.now();
|
|
const res = await fetch(`${BASE}/chat/completions`, {
|
|
method: "POST",
|
|
headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json" },
|
|
body: JSON.stringify(body),
|
|
});
|
|
const ms = Date.now() - started;
|
|
const raw = await res.text();
|
|
let json = null;
|
|
try { json = JSON.parse(raw); } catch {}
|
|
return { status: res.status, ms, json, raw: raw.slice(0, 260) };
|
|
}
|
|
|
|
function reasoningKind(json) {
|
|
const m = json?.choices?.[0]?.message;
|
|
if (!m) return null;
|
|
if (typeof m.reasoning_content === "string" && m.reasoning_content.trim()) return "reasoning_content";
|
|
if (typeof m.reasoning === "string" && m.reasoning.trim()) return "reasoning";
|
|
if (typeof m.content === "string" && /<think>/i.test(m.content)) return "think_tags";
|
|
return null;
|
|
}
|
|
const err = (r) => r.json?.error?.message?.slice(0, 180) ?? (r.status !== 200 ? r.raw : null);
|
|
|
|
const results = {};
|
|
for (const model of MODELS) {
|
|
const out = {};
|
|
// baseline
|
|
const p0 = await call(model);
|
|
out.baseline = { status: p0.status, content: p0.json?.choices?.[0]?.message?.content?.slice(0, 60) ?? null, err: err(p0) };
|
|
// thinking variants
|
|
for (const [name, extra] of [
|
|
["enable_thinking", { enable_thinking: true }],
|
|
["thinking_type", { thinking: { type: "enabled" } }],
|
|
["reasoning_effort_high", { reasoning_effort: "high" }],
|
|
]) {
|
|
const r = await call(model, extra);
|
|
out[name] = { status: r.status, reasoning: r.json ? reasoningKind(r.json) : null, err: err(r) };
|
|
}
|
|
// vision
|
|
const v = await call(model, {}, [{
|
|
role: "user",
|
|
content: [
|
|
{ type: "text", text: "这张图片是什么颜色?只回答颜色词。" },
|
|
{ type: "image_url", image_url: { url: `data:image/png;base64,${B64}` } },
|
|
],
|
|
}], 400);
|
|
out.vision = {
|
|
status: v.status,
|
|
answer: v.json?.choices?.[0]?.message?.content?.slice(0, 60) ?? null,
|
|
err: err(v),
|
|
};
|
|
// developer role
|
|
const d = await call(model, {}, [
|
|
{ role: "developer", content: "You are a helpful assistant." },
|
|
{ role: "user", content: "只回答一个数字:1+1=?" },
|
|
], 200);
|
|
out.developer_role = { status: d.status, content: d.json?.choices?.[0]?.message?.content?.slice(0, 40) ?? null, err: err(d) };
|
|
// max_tokens ceiling probe
|
|
const big = await call(model, {}, [{ role: "user", content: "只回答一个数字:9+9=?" }], 131072);
|
|
out.max_tokens_131072 = { status: big.status, err: err(big) };
|
|
results[model] = out;
|
|
writeFileSync("C:/Users/12914/Desktop/vscode/.mimo2codex-audit/lt-fl-probe.json", JSON.stringify(results, null, 2));
|
|
console.log(`--- ${model} ---`);
|
|
console.log(JSON.stringify(out, null, 2));
|
|
}
|
|
console.log("DONE");
|