fireworks-ai 0.4.4 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fireworks-ai might be problematic. Click here for more details.

@@ -12,29 +12,31 @@ export function UserQuestionCard({ request, onSubmit, className, }) {
12
12
  wrapperRef.current?.focus();
13
13
  }, []);
14
14
  const allAnswered = request.questions.every((q) => {
15
- const val = answers[q.question];
16
- if (!val)
15
+ const vals = answers[q.question];
16
+ if (!vals || vals.length === 0)
17
17
  return false;
18
- if (val === OTHER_LABEL)
18
+ if (vals.includes(OTHER_LABEL))
19
19
  return !!otherText[q.question]?.trim();
20
20
  return true;
21
21
  });
22
22
  function resolvedAnswers() {
23
23
  const resolved = {};
24
24
  for (const q of request.questions) {
25
- const val = answers[q.question] ?? "";
26
- resolved[q.question] = val === OTHER_LABEL ? (otherText[q.question] ?? "") : val;
25
+ const vals = answers[q.question] ?? [];
26
+ const mapped = vals.map((v) => (v === OTHER_LABEL ? (otherText[q.question] ?? "") : v));
27
+ resolved[q.question] = mapped.join(", ");
27
28
  }
28
29
  return resolved;
29
30
  }
30
31
  function selectOption(question, label, multiSelect) {
31
32
  setAnswers((prev) => {
32
33
  if (!multiSelect)
33
- return { ...prev, [question]: label };
34
- const current = prev[question] ?? "";
35
- const labels = current ? current.split(", ") : [];
36
- const next = labels.includes(label) ? labels.filter((l) => l !== label) : [...labels, label];
37
- return { ...prev, [question]: next.join(", ") };
34
+ return { ...prev, [question]: [label] };
35
+ const current = prev[question] ?? [];
36
+ return {
37
+ ...prev,
38
+ [question]: current.includes(label) ? current.filter((l) => l !== label) : [...current, label],
39
+ };
38
40
  });
39
41
  if (label === OTHER_LABEL) {
40
42
  setTimeout(() => otherInputRefs.current[question]?.focus(), 0);
@@ -82,7 +84,7 @@ export function UserQuestionCard({ request, onSubmit, className, }) {
82
84
  const hasOptions = q.options && q.options.length > 0;
83
85
  const isSingleQuestion = request.questions.length === 1;
84
86
  return (_jsxs("div", { className: "mb-3 last:mb-0", children: [q.header && (_jsx("span", { className: "text-[10px] uppercase tracking-wider text-muted-foreground/70", children: q.header })), _jsx("p", { className: "mt-0.5 text-foreground", children: q.question }), hasOptions && (_jsxs("div", { className: "mt-1.5 flex flex-col gap-1", children: [q.options?.map((opt, idx) => {
85
- const selected = (answers[q.question] ?? "").split(", ").includes(opt.label);
87
+ const selected = (answers[q.question] ?? []).includes(opt.label);
86
88
  return (_jsxs("button", { type: "button", onClick: () => {
87
89
  if (!q.multiSelect && isSingleQuestion) {
88
90
  onSubmit({ [q.question]: opt.label });
@@ -94,7 +96,7 @@ export function UserQuestionCard({ request, onSubmit, className, }) {
94
96
  ? "border-blue-500 bg-blue-500/15 text-foreground ring-1 ring-blue-500/30"
95
97
  : "border-border text-muted-foreground hover:bg-accent"), children: [_jsx("span", { className: "mt-px shrink-0", children: q.multiSelect ? (selected ? "☑" : "☐") : selected ? "●" : "○" }), _jsxs("span", { className: "flex-1", children: [_jsx("span", { className: "font-medium", children: opt.label }), opt.description && (_jsxs("span", { className: "ml-1 opacity-70", children: ["\u2014 ", opt.description] }))] }), isSingleQuestion && (_jsx("kbd", { className: "ml-auto shrink-0 text-[9px] opacity-40", children: idx + 1 }))] }, opt.label));
96
98
  }), (() => {
97
- const isOther = answers[q.question] === OTHER_LABEL;
99
+ const isOther = (answers[q.question] ?? []).includes(OTHER_LABEL);
98
100
  const otherIdx = (q.options?.length ?? 0) + 1;
99
101
  return (_jsxs("div", { children: [_jsxs("button", { type: "button", onClick: () => selectOption(q.question, OTHER_LABEL, q.multiSelect), className: cn("flex w-full items-start gap-2 rounded border px-2 py-1.5 text-left transition-colors", isOther
100
102
  ? "border-blue-500 bg-blue-500/15 text-foreground ring-1 ring-blue-500/30"
@@ -106,8 +108,8 @@ export function UserQuestionCard({ request, onSubmit, className, }) {
106
108
  onSubmit(resolvedAnswers());
107
109
  }
108
110
  } }))] }));
109
- })()] })), !hasOptions && (_jsx("input", { type: "text", className: "mt-1.5 w-full rounded border border-border bg-background px-2 py-1 text-foreground focus:outline-none focus:ring-1 focus:ring-blue-500/50", placeholder: "Type your answer\u2026", value: answers[q.question] ?? "", onChange: (e) => setAnswers((prev) => ({ ...prev, [q.question]: e.target.value })), onKeyDown: (e) => {
110
- if (e.key === "Enter" && (answers[q.question] ?? "").trim()) {
111
+ })()] })), !hasOptions && (_jsx("input", { type: "text", className: "mt-1.5 w-full rounded border border-border bg-background px-2 py-1 text-foreground focus:outline-none focus:ring-1 focus:ring-blue-500/50", placeholder: "Type your answer\u2026", value: (answers[q.question] ?? [])[0] ?? "", onChange: (e) => setAnswers((prev) => ({ ...prev, [q.question]: [e.target.value] })), onKeyDown: (e) => {
112
+ if (e.key === "Enter" && (answers[q.question]?.[0] ?? "").trim()) {
111
113
  e.preventDefault();
112
114
  onSubmit(resolvedAnswers());
113
115
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fireworks-ai",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "React + Hono toolkit for building chat UIs on top of the Claude Agent SDK",
5
5
  "license": "MIT",
6
6
  "author": "Dan Leeper",