17
*/
18
export function buildUserInputRequest(requestId: string, questions: readonly ToolRequestUserInputQuestion[]): ChatInputRequest {
20
>
id: requestId,
21
>
questions: questions.map((q): ChatInputQuestion => {
22
>
if (q.options && q.options.length > 0) {
23
>
return {
24
>
kind: ChatInputQuestionKind.SingleSelect,
25
>
id: q.id,
26
>
title: q.header,
27
>
message: q.question,
28
>
required: true,
29
>
options: q.options.map(o => ({ id: o.label, label: o.label, description: o.description || undefined })),
30
>
allowFreeformInput: q.isOther,
31
>
};
32
>
}
33
>
return {
34
>
kind: ChatInputQuestionKind.Text,
35
>
id: q.id,
36
>
title: q.header,
37
>
message: q.question,
38
>
required: true,
39
>
};
40
>
}),
41
>
};
42
>
}
43
44
/**