Skip to content

Commit

Permalink
fix: fixed TS error and logic for gathering prompt response (#3410)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickytonline committed May 16, 2024
1 parent f7d8ac6 commit 36d26c2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pages/star-search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,15 @@ export default function StarSearchPage({ userId, bearerToken, ogImageUrl }: Star
const { done, value } = await reader!.read();
if (done) {
setIsRunning(false); // enables input
const textChat = chat.filter((item) => typeof item.content === "string");
registerPrompt({
promptContent: prompt,
promptResponse: chat[chat.length - 1]?.content || "No response captured",
promptResponse:
chat
.slice(1)
// There can be multiple responses because of widgets, so we need to serialize the widget data
.map((c) => (typeof c.content === "string" ? c.content : JSON.stringify(c.content)))
.join("\n") || "No response captured",
});
return;
}
Expand Down

0 comments on commit 36d26c2

Please sign in to comment.