(snippets = [])
| 4703 | } |
| 4704 | |
| 4705 | function inferDesktopTopicQuery(snippets = []) { |
| 4706 | const answer = [...snippets].reverse().find((snippet) => isCompletedSnippet(snippet)); |
| 4707 | if (answer?.text) return answer.text.slice(0, 180); |
| 4708 | const user = [...snippets].reverse().find((snippet) => ( |
| 4709 | snippet.role === "user" |
| 4710 | && !isLowValueTopicText(snippet.text) |
| 4711 | && textInformationSignal(snippet.text).units > 6 |
| 4712 | )); |
| 4713 | return user?.text?.slice(0, 120) || ""; |
| 4714 | } |
| 4715 | |
| 4716 | function isCompletedSnippet(snippet) { |
| 4717 | return snippet?.completed === true || ["final_answer", "task_complete"].includes(String(snippet?.phase || "")); |
no test coverage detected