import "dotenv/config"; import { invokeLLM } from "../server/_core/llm"; async function main() { const prompt = process.argv.slice(2).join(" ").trim() || "你好,做个自我介绍"; const result = await invokeLLM({ messages: [{ role: "user", content: prompt }], }); const firstChoice = result.choices[0]; const content = firstChoice?.message?.content; console.log(`model=${result.model}`); console.log(`finish_reason=${firstChoice?.finish_reason ?? "unknown"}`); if (typeof content === "string") { console.log(content); return; } console.log(JSON.stringify(content, null, 2)); } main().catch(error => { console.error("[LLM smoke test] failed"); console.error(error); process.exit(1); });