chore: initial commit
Laimiao agent v2 service: agent orchestration, sessions, billing, gateway client, skills catalog, auth, config, plus tests.
This commit is contained in:
commit
6ec9778d45
53 files changed
+12340
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildSystemPrompts } from "../src/agent/prompt.js";
|
||||
import { makeCatalog, skillFixture, tempRoot, testConfig } from "./helpers.js";
|
||||
|
||||
describe("system prompts", () => {
|
||||
it("uses direct mode when no skill is selected", async () => {
|
||||
const catalog = await makeCatalog([
|
||||
skillFixture({ key: "poster", content: "# Poster\n\nUse poster rules." }),
|
||||
]);
|
||||
const prompts = buildSystemPrompts(catalog, testConfig(tempRoot()));
|
||||
const text = [prompts.systemPrompt, ...prompts.appendSystemPrompt].join("\n");
|
||||
expect(text).toContain("直接生成模式");
|
||||
expect(text).toContain("普通直接生成不要读取技能规范");
|
||||
expect(text).toContain("省略 skill_id");
|
||||
expect(text).toContain("confirm_travel_style");
|
||||
expect(text).not.toContain("Use poster rules");
|
||||
expect(text).not.toContain("skill_id: poster");
|
||||
});
|
||||
|
||||
it("injects only the selected skill spec", async () => {
|
||||
const catalog = await makeCatalog([
|
||||
skillFixture({ key: "poster", content: "# Poster\n\nUse poster rules." }),
|
||||
skillFixture({ key: "other", content: "# Other\n\nUse other rules." }),
|
||||
]);
|
||||
const skill = catalog.get("poster");
|
||||
if (!skill) throw new Error("missing fixture");
|
||||
|
||||
const prompts = buildSystemPrompts(catalog, testConfig(tempRoot()), skill);
|
||||
const text = [prompts.systemPrompt, ...prompts.appendSystemPrompt].join("\n");
|
||||
expect(text).toContain("skill_id: poster");
|
||||
expect(text).toContain("Test skill poster");
|
||||
expect(text).toContain("Use poster rules");
|
||||
expect(text).not.toContain("Use other rules");
|
||||
expect(text).not.toContain("直接生成模式");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user