Skip to content

Commit

Permalink
feat: add llm.attributionEndpoint setting (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
McPatate committed Sep 26, 2023
1 parent 367ae23 commit fa30101
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 2 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export default async function highlightStackAttributions(): Promise<void> {

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;
Expand All @@ -210,14 +211,12 @@ export default async function highlightStackAttributions(): Promise<void> {
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" },
Expand Down

0 comments on commit fa30101

Please sign in to comment.