Merge pull request #8 from CAPTAIN320/ollama

Ollama
This commit is contained in:
Yaqub Mahmoud 2025-02-13 10:23:21 +09:00 committed by GitHub
commit f7cdcc789a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 84 additions and 3 deletions

View File

@ -21,7 +21,8 @@ export function Header() {
<div className="flex items-center gap-2 z-logo text-bolt-elements-textPrimary cursor-pointer">
<div className="i-ph:sidebar-simple-duotone text-xl" />
<a href="/" className="text-2xl font-semibold text-accent flex items-center">
<span className="i-bolt:logo-text?mask w-[46px] inline-block" />
{/* <span className="i-bolt:logo-text?mask w-[46px] inline-block" /> */}
<span className="ml-2">Flora</span>
</a>
</div>
<span className="flex-1 px-4 truncate text-center text-bolt-elements-textPrimary">

View File

@ -5,6 +5,7 @@ import { getSystemPrompt } from './prompts';
import { createAnthropic } from '@ai-sdk/anthropic';
import { createAzure } from '@ai-sdk/azure';
import { createOllama } from 'ollama-ai-provider';
interface ToolResult<Name extends string, Args, Result> {
toolCallId: string;
@ -31,19 +32,40 @@ export function streamText(messages: Messages, env: Env, options?: StreamingOpti
resourceName: azureResourceName,
apiKey: azureResourceNameApiKey,
headers: {
'api_version': '2024-11-20',
api_version: '2024-11-20',
},
});
// `
// For all designs I ask you to make, have them be beautiful, not cookie cutter. Make webpages that are fully featured and worthy for production.
// By default, this template supports JSX syntax with Tailwind CSS classes, React hooks, and Lucide React for icons. Do not install other packages for UI themes, icons, etc unless absolutely necessary or I request them.
// Use icons from lucide-react for logos.
// Use stock photos from unsplash where appropriate, only valid URLs you know exist. Do not download the images, only link to them in image tags.
// `;
return _streamText({
// model: azure('gpt-4o'),
model: azure('gpt-4o-2'),
system: getSystemPrompt(),
messages: convertToCoreMessages(messages),
maxTokens: MAX_TOKENS,
maxTokens: 8192,
...options,
});
// const ollama = createOllama({
// baseURL: 'http://localhost:11434/api',
// });
// return _streamText({
// // model: ollama('llava'),
// // model: ollama('deepseek-r1:7b'),
// model: ollama('deepseek-r1:70b'),
// system: getSystemPrompt(),
// messages: convertToCoreMessages(messages),
// maxTokens: MAX_TOKENS,
// ...options,
// });
// const anthropic = createAnthropic({
// apiKey: getAPIKey(env),
// });

View File

@ -64,6 +64,7 @@
"jose": "^5.6.3",
"jszip": "^3.10.1",
"nanostores": "^0.10.3",
"ollama-ai-provider": "^1.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hotkeys-hook": "^4.5.0",

View File

@ -134,6 +134,9 @@ importers:
nanostores:
specifier: ^0.10.3
version: 0.10.3
ollama-ai-provider:
specifier: ^1.2.0
version: 1.2.0(zod@3.24.1)
react:
specifier: ^18.2.0
version: 18.3.1
@ -288,6 +291,15 @@ packages:
zod:
optional: true
'@ai-sdk/provider-utils@2.1.5':
resolution: {integrity: sha512-PcNR7E4ovZGV/J47gUqaFlvzorgca6uUfN5WzfXJSFWeOeLunN+oxRVwgUOwj0zbmO0yGQTHQD+FHVw8s3Rz8w==}
engines: {node: '>=18'}
peerDependencies:
zod: ^3.0.0
peerDependenciesMeta:
zod:
optional: true
'@ai-sdk/provider@0.0.17':
resolution: {integrity: sha512-f9j+P5yYRkqKFHxvWae5FI0j6nqROPCoPnMkpc2hc2vC7vKjqzrxBJucD8rpSaUjqiBnY/QuRJ0QeV717Uz5tg==}
engines: {node: '>=18'}
@ -300,6 +312,10 @@ packages:
resolution: {integrity: sha512-dQkfBDs2lTYpKM8389oopPdQgIU007GQyCbuPPrV+K6MtSII3HBfE0stUIMXUb44L+LK1t6GXPP7wjSzjO6uKg==}
engines: {node: '>=18'}
'@ai-sdk/provider@1.0.6':
resolution: {integrity: sha512-hwj/gFNxpDgEfTaYzCYoslmw01IY9kWLKl/wf8xuPvHtQIzlfXWmmUwc8PnCwxyt8cKzIuV0dfUghCf68HQ0SA==}
engines: {node: '>=18'}
'@ai-sdk/react@0.0.70':
resolution: {integrity: sha512-GnwbtjW4/4z7MleLiW+TOZC2M29eCg1tOUpuEiYFMmFNZK8mkrqM0PFZMo6UsYeUYMWqEOOcPOU9OQVJMJh7IQ==}
engines: {node: '>=18'}
@ -2949,6 +2965,10 @@ packages:
resolution: {integrity: sha512-v0eOBUbiaFojBu2s2NPBfYUoRR9GjcDNvCXVaqEf5vVfpIAh9f8RCo4vXTP8c63QRKCFwoLpMpTdPwwhEKVgzA==}
engines: {node: '>=14.18'}
eventsource-parser@3.0.0:
resolution: {integrity: sha512-T1C0XCUimhxVQzW4zFipdx0SficT651NnkR0ZSH3yQwh+mFMdLfgjABVi4YtMTtaL4s168593DaoaRLMqryavA==}
engines: {node: '>=18.0.0'}
evp_bytestokey@1.0.3:
resolution: {integrity: sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==}
@ -4060,6 +4080,15 @@ packages:
ohash@1.1.4:
resolution: {integrity: sha512-FlDryZAahJmEF3VR3w1KogSEdWX3WhA5GPakFx4J81kEAiHyLMpdLLElS8n8dfNadMgAne/MywcvmogzscVt4g==}
ollama-ai-provider@1.2.0:
resolution: {integrity: sha512-jTNFruwe3O/ruJeppI/quoOUxG7NA6blG3ZyQj3lei4+NnJo7bi3eIRWqlVpRlu/mbzbFXeJSBuYQWF6pzGKww==}
engines: {node: '>=18'}
peerDependencies:
zod: ^3.0.0
peerDependenciesMeta:
zod:
optional: true
on-finished@2.4.1:
resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==}
engines: {node: '>= 0.8'}
@ -4134,6 +4163,9 @@ packages:
resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}
engines: {node: '>= 0.8'}
partial-json@0.1.7:
resolution: {integrity: sha512-Njv/59hHaokb/hRUjce3Hdv12wd60MtM9Z5Olmn+nehe0QDAsRtRbJPvJ0Z91TusF0SuZRIvnM+S4l6EIP8leA==}
path-browserify@1.0.1:
resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==}
@ -5569,6 +5601,15 @@ snapshots:
optionalDependencies:
zod: 3.24.1
'@ai-sdk/provider-utils@2.1.5(zod@3.24.1)':
dependencies:
'@ai-sdk/provider': 1.0.6
eventsource-parser: 3.0.0
nanoid: 3.3.8
secure-json-parse: 2.7.0
optionalDependencies:
zod: 3.24.1
'@ai-sdk/provider@0.0.17':
dependencies:
json-schema: 0.4.0
@ -5581,6 +5622,10 @@ snapshots:
dependencies:
json-schema: 0.4.0
'@ai-sdk/provider@1.0.6':
dependencies:
json-schema: 0.4.0
'@ai-sdk/react@0.0.70(react@18.3.1)(zod@3.24.1)':
dependencies:
'@ai-sdk/provider-utils': 1.0.22(zod@3.24.1)
@ -8457,6 +8502,8 @@ snapshots:
eventsource-parser@1.1.2: {}
eventsource-parser@3.0.0: {}
evp_bytestokey@1.0.3:
dependencies:
md5.js: 1.3.5
@ -10067,6 +10114,14 @@ snapshots:
ohash@1.1.4: {}
ollama-ai-provider@1.2.0(zod@3.24.1):
dependencies:
'@ai-sdk/provider': 1.0.6
'@ai-sdk/provider-utils': 2.1.5(zod@3.24.1)
partial-json: 0.1.7
optionalDependencies:
zod: 3.24.1
on-finished@2.4.1:
dependencies:
ee-first: 1.1.1
@ -10161,6 +10216,8 @@ snapshots:
parseurl@1.3.3: {}
partial-json@0.1.7: {}
path-browserify@1.0.1: {}
path-exists@4.0.0: {}