Skip to content

Commit f96b2ca

Browse files
Shawclaude
andcommitted
fix(app-lifeops): handle new-line prompt format in deterministic LLM helper
Calendar action changed prompt format from `Current request: ${JSON.stringify(msg)}` to `Current request:\n${msg}`. Add parseNextLineField to extract the value from the following line, and wire it into currentRequest() alongside the existing JSON-line parser. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d606f8f commit f96b2ca

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

plugins/app-lifeops/test/helpers/lifeops-deterministic-llm.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,23 @@ function parseXmlField(prompt: string, tagName: string): string {
6969
return match?.[1]?.trim() ?? "";
7070
}
7171

72+
function parseNextLineField(prompt: string, label: string): string {
73+
const lines = prompt.split("\n");
74+
for (let i = 0; i < lines.length - 1; i++) {
75+
if (lines[i].trim() === `${label}:`) {
76+
return lines[i + 1].trim();
77+
}
78+
}
79+
return "";
80+
}
81+
7282
function currentRequest(prompt: string): string {
7383
return (
7484
parseXmlField(prompt, "current_request") ||
7585
parseJsonLineField(prompt, "Current request") ||
86+
parseNextLineField(prompt, "Current request") ||
7687
parseJsonLineField(prompt, "User request") ||
88+
parseNextLineField(prompt, "User request") ||
7789
parseJsonLineField(prompt, "User said")
7890
);
7991
}

0 commit comments

Comments
 (0)