An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
Fix: Add simulated streaming support for Ollama provider
Yoshiki Miurae434810468ff
diff --git a/bun.lockb b/bun.lockbindex 2cd6f3c5..0fb73b1e 100755Binary files a/bun.lockb and b/bun.lockb differdiff --git a/lib/utils/registry.ts b/lib/utils/registry.tsindex 850e9a04..45d827ac 100644--- a/lib/utils/registry.ts+++ b/lib/utils/registry.ts@@ -1,8 +1,8 @@-import { experimental_createProviderRegistry as createProviderRegistry } from 'ai'-import { openai, createOpenAI } from '@ai-sdk/openai'import { anthropic } from '@ai-sdk/anthropic'-import { google } from '@ai-sdk/google'import { createAzure } from '@ai-sdk/azure'+import { google } from '@ai-sdk/google'+import { createOpenAI, openai } from '@ai-sdk/openai'+import { experimental_createProviderRegistry as createProviderRegistry } from 'ai'import { createOllama } from 'ollama-ai-provider'export const registry = createProviderRegistry({@@ -27,6 +27,17 @@ export const registry = createProviderRegistry({})export function getModel(model: string) {+ // if ollama provider, set simulateStreaming to true+ if (model.includes('ollama')) {+ const modelName = model.split(':')[1]+ const ollama = createOllama({+ baseURL: `${process.env.OLLAMA_BASE_URL}/api`+ })+ return ollama(modelName, {+ simulateStreaming: true+ })+ }+return registry.languageModel(model)}diff --git a/package.json b/package.jsonindex 702f5815..c9f17de9 100644--- a/package.json+++ b/package.json@@ -40,7 +40,7 @@"next": "^15.1.3","next-themes": "^0.3.0","node-html-parser": "^6.1.13",- "ollama-ai-provider": "^1.1.0",+ "ollama-ai-provider": "^1.2.0","react": "^19.0.0","react-dom": "^19.0.0","react-icons": "^5.0.1",