Skip to content

Config: Temperature Always to 0.7 and Vecto Store Ids not being stored in Config Body#32

Merged
Prajna1999 merged 1 commit intomainfrom
fix/fe-bugs
Jan 31, 2026
Merged

Config: Temperature Always to 0.7 and Vecto Store Ids not being stored in Config Body#32
Prajna1999 merged 1 commit intomainfrom
fix/fe-bugs

Conversation

@Prajna1999
Copy link
Copy Markdown
Collaborator

@Prajna1999 Prajna1999 commented Jan 30, 2026

Target issues #35 #36 #37

Temperature was being reset to 0.7 and
knowledge_base_ids array was not being spread to match POST Config API contract.

Enhanced configuration selector to display additional details: temperature indicator, knowledge base count, and comprehensive configuration grid layout.

  • Added dedicated "Prompt Preview" section in configuration details.

Summary by CodeRabbit

Release Notes

  • New Features

    • Bug: Temperature was being reset to 0.7 and
      knowledge_base_ids array was not being spread to match POST Config API contract.
    • Enhanced configuration selector to display additional details: temperature indicator, knowledge base count, and comprehensive configuration grid layout.
    • Added dedicated "Prompt Preview" section in configuration details.
  • Refactor

    • Updated internal field naming and data structure handling for configuration management to improve consistency across the application.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

This PR renames the vector_store_ids field to knowledge_base_ids across the application's type definitions and components. It introduces a data-flattening mechanism where tools arrays are converted to top-level knowledge_base_ids and max_num_results fields for backend compatibility, with bidirectional conversion logic maintaining frontend usability. The ConfigSelector UI is enhanced with temperature indicators, knowledge base counts, and a richer configuration details grid.

Changes

Cohort / File(s) Summary
Type Definitions
app/components/types.ts, app/configurations/prompt-editor/types.ts, app/lib/configTypes.ts
Field renamed from vector_store_ids to knowledge_base_ids in Tool interface. ConfigBlob types updated to include optional flattened backend fields (knowledge_base_ids?: string[], max_num_results?: number) alongside frontend tools?: Tool[].
Component - UI Display
app/components/ConfigModal.tsx, app/components/prompt-editor/ConfigDiffPane.tsx, app/components/prompt-editor/DiffView.tsx
Updated conditional checks and display bindings to use knowledge_base_ids instead of vector_store_ids for rendering tool information.
Component - Configuration Drawer & Editor
app/components/ConfigDrawer.tsx, app/components/prompt-editor/ConfigEditorPane.tsx, app/components/prompt-editor/CurrentConfigTab.tsx
Tool initialization and update logic now uses knowledge_base_ids array instead of vector_store_ids; input bindings updated to read/write from knowledge_base_ids[0].
Component - Configuration Selector
app/components/ConfigSelector.tsx
Version item display enriched with temperature indicator (T:), knowledge base count (KB), and timestamp. Configuration preview panel redesigned with two-column grid showing Provider/Model, Temperature, Knowledge Base IDs, Max Results, and new Prompt Preview section.
Data Transformation Logic
app/components/SimplifiedConfigEditor.tsx, app/lib/useConfigs.ts
Implements bidirectional flattening/unflattening: converts backend flattened fields into frontend tools array on load, and reconstructs flattened fields from tools array on save. Derives vectorStoreIds from first tool's knowledge_base_ids.
Configuration Save Flow
app/configurations/prompt-editor/page.tsx
Aggregates knowledge_base_ids from all tools and derives max_num_results from first tool (default 20); constructs backend payload with flattened fields instead of nested tools array.
Documentation
instructions/CONFIG_AB.md, instructions/CONFIG_API.md
Updated example tool configuration to show knowledge_base_ids field instead of vector_store_ids.

Sequence Diagram(s)

sequenceDiagram
    participant Frontend as Frontend (UI)
    participant SimplifiedEditor as SimplifiedConfigEditor
    participant Backend as Backend API
    
    rect rgba(100, 150, 200, 0.5)
    Note over Frontend,Backend: Loading Configuration
    Backend->>SimplifiedEditor: Provide config with flattened<br/>knowledge_base_ids, max_num_results
    SimplifiedEditor->>SimplifiedEditor: Unflatten: Construct tools array<br/>from knowledge_base_ids
    SimplifiedEditor->>Frontend: Return SavedConfig with<br/>tools array for UI
    Frontend->>Frontend: Render tool configuration UI
    end
    
    rect rgba(200, 150, 100, 0.5)
    Note over Frontend,Backend: Saving Configuration
    Frontend->>SimplifiedEditor: User saves configuration<br/>with updated tools array
    SimplifiedEditor->>SimplifiedEditor: Flatten: Aggregate knowledge_base_ids<br/>from all tools, extract max_num_results
    SimplifiedEditor->>Backend: Send payload with top-level<br/>knowledge_base_ids, max_num_results
    Backend->>Backend: Persist flattened structure
    end
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A field renamed with care so fine,
From vector stores to knowledge's design,
Flattened and unflattened with grace,
The backend and frontend embrace!
With temperature shown and KB count clear,
The config is richer this year! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the two main issues being fixed: temperature management and knowledge_base_ids spreading/contract alignment.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/fe-bugs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Prajna1999 Prajna1999 requested review from AkhileshNegi and vprashrex and removed request for vprashrex January 30, 2026 12:06
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/lib/useConfigs.ts (1)

112-118: ⚠️ Potential issue | 🟠 Major

Preserve explicit temperature = 0.

Line 116 uses || 0.7, which coerces 0 to 0.7 and recreates the temperature reset bug. Use nullish coalescing instead.

🛠️ Proposed fix
-    temperature: params.temperature || 0.7,
+    temperature: params.temperature ?? 0.7,
🤖 Fix all issues with AI agents
In `@app/configurations/prompt-editor/page.tsx`:
- Line 247: The debug console.log that prints the entire configBlob
(console.log('[DEBUG] Config blob being sent:', JSON.stringify(configBlob, null,
2))) should be removed or gated to non-production; update the code around where
configBlob is prepared to either delete the debug log or wrap it in a runtime
check (e.g., only run when process.env.NODE_ENV !== 'production' or when a
specific DEBUG flag is enabled) so the full instructions/config are not exposed
in production logs.
🧹 Nitpick comments (3)
app/components/SimplifiedConfigEditor.tsx (3)

106-120: Consider using a fresh array instead of mutating a const.

The tools variable is declared as const but then mutated via push(). While this is technically valid in JavaScript (const prevents reassignment, not mutation), it's cleaner to build a new array:

♻️ Suggested refactor
-    const tools: Tool[] = params.tools || [];
-
-    // If no tools array but has flattened fields, create tools array from them
-    // Each knowledge_base_id becomes a separate tool for UI display
-    if (tools.length === 0 && params.knowledge_base_ids && params.knowledge_base_ids.length > 0) {
-      params.knowledge_base_ids.forEach((kbId: string) => {
-        tools.push({
-          type: 'file_search',
-          knowledge_base_ids: [kbId], // Each tool gets one ID for UI
-          max_num_results: params.max_num_results || 20,
-        });
-      });
-    }
+    // Backend sends flattened fields - convert to tools array for frontend UI
+    let tools: Tool[] = params.tools || [];
+
+    // If no tools array but has flattened fields, create tools array from them
+    if (tools.length === 0 && params.knowledge_base_ids && params.knowledge_base_ids.length > 0) {
+      tools = params.knowledge_base_ids.map((kbId: string) => ({
+        type: 'file_search' as const,
+        knowledge_base_ids: [kbId],
+        max_num_results: params.max_num_results || 20,
+      }));
+    }

131-131: Consider using nullish coalescing for temperature fallback.

Using || 0.7 will fallback to 0.7 if the backend returns temperature: 0, which is a valid (deterministic) setting. If supporting temperature=0 is intended, use ?? instead:

♻️ Suggested fix
-      temperature: params.temperature || 0.7,
+      temperature: params.temperature ?? 0.7,

252-259: Brittle condition for selecting max_num_results from the first tool.

The condition allKnowledgeBaseIds.length === tool.knowledge_base_ids.length is only true on the first iteration (before any IDs are accumulated). While this works, it's non-obvious and fragile—if tools[0] has zero knowledge_base_ids, the condition fails and maxNumResults stays at the default.

♻️ Clearer approach using a flag or direct access
      const allKnowledgeBaseIds: string[] = [];
-      let maxNumResults = 20; // default
+      const maxNumResults = tools[0]?.max_num_results ?? 20;

       tools.forEach((tool) => {
-        // Add all knowledge_base_ids from this tool
         allKnowledgeBaseIds.push(...tool.knowledge_base_ids);
-        // Use max_num_results from first tool (could be made configurable)
-        if (allKnowledgeBaseIds.length === tool.knowledge_base_ids.length) {
-          maxNumResults = tool.max_num_results;
-        }
       });

},
};

console.log('[DEBUG] Config blob being sent:', JSON.stringify(configBlob, null, 2));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Drop or gate the debug config blob log.

Line 247 logs the full config blob (including instructions) to the console. Consider removing or gating to non-production builds.

🧹 Suggested guard
-      console.log('[DEBUG] Config blob being sent:', JSON.stringify(configBlob, null, 2));
+      if (process.env.NODE_ENV !== 'production') {
+        console.log('[DEBUG] Config blob being sent:', JSON.stringify(configBlob, null, 2));
+      }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
console.log('[DEBUG] Config blob being sent:', JSON.stringify(configBlob, null, 2));
if (process.env.NODE_ENV !== 'production') {
console.log('[DEBUG] Config blob being sent:', JSON.stringify(configBlob, null, 2));
}
🤖 Prompt for AI Agents
In `@app/configurations/prompt-editor/page.tsx` at line 247, The debug console.log
that prints the entire configBlob (console.log('[DEBUG] Config blob being
sent:', JSON.stringify(configBlob, null, 2))) should be removed or gated to
non-production; update the code around where configBlob is prepared to either
delete the debug log or wrap it in a runtime check (e.g., only run when
process.env.NODE_ENV !== 'production' or when a specific DEBUG flag is enabled)
so the full instructions/config are not exposed in production logs.

@Prajna1999 Prajna1999 requested a review from vprashrex January 31, 2026 03:42
if (allKnowledgeBaseIds.length === tool.knowledge_base_ids.length) {
maxNumResults = tool.max_num_results;
}
});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think iska easy way vo sakta hai no need of iteration and all.

const maxNumResults = tools[0].max_num_results || 20 // since u are just considering the from the first tool .. idk what configurable u can do while performing iteration but this one line is enough

const allKnwledgebaseids. = tools.flatMap(tool => tool.knoweldge_base_ids)

aisa karenge toh let maxNumResults = 20 ki phi jarurat nhi padeghi


This suggestion is for just code readability .. u can ignore it if it doesn't make sense

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think you are correct but abhi lets merge it and refactor at a later time. Its possible all these code will be deleted entirely in 2 months.

@Prajna1999 Prajna1999 merged commit 4385ab1 into main Jan 31, 2026
1 check passed
@Prajna1999 Prajna1999 changed the title Config: temperature always to 0.7 and knowledge_base spreading issue Config: Temperature Always to 0.7 and Vecto Store Ids not being stored in Config Body Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants