mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 00:14:34 +00:00
refactor: dedupe agent and browser cli helpers
This commit is contained in:
24
src/agents/live-test-helpers.ts
Normal file
24
src/agents/live-test-helpers.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
export const LIVE_OK_PROMPT = "Reply with the word ok.";
|
||||
|
||||
export function createSingleUserPromptMessage(content = LIVE_OK_PROMPT) {
|
||||
return [
|
||||
{
|
||||
role: "user" as const,
|
||||
content,
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export function extractNonEmptyAssistantText(
|
||||
content: Array<{
|
||||
type?: string;
|
||||
text?: string;
|
||||
}>,
|
||||
) {
|
||||
return content
|
||||
.filter((block) => block.type === "text")
|
||||
.map((block) => block.text?.trim() ?? "")
|
||||
.filter(Boolean)
|
||||
.join(" ");
|
||||
}
|
||||
Reference in New Issue
Block a user