Skip to content

Commit 3935f7e

Browse files
committed
fix: a11y label on expand button, try-catch request.json, add missing type field
1 parent 37e3367 commit 3935f7e

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

apps/webapp/app/components/runs/v3/ai/AIChatMessages.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ function SystemSection({
114114
variant="minimal/small"
115115
onClick={() => setExpanded(!expanded)}
116116
LeadingIcon={expanded ? ChevronUpIcon : ChevronDownIcon}
117+
aria-label={expanded ? "Collapse" : "Expand"}
118+
aria-expanded={expanded}
117119
/>
118120
)}
119121
</div>

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.prompts.$promptSlug/route.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,7 @@ type GenerationRow = {
11481148
operation_id: string;
11491149
task_identifier: string;
11501150
response_model: string;
1151+
prompt_version: number;
11511152
input_tokens: number;
11521153
output_tokens: number;
11531154
total_cost: number;

apps/webapp/app/routes/api.v1.prompts.$slug.override.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ export async function action({ request, params }: ActionFunctionArgs) {
6161
const service = new PromptService();
6262

6363
if (method === "POST") {
64-
const rawBody = await request.json();
64+
let rawBody: unknown;
65+
try {
66+
rawBody = await request.json();
67+
} catch {
68+
return apiCors(request, json({ error: "Invalid JSON" }, { status: 400 }));
69+
}
6570
const parsed = CreateBody.safeParse(rawBody);
6671
if (!parsed.success) {
6772
return apiCors(
@@ -81,7 +86,12 @@ export async function action({ request, params }: ActionFunctionArgs) {
8186
}
8287

8388
if (method === "PUT" || method === "PATCH") {
84-
const rawBody = await request.json();
89+
let rawBody: unknown;
90+
try {
91+
rawBody = await request.json();
92+
} catch {
93+
return apiCors(request, json({ error: "Invalid JSON" }, { status: 400 }));
94+
}
8595
const parsed = UpdateBody.safeParse(rawBody);
8696
if (!parsed.success) {
8797
return apiCors(
@@ -112,6 +122,6 @@ export async function action({ request, params }: ActionFunctionArgs) {
112122

113123
return apiCors(
114124
request,
115-
json({ error: "Method not allowed" }, { status: 405, headers: { Allow: "POST, PUT, DELETE" } })
125+
json({ error: "Method not allowed" }, { status: 405, headers: { Allow: "POST, PUT, PATCH, DELETE" } })
116126
);
117127
}

0 commit comments

Comments
 (0)