Add Array.isArray check before .join()

Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
opencode-agent[bot]
2026-01-09 00:16:52 +00:00
parent cf97633d7d
commit dda116584b
2 changed files with 4 additions and 2 deletions

View File

@@ -1841,8 +1841,9 @@ function Question(props: ToolProps<typeof QuestionTool>) {
const { theme } = useTheme()
const count = createMemo(() => props.input.questions?.length ?? 0)
function format(answer?: string[]) {
function format(answer?: string[] | string) {
if (!answer?.length) return "(no answer)"
if (!Array.isArray(answer)) return String(answer)
return answer.join(", ")
}

View File

@@ -15,8 +15,9 @@ export const QuestionTool = Tool.define("question", {
tool: ctx.callID ? { messageID: ctx.messageID, callID: ctx.callID } : undefined,
})
function format(answer: Question.Answer | undefined) {
function format(answer: Question.Answer | string | undefined) {
if (!answer?.length) return "Unanswered"
if (!Array.isArray(answer)) return String(answer)
return answer.join(", ")
}