mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add activity ai chatbot UI and functionality
This commit is contained in:
parent
cf681b2260
commit
19d8db9a20
11 changed files with 312 additions and 114 deletions
23
apps/web/services/ai/ai.ts
Normal file
23
apps/web/services/ai/ai.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody, RequestBodyWithAuthHeader } from "@services/utils/ts/requests";
|
||||
|
||||
export async function startActivityAIChatSession(message: string, activity_uuid: string) {
|
||||
const data = {
|
||||
message,
|
||||
activity_uuid,
|
||||
};
|
||||
const result = await fetch(`${getAPIUrl()}ai/start/activity_chat_session`, RequestBody("POST", data, null));
|
||||
const res = await result.json();
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function sendActivityAIChatMessage(message: string, aichat_uuid: string, activity_uuid: string) {
|
||||
const data = {
|
||||
aichat_uuid,
|
||||
message,
|
||||
activity_uuid,
|
||||
};
|
||||
const result = await fetch(`${getAPIUrl()}ai/send/activity_chat_message`, RequestBody("POST", data, null));
|
||||
const res = await result.json();
|
||||
return res;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue