mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 21:14:31 +00:00
fix: split telegram reasoning and answer draft streams (#20774)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 7458444144
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
This commit is contained in:
25
src/telegram/reasoning-lane-coordinator.test.ts
Normal file
25
src/telegram/reasoning-lane-coordinator.test.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { splitTelegramReasoningText } from "./reasoning-lane-coordinator.js";
|
||||
|
||||
describe("splitTelegramReasoningText", () => {
|
||||
it("splits real tagged reasoning and answer", () => {
|
||||
expect(splitTelegramReasoningText("<think>example</think>Done")).toEqual({
|
||||
reasoningText: "Reasoning:\n_example_",
|
||||
answerText: "Done",
|
||||
});
|
||||
});
|
||||
|
||||
it("ignores literal think tags inside inline code", () => {
|
||||
const text = "Use `<think>example</think>` literally.";
|
||||
expect(splitTelegramReasoningText(text)).toEqual({
|
||||
answerText: text,
|
||||
});
|
||||
});
|
||||
|
||||
it("ignores literal think tags inside fenced code", () => {
|
||||
const text = "```xml\n<think>example</think>\n```";
|
||||
expect(splitTelegramReasoningText(text)).toEqual({
|
||||
answerText: text,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user