fix: validate prompt API payloads

Fixes #11
This commit is contained in:
Federico Jaramillo Martinez
2026-06-05 11:09:15 +02:00
parent 3330a5a7fa
commit 82ba2e0490
7 changed files with 110 additions and 9 deletions
+3 -1
View File
@@ -43,7 +43,9 @@ export async function generateShortSessionName<TApi extends Api>(modelRegistry:
return cleanSessionName(finalMessage === undefined ? streamedText : textFromAssistant(finalMessage));
}
export function fallbackSessionName(firstMessage: string): string | undefined {
export function fallbackSessionName(firstMessage: unknown): string | undefined {
if (typeof firstMessage !== "string") return undefined;
return cleanSessionName(firstMessage
.replace(/<skill name="[^"]+" location="[^"]+">[\s\S]*?<\/skill>/g, "")
.replace(/```[\s\S]*?```/g, " ")