Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mishig25 committed Jul 2, 2024
1 parent 892baa9 commit ca2d9cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/server/tools/hfDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ const hfDocs: BackendTool = {
"A search query which will be used to fetch the most relevant docs snippets regarding the user's query",
},
},
async *call({ prompt }, { messages, ip, username }) {
async *call({ query }, { messages, ip, username }) {
const ipToken = await getIpToken(ip, username);

const userMessages = messages.filter(({ from }) => from === "user");
const previousUserMessages = userMessages.slice(0, -1);

const query =
const queryWithPreviousMsgs =
(previousUserMessages.length
? `Previous questions: \n${previousUserMessages
.map(({ content }) => `- ${content}`)
.join("\n")}`
: "") +
"\n\nCurrent Question: " +
String(prompt);
String(query);

const outputs = await callSpace<string[], string[]>(
"huggingchat/hf-docs",
"/predict",
[query, "RAG-friendly"],
[queryWithPreviousMsgs, "RAG-friendly"],
ipToken
);

Expand Down

0 comments on commit ca2d9cb

Please sign in to comment.