Browse Source

add optional proxy flag to config (#38)

cameron turner 1 year ago
parent
commit
5c36185731
2 changed files with 5 additions and 1 deletions
  1. 4 1
      src/index.ts
  2. 1 0
      src/interfaces.ts

+ 4 - 1
src/index.ts

@@ -33,7 +33,10 @@ export class Ollama {
 
   constructor(config?: Partial<Config>) {
     this.config = {
-      host: utils.formatHost(config?.host ?? 'http://127.0.0.1:11434'),
+      host: '',
+    }
+    if (!config?.proxy) {
+      this.config.host = utils.formatHost(config?.host ?? 'http://127.0.0.1:11434')
     }
 
     this.fetch = fetch

+ 1 - 0
src/interfaces.ts

@@ -3,6 +3,7 @@ export type Fetch = typeof fetch
 export interface Config {
   host: string
   fetch?: Fetch
+  proxy?: boolean
 }
 
 // request types