File tree Expand file tree Collapse file tree 9 files changed +11
-9
lines changed Expand file tree Collapse file tree 9 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 1- OLLAMA_URL = " http://localhost:11434"
1+ NEXT_PUBLIC_OLLAMA_URL = " http://localhost:11434"
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ mv .example.env .env
6565** 4. If your instance of Ollama is NOT running on the default ip-address and port, change the variable in the .env file to fit your usecase:**
6666
6767```
68- OLLAMA_URL ="http://localhost:11434"
68+ NEXT_PUBLIC_OLLAMA_URL ="http://localhost:11434"
6969```
7070
7171** 5. Install dependencies:**
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export default function Page({ params }: { params: { id: string } }) {
3232 useEffect ( ( ) => {
3333 if ( env === "production" ) {
3434 const newOllama = new ChatOllama ( {
35- baseUrl : process . env . OLLAMA_URL || "http://localhost:11434" ,
35+ baseUrl : process . env . NEXT_PUBLIC_OLLAMA_URL || "http://localhost:11434" ,
3636 model : selectedModel ,
3737 } ) ;
3838 setOllama ( newOllama ) ;
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export async function POST(req: Request) {
1010 const { messages, selectedModel } = await req . json ( ) ;
1111
1212 const model = new ChatOllama ( {
13- baseUrl : process . env . OLLAMA_URL ,
13+ baseUrl : process . env . NEXT_PUBLIC_OLLAMA_URL || "http://localhost:11434" ,
1414 model : selectedModel ,
1515 } ) ;
1616
Original file line number Diff line number Diff line change 11export async function POST ( req : Request ) {
22 const { name } = await req . json ( ) ;
33
4- const response = await fetch ( process . env . OLLAMA_URL + "/api/pull" , {
4+ const ollamaUrl = process . env . NEXT_PUBLIC_OLLAMA_URL || "http://localhost:11434" ;
5+
6+ const response = await fetch ( ollamaUrl + "/api/pull" , {
57 method : "POST" ,
68 body : JSON . stringify ( { name } ) ,
79 } ) ;
Original file line number Diff line number Diff line change 11export const dynamic = "force-dynamic" ;
22
33export async function GET ( req : Request ) {
4- const OLLAMA_URL = process . env . OLLAMA_URL || "http://localhost:11434" ;
4+ const OLLAMA_URL = process . env . NEXT_PUBLIC_OLLAMA_URL || "http://localhost:11434" ;
55 const res = await fetch (
66 OLLAMA_URL + "/api/tags"
77 ) ;
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ export default function Home() {
5252 useEffect ( ( ) => {
5353 if ( env === "production" ) {
5454 const newOllama = new ChatOllama ( {
55- baseUrl : process . env . OLLAMA_URL || "http://localhost:11434" ,
55+ baseUrl : process . env . NEXT_PUBLIC_OLLAMA_URL || "http://localhost:11434" ,
5656 model : selectedModel ,
5757 } ) ;
5858 setOllama ( newOllama ) ;
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ export default function ChatTopbar({
4545
4646 const fetchModels = async ( ) => {
4747 if ( env === "production" ) {
48- const fetchedModels = await fetch ( process . env . OLLAMA_URL + "/api/tags" ) ;
48+ const fetchedModels = await fetch ( process . env . NEXT_PUBLIC_OLLAMA_URL + "/api/tags" ) ;
4949 const json = await fetchedModels . json ( ) ;
5050 const apiModels = json . models . map ( ( model : any ) => model . name ) ;
5151 setModels ( [ ...apiModels ] ) ;
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export default function PullModelForm() {
4040 if ( env === "production" ) {
4141 // Make a post request to localhost
4242 const pullModel = async ( ) => {
43- const response = await fetch ( process . env . OLLAMA_URL + "/api/pull" , {
43+ const response = await fetch ( process . env . NEXT_PUBLIC_OLLAMA_URL + "/api/pull" , {
4444 method : "POST" ,
4545 headers : {
4646 "Content-Type" : "application/json" ,
You can’t perform that action at this time.
0 commit comments