Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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 @@ function createLogEntry(
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 @@ function createLogEntry(
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 @@ -2067,6 +2069,7 @@ chat.openapi(completions, async (c) => {
top_p,
frequency_penalty,
presence_penalty,
reasoning_effort,
tools,
tool_choice,
source,
Expand Down Expand Up @@ -2147,6 +2150,7 @@ chat.openapi(completions, async (c) => {
top_p,
frequency_penalty,
presence_penalty,
reasoning_effort,
tools,
tool_choice,
source,
Expand Down Expand Up @@ -2322,6 +2326,7 @@ chat.openapi(completions, async (c) => {
top_p,
frequency_penalty,
presence_penalty,
reasoning_effort,
tools,
tool_choice,
source,
Expand Down Expand Up @@ -2437,6 +2442,7 @@ chat.openapi(completions, async (c) => {
top_p,
frequency_penalty,
presence_penalty,
reasoning_effort,
tools,
tool_choice,
source,
Expand Down Expand Up @@ -3137,6 +3143,7 @@ chat.openapi(completions, async (c) => {
top_p,
frequency_penalty,
presence_penalty,
reasoning_effort,
tools,
tool_choice,
source,
Expand Down Expand Up @@ -3261,6 +3268,7 @@ chat.openapi(completions, async (c) => {
top_p,
frequency_penalty,
presence_penalty,
reasoning_effort,
tools,
tool_choice,
source,
Expand Down Expand Up @@ -3330,6 +3338,7 @@ chat.openapi(completions, async (c) => {
top_p,
frequency_penalty,
presence_penalty,
reasoning_effort,
tools,
tool_choice,
source,
Expand Down Expand Up @@ -3469,6 +3478,7 @@ chat.openapi(completions, async (c) => {
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;

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.

⚠️ Potential issue

Avoid manual SQL migrations; generate with pnpm push.

This repo’s guidelines prohibit manual SQL migrations. Please remove this file and regenerate via Drizzle so metadata stays consistent and naming matches the schema.

Suggested steps:

  • Revert this manual migration and journal edits.
  • Update schema.ts (if needed).
  • From packages/db, run: pnpm push
  • Commit the generated SQL and meta snapshot/journal.

If you must keep this change, also align the column name with the schema (reasoningEffort) or update schema to text("reasoning_effort") as suggested in schema.ts.

🤖 Prompt for AI Agents
In packages/db/migrations/1754925816_long_wildside.sql around lines 1 to 1, this
is a manual SQL migration which violates repo guidelines; remove this file and
revert any manual edits to the migration journal, ensure schema.ts reflects the
intended field (either rename to reasoningEffort in schema or explicitly use
text("reasoning_effort") there), then from the packages/db directory run pnpm
push to let Drizzle generate the correct migration SQL and updated meta/journal,
and finally commit the generated SQL and the meta snapshot/journal; if you
absolutely must keep the change, align the column name between schema.ts and the
SQL so names match.

Loading