Skip to content

Commit

Permalink
chore: update the answerQuestion function to be called chat instead. …
Browse files Browse the repository at this point in the history
…this is more inline with the quarkus parasol stuff and better for the docs
  • Loading branch information
lholmquist committed Jan 24, 2025
1 parent c6f79fb commit c20a7ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ai/chatbot.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function createChain(model) {

}

export async function answerQuestion(question, sessionId) {
export async function chat(question, sessionId) {
const result = await chainWithHistory.stream(
{ input: createQuestion(question) },
{ configurable: { sessionId: sessionId } }
Expand Down
4 changes: 2 additions & 2 deletions routes/chatbot-ws-route.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getModel } from '../ai/ai.mjs';
import { createChain, answerQuestion, resetSessions } from '../ai/chatbot.mjs';
import { createChain, chat, resetSessions } from '../ai/chatbot.mjs';

async function chatbotWSRoute (fastify, options) {
fastify.get('/ws/query', { websocket: true }, (ws, req) => {
Expand Down Expand Up @@ -29,7 +29,7 @@ async function chatbotWSRoute (fastify, options) {
console.log('Starting to Ask', new Date());

try {
const answerStream = await answerQuestion(JSONmessage, ws);
const answerStream = await chat(JSONmessage, ws);

for await (const chunk of answerStream) {
console.log(`Got Chat Response: ${chunk.content}`);
Expand Down

0 comments on commit c20a7ba

Please sign in to comment.