From 86971334f819d5a62654497de4bc30110270c6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20F=C3=B6rster?= Date: Mon, 11 Dec 2023 16:27:14 +0100 Subject: [PATCH] added options for remote ollama api --- package.json | 8 ++++++++ src/completion.ts | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7930a191..255c4c6f 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,14 @@ "twinny.ollamaModelName": { "type": "string", "default": "codellama:7b-code" + }, + "twinny.ollamaBaseUrl": { + "type": "string", + "default": "localhost" + }, + "twinny.ollamaApiPort": { + "type": "number", + "default": 11434 } } } diff --git a/src/completion.ts b/src/completion.ts index e17b962a..5f3af1a9 100644 --- a/src/completion.ts +++ b/src/completion.ts @@ -21,6 +21,8 @@ export class CompletionProvider implements InlineCompletionItemProvider { private _debounceWait = this._config.get('debounceWait') as number private _contextLength = this._config.get('contextLength') as number private _model = this._config.get('ollamaModelName') as string + private _baseurl = this._config.get('ollamaBaseUrl') as string + private _apiport = this._config.get('ollamaApiPort') as number constructor(statusBar: StatusBarItem) { this._statusBar = statusBar @@ -68,8 +70,8 @@ export class CompletionProvider implements InlineCompletionItemProvider { this._statusBar.text = '$(loading~spin)' streamResponse( { - hostname: 'localhost', - port: 11434, + hostname: this._baseurl, + port: this._apiport, method: 'POST', path: '/api/generate' },