-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Feature/custom OpenAI config #859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feature/custom OpenAI config #859
Conversation
…n, deployed chat improvements (simstudioai#843) * fix(domain): fix telemetry endpoint, only add redirects for hosted version (simstudioai#822) * fix(otel): change back telemetry endpoint * only add redirects for hosted version --------- Co-authored-by: waleedlatif <[email protected]> * fix(search-modal): fixed search modal keyboard nav (simstudioai#823) * fixed search modal keyboard nav * break down file --------- Co-authored-by: waleedlatif <[email protected]> * improvement(docs): add base exec charge info to docs (simstudioai#826) * improvement(doc-tags-subblock): use table for doc tags subblock in create_document tool for KB (simstudioai#827) * improvement(doc-tags-subblock): use table for doc tags create doc tool in KB block * enforce max tags * remove red warning text * fix(bugs): fixed rb2b csp, fixed overly-verbose logs, fixed x URLs (simstudioai#828) Co-authored-by: waleedlatif <[email protected]> * feat(wand): subblock level wand configuration + migrate old wand usage to this (simstudioai#829) * feat(wand): subblock level wand configuration + migrate old wand usage to this * fix build issue * Update apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/wand-prompt-bar/wand-prompt-bar.tsx Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * remove optional param * remove unused test file * address greptile comments * change to enum for gen type * fix caching issue --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * feat(tools): added hunter.io tools/block, added default values of first option in dropdowns to avoid operation selector issue, added descriptions & param validation & updated docs (simstudioai#825) * feat(tools): added hunter.io tools/block, added default values of first option in dropdowns to avoid operation selector issue * fix * added description for all outputs, fixed param validation for tools * cleanup * add dual validation, once during serialization and once during execution * improvement(docs): add base exec charge info to docs (simstudioai#826) * improvement(doc-tags-subblock): use table for doc tags subblock in create_document tool for KB (simstudioai#827) * improvement(doc-tags-subblock): use table for doc tags create doc tool in KB block * enforce max tags * remove red warning text * fix(bugs): fixed rb2b csp, fixed overly-verbose logs, fixed x URLs (simstudioai#828) Co-authored-by: waleedlatif <[email protected]> * fixed serialization errors to appear like execution errors, also fixed contrast on cmdk modal * fixed required for tools, added tag dropdown for kb tags * fix remaining tools with required fields * update utils * update docs * fix kb tags * fix types for exa * lint * updated contributing guide + pr template * Test pre-commit hook with linting * Test pre-commit hook again * remove test files * fixed wealthbox tool * update telemetry endpoints --------- Co-authored-by: waleedlatif <[email protected]> Co-authored-by: Vikhyath Mondreti <[email protected]> * fix(deployed-chat): trigger blocks should not interfere with deployed chat exec (simstudioai#832) * fix(deployed-chat): allow non-streaming responses in deployed chat, allow partial failure responses in deployed chat (simstudioai#833) * fix(deployed-chat): allow non-streaming responses in deployed chat, allow partial failure responses in deployed chat * fix(csp): runtime variable resolution for CSP * cleanup --------- Co-authored-by: waleedlatif <[email protected]> * fix(sockets): duplicate block op should go through debounced path (simstudioai#834) * improvement(sockets): add batch subblock updates for duplicate to clear queue faster (simstudioai#835) * improvement(sockets): duplicate op should let addBlock take subblock values instead of separate looped op (simstudioai#836) * improvement(sockets): addBlock can accept subblock values * cleanup unused code * fix(deploy-modal): break down deploy modal into separate components (simstudioai#837) Co-authored-by: waleedlatif <[email protected]> * fix(kb-tags): docs page kb tags ui (simstudioai#838) * fix(kb-tags): docs page kb tags ui * remove console logs * remove console error * fix(chat-deploy): fixed form submission access patterns, fixed kb block filters (simstudioai#839) * fix(chat-deploy): fixed form submission access patterns * fix(kb-block): fix tag filters component, removed unused component * fixed kb block subcomponents --------- Co-authored-by: waleedlatif <[email protected]> * fix(kb-tags): ui fixes, delete persistence for doc page header (simstudioai#841) * fix deletion of tags + refactor next slot calc * fix kb tag filters count ui * fix(chat-deploy): added new image upload component, fixed some state issues with success view (simstudioai#842) * fix(chat-deploy): added new image upload component, fixed some state issues with success view * cleanup --------- Co-authored-by: waleedlatif <[email protected]> * feat(deploy-chat): added a logo upload for the chat, incr font size * fix(deploy-modal): break down deploy modal into separate components (simstudioai#837) Co-authored-by: waleedlatif <[email protected]> --------- Co-authored-by: waleedlatif <[email protected]> Co-authored-by: Vikhyath Mondreti <[email protected]> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Someone is attempting to deploy a commit to the Sim Studio Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR adds support for custom OpenAI-compatible API providers, allowing users to configure local or self-hosted LLM services like Ollama or LM Studio instead of relying solely on hosted OpenAI APIs. The implementation extends the existing credentials/settings system by adding three new components:
-
New Credentials Component (
credentials.tsx
): Creates a user interface that allows selection between OpenAI, Azure, and Custom OpenAI providers. When "Custom OpenAI" is selected, it conditionally renders input fields for base URL, model name, and API key configuration. -
Extended Store Types (
types.ts
): AddsllmProvider
(string) andcustomOpenAI
(object with baseURL, modelName, apiKey) fields to the General interface, along with corresponding setter method signatures. -
Store Implementation (
store.ts
): Implements the actual state management with default values (llmProvider: 'openai'
and empty customOpenAI configuration) and providessetLLMProvider
andsetCustomOpenAI
methods for updating the configuration.
The feature integrates with the existing Zustand-based settings system and follows the established UI patterns. The implementation focuses on local state management rather than full backend persistence, which aligns with the developer's testing limitations mentioned in the PR description. This change enables developers to test workflows with local LLM providers without requiring OpenAI authentication, improving the development experience for those using alternative AI backends.
Confidence score: 2/5
- This PR has several implementation issues that could cause problems, including incomplete type definitions and missing backend persistence
- Score reflects concerns about type safety violations, inconsistent formatting, unused imports, and the lack of integration with existing API persistence patterns
- Pay close attention to the type definitions in
types.ts
and the store implementation instore.ts
3 files reviewed, 8 comments
@@ -0,0 +1,68 @@ | |||
import { useState } from 'react' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Remove unused import - useState
is imported but never used in this component
import { useState } from 'react' | |
import { Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui' |
customOpenAI: { | ||
baseURL: string | ||
modelName: string | ||
apiKey: string | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Inconsistent indentation in object definition. Should align with the file's formatting style.
const handleInputChange = (key: keyof typeof customOpenAI, value: string) => { | ||
setCustomOpenAI({ | ||
...customOpenAI, | ||
[key]: value , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: Extra space before comma
[key]: value , | |
[key]: value, |
setCustomOpenAI: (data: { | ||
baseURL: string | ||
modelName: string | ||
apiKey: string | ||
}) => void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Inconsistent indentation in object type definition. Should align with the file's formatting style.
customOpenAI: { | ||
baseURL: '', | ||
modelName: '', | ||
apiKey: '', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Inconsistent indentation - the object properties should align with the opening brace
customOpenAI: { | |
baseURL: '', | |
modelName: '', | |
apiKey: '', | |
}, | |
customOpenAI: { | |
baseURL: '', | |
modelName: '', | |
apiKey: '', | |
}, |
import { Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui' | ||
import { useGeneralStore } from '@/stores/settings/general/store' | ||
|
||
export function Credentials({ onOpenChange }: { onOpenChange: (open: boolean) => void }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: The onOpenChange
prop is received but never used - consider removing if not needed
export function Credentials({ onOpenChange }: { onOpenChange: (open: boolean) => void }) { | |
export function Credentials() { |
setLLMProvider: (provider) => { | ||
set({ llmProvider: provider }) | ||
}, | ||
|
||
setCustomOpenAI: (data) => { | ||
set({ customOpenAI: data }) | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: These settings are not persisted to the backend via updateSetting()
like other settings. Consider if these should be saved to user preferences or remain local-only
@@ -118,6 +133,8 @@ export const useGeneralStore = create<GeneralStore>()( | |||
get().updateSetting('telemetryNotifiedUser', notified) | |||
}, | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Remove unnecessary empty line
@viknesh-ai do you plan on continuing this one? |
Summary
Added support for configuring a custom OpenAI-compatible API provider. This allows users to input a custom base URL, model name, and optional API key — enabling integration with tools like Ollama or LM Studio.
Helps developers test without requiring authentication or relying on hosted OpenAI APIs.
Fixes #N/A
Type of Change
Testing
Manual testing in local development environment using a custom provider input in the Credentials UI.
Settings are persisted using Zustand store.
Could not verify with full end-to-end behavior due to login/auth limitation in local setup. Reviewers should focus on data binding and store updates.
Checklist
Screenshots/Videos