quivr/frontend/lib/api/chat/addQuestionAndAnswer.ts

22 lines
488 B
TypeScript

import { AxiosInstance } from "axios";
import { ChatMessage } from "@/app/chat/[chatId]/types";
export type QuestionAndAnwser = {
question: string;
answer: string;
};
export const addQuestionAndAnswer = async (
chatId: string,
questionAndAnswer: QuestionAndAnwser,
axiosInstance: AxiosInstance
): Promise<ChatMessage> => {
const response = await axiosInstance.post<ChatMessage>(
`/chat/${chatId}/question/answer`,
questionAndAnswer
);
return response.data;
};