Skip to content

Commit c6d1de6

Browse files
committed
Switch cases wrapped in blocks
1 parent ed058eb commit c6d1de6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.query.ai-generate.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,24 +112,27 @@ export async function action({ request, params }: ActionFunctionArgs) {
112112
// Process the stream
113113
for await (const part of result.fullStream) {
114114
switch (part.type) {
115-
case "text-delta":
115+
case "text-delta": {
116116
sendEvent({ type: "thinking", content: part.textDelta });
117117
break;
118-
case "tool-call":
118+
}
119+
case "tool-call": {
119120
sendEvent({
120121
type: "tool_call",
121122
tool: part.toolName,
122123
args: part.args,
123124
});
124125
break;
125-
case "error":
126+
}
127+
case "error": {
126128
sendEvent({
127129
type: "result",
128130
success: false,
129131
error: part.error instanceof Error ? part.error.message : String(part.error),
130132
});
131133
break;
132-
case "finish":
134+
}
135+
case "finish": {
133136
// Extract query from the final text
134137
const finalText = await result.text;
135138
const query = extractQueryFromText(finalText);
@@ -157,6 +160,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
157160
});
158161
}
159162
break;
163+
}
160164
}
161165
}
162166
} catch (error) {

0 commit comments

Comments
 (0)