aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ChatBox/Agent.ts
diff options
context:
space:
mode:
authorA.J. Shulman <Shulman.aj@gmail.com>2024-07-16 15:50:39 -0400
committerA.J. Shulman <Shulman.aj@gmail.com>2024-07-16 15:50:39 -0400
commit74666884d0680745146f4e4ca24573637ee0a391 (patch)
treee81146c93cd5263d6cd0c683ca9aba93e35e9dbb /src/client/views/nodes/ChatBox/Agent.ts
parent65179e8b0519aa4ccf28afc4c429262ecf7a62f3 (diff)
working much better still working on adding images thouhg
Diffstat (limited to 'src/client/views/nodes/ChatBox/Agent.ts')
-rw-r--r--src/client/views/nodes/ChatBox/Agent.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/client/views/nodes/ChatBox/Agent.ts b/src/client/views/nodes/ChatBox/Agent.ts
index 210d3c804..bada4b146 100644
--- a/src/client/views/nodes/ChatBox/Agent.ts
+++ b/src/client/views/nodes/ChatBox/Agent.ts
@@ -17,12 +17,12 @@ export class Agent {
private messages: AgentMessage[] = [];
private interMessages: AgentMessage[] = [];
private vectorstore: Vectorstore;
- private history: () => string;
+ private _history: () => string;
- constructor(_vectorstore: Vectorstore, summaries: () => string, _history: () => string) {
+ constructor(_vectorstore: Vectorstore, summaries: () => string, history: () => string) {
this.client = new OpenAI({ apiKey: process.env.OPENAI_KEY, dangerouslyAllowBrowser: true });
this.vectorstore = _vectorstore;
- this.history = _history;
+ this._history = history;
this.tools = {
wikipedia: new WikipediaTool(),
calculate: new CalculateTool(),
@@ -33,7 +33,7 @@ export class Agent {
async askAgent(question: string, maxTurns: number = 8): Promise<string> {
console.log(`Starting query: ${question}`);
this.messages.push({ role: 'user', content: question });
- const chatHistory = this.history();
+ const chatHistory = this._history();
console.log(`Chat history: ${chatHistory}`);
const systemPrompt = getReactPrompt(Object.values(this.tools), chatHistory);
console.log(`System prompt: ${systemPrompt}`);