fix(feishu): preserve per-chat model state
This commit is contained in:
@@ -12,8 +12,10 @@ import {
|
||||
parseCommand,
|
||||
parseList,
|
||||
parseTextContent,
|
||||
preservedChatStateFields,
|
||||
splitMessage,
|
||||
stripGroupPrefix,
|
||||
helpText,
|
||||
validateBridgeConfig
|
||||
} from "../src/lib.mjs";
|
||||
|
||||
@@ -89,12 +91,36 @@ test("commandAction maps bridge commands and falls back to prompts", () => {
|
||||
kind: "resume",
|
||||
threadId: "thread-1"
|
||||
});
|
||||
assert.deepEqual(commandAction(parseCommand("/model deepseek-v4-pro")), {
|
||||
kind: "set_model",
|
||||
modelName: "deepseek-v4-pro"
|
||||
});
|
||||
assert.deepEqual(commandAction(parseCommand("/unknown value")), {
|
||||
kind: "prompt",
|
||||
prompt: "/unknown value"
|
||||
});
|
||||
});
|
||||
|
||||
test("helpText documents per-chat model switching", () => {
|
||||
assert.match(helpText(), /\/model <name\|default>/);
|
||||
});
|
||||
|
||||
test("preservedChatStateFields carries model across state replacement", () => {
|
||||
assert.deepEqual(
|
||||
preservedChatStateFields({
|
||||
threadId: "old-thread",
|
||||
model: "deepseek-v4-flash",
|
||||
replyToMessageId: "om_123",
|
||||
activeTurnId: "turn-1"
|
||||
}),
|
||||
{
|
||||
model: "deepseek-v4-flash",
|
||||
replyToMessageId: "om_123"
|
||||
}
|
||||
);
|
||||
assert.deepEqual(preservedChatStateFields({ model: null }), { model: null });
|
||||
});
|
||||
|
||||
test("parseApprovalDecisionArgs extracts remember flag", () => {
|
||||
assert.deepEqual(parseApprovalDecisionArgs("ap_123 remember"), {
|
||||
approvalId: "ap_123",
|
||||
|
||||
Reference in New Issue
Block a user