Skip to content

Commit 99978cd

Browse files
author
Nick Tchayka
committed
Bump
1 parent 17ae8bc commit 99978cd

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

apps/extension/src/agent/agent-builder.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ export default async function () {
99
}
1010

1111
private readonly tools: Tool[] = [];
12-
private readonly callbacks: ((message: string) => Promise<string>)[] = [];
12+
// eslint-disable-next-line no-unused-vars
13+
private readonly callbacks: ((_message: string) => Promise<string>)[] = [];
1314
private memory!: BaseChatMemory;
1415
private systemMessage?: string;
1516
private humanMessage?: string;
1617

18+
// eslint-disable-next-line no-unused-vars
1719
private constructor(private readonly model: BaseChatModel) {}
1820

1921
withTool(tool: Tool): this {

apps/extension/src/extension.ts

+17-18
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ import * as process from "node:process";
33
import monkeyAgent from "./agent/monkey-agent";
44
import * as cp from "node:child_process";
55
import "./fetch-polyfill";
6-
import communicator from "./agent/communicator";
76

87
const apiKeyName = "MSC_OPENAI_API_KEY";
98

10-
let currentFilePath: string | undefined;
11-
129
async function getApiKey(
1310
context: vscode.ExtensionContext
1411
): Promise<string | undefined> {
@@ -67,17 +64,8 @@ export async function activate(context: vscode.ExtensionContext) {
6764
console.log(`Node.js version: ${stdout.trim()}`);
6865
});
6966

70-
const document = vscode.window.activeTextEditor?.document;
71-
if (document && document.uri.scheme === "file") {
72-
currentFilePath = document.uri.fsPath;
73-
}
74-
75-
const disposable = vscode.window.onDidChangeActiveTextEditor((editor) => {
76-
const document = editor?.document;
77-
if (document && document.uri.scheme === "file") {
78-
currentFilePath = document.uri.fsPath;
79-
}
80-
});
67+
// eslint-disable-next-line no-unused-vars
68+
const disposable = vscode.window.onDidChangeActiveTextEditor((_editor) => {});
8169

8270
context.subscriptions.push(
8371
vscode.window.registerWebviewViewProvider(
@@ -91,6 +79,7 @@ export async function activate(context: vscode.ExtensionContext) {
9179
class ChatSidebarViewProvider implements vscode.WebviewViewProvider {
9280
_view?: vscode.WebviewView;
9381

82+
// eslint-disable-next-line no-unused-vars
9483
constructor(private readonly _extensionUri: vscode.Uri) {}
9584

9685
async resolveWebviewView(webviewView: vscode.WebviewView) {
@@ -107,8 +96,6 @@ class ChatSidebarViewProvider implements vscode.WebviewViewProvider {
10796
content,
10897
});
10998
};
110-
const communicatorAgent = await communicator(sendMessage);
111-
const agent = await monkeyAgent(communicatorAgent);
11299
this._view = webviewView;
113100
webviewView.webview.options = {
114101
enableScripts: true,
@@ -122,8 +109,20 @@ class ChatSidebarViewProvider implements vscode.WebviewViewProvider {
122109
let response: string;
123110
try {
124111
setLoading(true);
125-
response = await agent.call(currentFilePath, message.content);
126-
await communicatorAgent.call(response);
112+
// Perform a call like { "question": "How can I create a command that represents the level up of a player?"} to https://asktoai.boosterframework.com/api/answer using cross-fetch
113+
response = await fetch(
114+
"https://asktoai.boosterframework.com/api/answer",
115+
{
116+
method: "POST",
117+
headers: {
118+
"Content-Type": "application/json",
119+
},
120+
body: JSON.stringify({
121+
question: message.content,
122+
}),
123+
}
124+
).then((response) => response.text());
125+
sendMessage(response);
127126
} catch (error) {
128127
const parsedError = error as Error;
129128
response = `

turbo.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"$schema": "https://turbo.build/schema.json",
33
"globalDependencies": ["**/.env.*local"],
4+
"globalEnv": ["OPENAI_API_KEY"],
45
"pipeline": {
56
"compile": {
67
"dependsOn": ["^compile"],

0 commit comments

Comments
 (0)