Skip to content

feat: support for ollama prerendered agent block list and disable api key field#471

Closed
justserdar wants to merge 2 commits intosimstudioai:mainfrom
justserdar:feat/ollama
Closed

feat: support for ollama prerendered agent block list and disable api key field#471
justserdar wants to merge 2 commits intosimstudioai:mainfrom
justserdar:feat/ollama

Conversation

@justserdar
Copy link

@justserdar justserdar commented Jun 10, 2025

The PR is a WIP the last weeks including back and forth conversations with hummus, it adds the missing prerendered Ollama list in the AI agent block and conditionally renders the api key field for only the base models.

Description

  1. Disabled the guard that stops client-side ollama store initialisation.
  2. Ollama models are added to the list when the env is correct, setting the right url of the consumers ollama instance is required.
  3. 'ollamais required as ollama api key, this is handled in the current ollama provider. Changed value fromemptytoollama`.
  4. Conditionally disabled the API key field for the local Ollama list.
  5. Conditionally disable api key check in the api/prodivers.ts endpoint.

Important:
Point 2 needs correct env passthrough via OLLAMA_URL.
Point 4 needs work because on page refresh the api key field is still being rendered while it wasn't before the page reload.
Point 5 need work just for ollama in self hosted situations, so we might need to add another check like isHosted, suggestion: isSelfHosted and isSelfHostedModel to make handling these situations more elegantly.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Locally on windows 10 and ZimaCube (ZimaOS / Docker)

image
image

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally and in CI (bun run test)
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • I have updated version numbers as needed (if needed)
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Security Considerations:

  • My changes do not introduce any new security vulnerabilities
  • I have considered the security implications of my changes

Additional Information:

Any additional information, configuration or data that might be necessary to reproduce the issue or use the feature.

@vercel
Copy link

vercel bot commented Jun 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 18, 2025 6:04pm

@vercel
Copy link

vercel bot commented Jun 10, 2025

@justserdar is attempting to deploy a commit to the Sim Studio Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Enhances Ollama integration by modifying client-side initialization and API key handling in the agent block interface. Changes primarily focus on improved local model support and conditional UI rendering.

  • Modified apps/sim/providers/ollama/index.ts to remove client-side initialization guard and standardize API key to 'ollama'
  • Updated apps/sim/blocks/blocks/agent.ts to conditionally hide API key field for local Ollama models
  • Issue: Page refresh causes API key field to incorrectly reappear for local models
  • Pending: API provider endpoint needs additional isSelfHosted check for Ollama-specific handling

2 files reviewed, 2 comments
Edit PR Review Bot Settings | Greptile

try {
const response = await fetch(`${OLLAMA_HOST}/api/tags`)
if (!response.ok) {
console.log('response', response)
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Avoid using console.log for debugging in production code. Use the logger instead for consistency.

Suggested change
console.log('response', response)
logger.debug('response', response)

// Include all Ollama models for which we don't show the API key field
value: [
// Ollama models
...useOllamaStore.getState().models,
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Store state accessed twice - consider memoizing or moving to a constant to avoid potential inconsistencies between the two calls.

@waleedlatif1
Copy link
Collaborator

resolved by #884

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