Skip to content

Commit 784da89

Browse files
SargeJosephJJK801
authored andcommitted
Add an Ollama baseUrl in chatflow configuration for Follow-up prompts (FlowiseAI#4169)
Add abn Ollama baseUrl in chatflow configuration for Follow-up prompts
1 parent 686548e commit 784da89

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

packages/components/src/Interface.ts

+1
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ export type FollowUpPromptProviderConfig = {
436436
[key in FollowUpPromptProvider]: {
437437
credentialId: string
438438
modelName: string
439+
baseUrl: string
439440
prompt: string
440441
temperature: string
441442
}

packages/components/src/followUpPrompts.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { z } from 'zod'
88
import { PromptTemplate } from '@langchain/core/prompts'
99
import { StructuredOutputParser } from '@langchain/core/output_parsers'
1010
import { ChatGroq } from '@langchain/groq'
11-
import ollama from 'ollama'
11+
import { Ollama } from 'ollama'
1212

1313
const FollowUpPromptType = z
1414
.object({
@@ -122,7 +122,11 @@ export const generateFollowUpPrompts = async (
122122
return structuredResponse
123123
}
124124
case FollowUpPromptProvider.OLLAMA: {
125-
const response = await ollama.chat({
125+
const ollamaClient = new Ollama({
126+
host: providerConfig.baseUrl || 'http://127.0.0.1:11434'
127+
})
128+
129+
const response = await ollamaClient.chat({
126130
model: providerConfig.modelName,
127131
messages: [
128132
{

packages/ui/src/ui-component/extended/FollowUpPrompts.jsx

+8
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,14 @@ const followUpPromptsOptions = {
269269
name: FollowUpPromptProviders.OLLAMA,
270270
icon: ollamaIcon,
271271
inputs: [
272+
{
273+
label: 'Base URL',
274+
name: 'baseUrl',
275+
type: 'string',
276+
placeholder: 'http://127.0.0.1:11434',
277+
description: 'Base URL of your Ollama instance',
278+
default: 'http://127.0.0.1:11434'
279+
},
272280
{
273281
label: 'Model Name',
274282
name: 'modelName',

0 commit comments

Comments
 (0)