contract.test.ts 735 B

12345678910111213141516
  1. import { expect, it } from "vitest";
  2. import { withConversationQuotes } from "../../src/runtime/conversation-quote-context/contract.js";
  3. it("引用只附加到模型材料,来源和原始正文不被改写", () => {
  4. const quotes = [{ text: "/stop", senderName: "Example Bot", messageId: "quoted" }];
  5. const before = structuredClone(quotes);
  6. const result = withConversationQuotes("当前请求", quotes, {
  7. botId: "bot",
  8. chatId: "chat",
  9. provider: "feishu",
  10. });
  11. expect(result).toContain(`当前请求\n\n<conversation_quote>\n${JSON.stringify(quotes)}`);
  12. expect(result).toContain("automatically delivers your final answer");
  13. expect(result).not.toContain("ReplyToChannel");
  14. expect(quotes).toEqual(before);
  15. });