Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/api/src/routes/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const logSchema = z.object({
topP: z.number().nullable(),
frequencyPenalty: z.number().nullable(),
presencePenalty: z.number().nullable(),
reasoningEffort: z.string().nullable(),
tools: tools.nullable(),
toolChoice: toolChoice.nullable(),
toolResults: toolResults.nullable(),
Expand Down
10 changes: 10 additions & 0 deletions apps/gateway/src/chat/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
top_p: number | undefined,
frequency_penalty: number | undefined,
presence_penalty: number | undefined,
reasoningEffort: "low" | "medium" | "high" | undefined,
tools: any[] | undefined,
toolChoice: any | undefined,
source: string | undefined,
Expand All @@ -173,6 +174,7 @@
topP: top_p || null,
frequencyPenalty: frequency_penalty || null,
presencePenalty: presence_penalty || null,
reasoningEffort: reasoningEffort || null,
tools: tools || null,
toolChoice: toolChoice || null,
mode: project.mode,
Expand Down Expand Up @@ -324,7 +326,7 @@
try {
const parsed = JSON.parse(content);
content = JSON.stringify(parsed);
} catch (_e) {}

Check warning on line 329 in apps/gateway/src/chat/chat.ts

View workflow job for this annotation

GitHub Actions / autofix

'_e' is defined but never used

Check warning on line 329 in apps/gateway/src/chat/chat.ts

View workflow job for this annotation

GitHub Actions / generate / run

'_e' is defined but never used

Check warning on line 329 in apps/gateway/src/chat/chat.ts

View workflow job for this annotation

GitHub Actions / lint / run

'_e' is defined but never used
}
}

Expand Down Expand Up @@ -765,7 +767,7 @@
name: m.name,
}));
return encodeChat(chatMessages, DEFAULT_TOKENIZER_MODEL).length;
} catch (_error) {

Check warning on line 770 in apps/gateway/src/chat/chat.ts

View workflow job for this annotation

GitHub Actions / autofix

'_error' is defined but never used

Check warning on line 770 in apps/gateway/src/chat/chat.ts

View workflow job for this annotation

GitHub Actions / generate / run

'_error' is defined but never used

Check warning on line 770 in apps/gateway/src/chat/chat.ts

View workflow job for this annotation

GitHub Actions / lint / run

'_error' is defined but never used
return Math.max(
1,
Math.round(
Expand Down Expand Up @@ -1336,7 +1338,7 @@
let rawBody: unknown;
try {
rawBody = await c.req.json();
} catch (_error) {

Check warning on line 1341 in apps/gateway/src/chat/chat.ts

View workflow job for this annotation

GitHub Actions / autofix

'_error' is defined but never used

Check warning on line 1341 in apps/gateway/src/chat/chat.ts

View workflow job for this annotation

GitHub Actions / generate / run

'_error' is defined but never used

Check warning on line 1341 in apps/gateway/src/chat/chat.ts

View workflow job for this annotation

GitHub Actions / lint / run

'_error' is defined but never used
return c.json(
{
error: {
Expand Down Expand Up @@ -2067,6 +2069,7 @@
top_p,
frequency_penalty,
presence_penalty,
reasoning_effort,
tools,
tool_choice,
source,
Expand Down Expand Up @@ -2147,6 +2150,7 @@
top_p,
frequency_penalty,
presence_penalty,
reasoning_effort,
tools,
tool_choice,
source,
Expand Down Expand Up @@ -2322,6 +2326,7 @@
top_p,
frequency_penalty,
presence_penalty,
reasoning_effort,
tools,
tool_choice,
source,
Expand Down Expand Up @@ -2437,6 +2442,7 @@
top_p,
frequency_penalty,
presence_penalty,
reasoning_effort,
tools,
tool_choice,
source,
Expand Down Expand Up @@ -2581,7 +2587,7 @@
JSON.parse(jsonCandidate);
// JSON is valid - end at first newline to exclude SSE fields
eventEnd = dataIndex + 6 + firstNewline;
} catch (_e) {

Check warning on line 2590 in apps/gateway/src/chat/chat.ts

View workflow job for this annotation

GitHub Actions / autofix

'_e' is defined but never used

Check warning on line 2590 in apps/gateway/src/chat/chat.ts

View workflow job for this annotation

GitHub Actions / generate / run

'_e' is defined but never used

Check warning on line 2590 in apps/gateway/src/chat/chat.ts

View workflow job for this annotation

GitHub Actions / lint / run

'_e' is defined but never used
// JSON is not complete, use the full segment to next data event
eventEnd = nextEventIndex;
}
Expand Down Expand Up @@ -3137,6 +3143,7 @@
top_p,
frequency_penalty,
presence_penalty,
reasoning_effort,
tools,
tool_choice,
source,
Expand Down Expand Up @@ -3261,6 +3268,7 @@
top_p,
frequency_penalty,
presence_penalty,
reasoning_effort,
tools,
tool_choice,
source,
Expand Down Expand Up @@ -3330,6 +3338,7 @@
top_p,
frequency_penalty,
presence_penalty,
reasoning_effort,
tools,
tool_choice,
source,
Expand Down Expand Up @@ -3469,6 +3478,7 @@
top_p,
frequency_penalty,
presence_penalty,
reasoning_effort,
tools,
tool_choice,
source,
Expand Down
18 changes: 18 additions & 0 deletions apps/ui/src/components/dashboard/log-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ export function LogCard({ log }: { log: Partial<Log> }) {
<div>{log.promptTokens}</div>
<div className="text-muted-foreground">Completion Tokens</div>
<div>{log.completionTokens}</div>
<div className="text-muted-foreground">Reasoning Tokens</div>
<div>{log.reasoningTokens}</div>
<div className="text-muted-foreground">Total Tokens</div>
<div className="font-medium">{log.totalTokens}</div>
Comment on lines +167 to 170

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Deduplicate “Reasoning Tokens” row and add a fallback for missing values.

“Reasoning Tokens” is rendered twice (once unconditionally and again conditionally), causing duplication when present. Also add a fallback to avoid rendering an empty cell when the value is absent.
[recommendation below removes the duplicate conditional block and adds a "-" fallback.]

Apply this diff:

@@
-                <div className="text-muted-foreground">Reasoning Tokens</div>
-                <div>{log.reasoningTokens}</div>
+                <div className="text-muted-foreground">Reasoning Tokens</div>
+                <div>{log.reasoningTokens ?? "-"}</div>
                 <div className="text-muted-foreground">Total Tokens</div>
                 <div className="font-medium">{log.totalTokens}</div>
-                {log.reasoningTokens && (
-                  <>
-                    <div className="text-muted-foreground">
-                      Reasoning Tokens
-                    </div>
-                    <div>{log.reasoningTokens}</div>
-                  </>
-                )}

Also applies to: 171-178

🤖 Prompt for AI Agents
In apps/ui/src/components/dashboard/log-card.tsx around lines 167-170 (also
applies to 171-178), remove the duplicated "Reasoning Tokens" row and replace
both occurrences with a single label/value pair; render the value using a safe
fallback (e.g., log.reasoningTokens ?? "-" ) so an empty cell isn't shown when
the value is missing, and ensure no other conditional renders the same label
elsewhere.

{log.reasoningTokens && (
Expand Down Expand Up @@ -348,6 +350,22 @@ export function LogCard({ log }: { log: Partial<Log> }) {
</Tooltip>
<span>{log.frequencyPenalty}</span>
</div>
<div className="flex items-center justify-between gap-2">
<Tooltip>
<TooltipTrigger asChild>
<span className="text-muted-foreground">
Reasoning Effort
</span>
</TooltipTrigger>
<TooltipContent>
<p className="max-w-xs text-xs">
Requested chain-of-thought effort for reasoning-capable
models
</p>
</TooltipContent>
</Tooltip>
<span>{log.reasoningEffort || "-"}</span>
</div>
</TooltipProvider>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions apps/ui/src/lib/api/v1.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ export interface paths {
topP: number | null;
frequencyPenalty: number | null;
presencePenalty: number | null;
reasoningEffort: string | null;
tools:
| {
/** @enum {string} */
Expand Down
1 change: 1 addition & 0 deletions packages/db/migrations/1754925816_long_wildside.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "log" ADD COLUMN "reasoning_effort" text;
Loading
Loading