Skip to content

Commit

Permalink
fix(Reference): Passing the agents reference in the messages
Browse files Browse the repository at this point in the history
  • Loading branch information
wadhia-yash committed Jul 10, 2024
1 parent cde75cc commit 8c1f03b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions web/src/lib/components/chat/ChatWindow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
export let agentVersion: string = "1.0.3";
export let agentPrivate: boolean = false;
let agentReferences: Array<any> = [];
let messageLoading: boolean = false;
let message: string = "";
let LottiePlayer: any;
Expand All @@ -34,19 +35,21 @@
messageLoading = true;
messages = [...messages, { role: "user", text: message }];
debugger;
message = "";
const agentData = {
agent_name: agentName,
agent_version: agentVersion,
chat_history: messages,
current_message: message,
included_references: [],
included_references: agentReferences,
private: agentPrivate,
};
message = "";
try {
debugger;
const response = await fetch(
"https://api.commanddash.dev/v2/ai/agent/answer",
{
Expand All @@ -57,11 +60,13 @@
},
},
);
const modelResponse = await response.json();
messages = [
...messages,
{ role: "model", text: modelResponse.response },
];
agentReferences = modelResponse.references;
} catch (error) {
console.log("error", error);
}
Expand Down

0 comments on commit 8c1f03b

Please sign in to comment.