mirror of
https://github.com/anomalyco/opencode.git
synced 2026-02-01 22:48:16 +00:00
Add Array.isArray check before .join()
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
@@ -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(", ")
|
||||
}
|
||||
|
||||
|
||||
@@ -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(", ")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user