From fa301014164ee9f7ffa14e1b260edd0623ad1040 Mon Sep 17 00:00:00 2001 From: Luc Georges Date: Sun, 24 Sep 2023 11:32:47 +0200 Subject: [PATCH] feat: add `llm.attributionEndpoint` setting (#73) --- package.json | 5 +++++ src/extension.ts | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 68e1f7ec..ced8548d 100644 --- a/package.json +++ b/package.json @@ -139,6 +139,11 @@ "default": 250, "description": "Number of characters to scan for code attribution" }, + "llm.attributionEndpoint": { + "type": "string", + "default": "https://stack.dataportraits.org/overlap", + "description": "Endpoint to which attribution request will be sent to (https://stack.dataportraits.org/overlap for the stack)." + }, "llm.tlsSkipVerifyInsecure": { "type": "boolean", "default": false, diff --git a/src/extension.ts b/src/extension.ts index 99f84f0d..5a6a0b0c 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -192,6 +192,7 @@ export default async function highlightStackAttributions(): Promise { const config = vscode.workspace.getConfiguration("llm"); const attributionWindowSize = config.get("attributionWindowSize") as number; + const attributionEndpoint = config.get("attributionEndpoint") as string; // get cursor postion and offset const cursorPosition = vscode.window.activeTextEditor?.selection.active; @@ -210,14 +211,12 @@ export default async function highlightStackAttributions(): Promise { const text = document.getText(); const textAroundCursor = text.slice(start, end); - const url = "https://stack.dataportraits.org/overlap"; const body = { document: textAroundCursor }; - console.log("body", body); // notify user request has started void vscode.window.showInformationMessage("Searching for nearby code in the stack..."); - const resp = await fetch(url, { + const resp = await fetch(attributionEndpoint, { method: "POST", body: JSON.stringify(body), headers: { "Content-Type": "application/json" },