mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: use session access_tokens
This commit is contained in:
parent
08cc97f557
commit
52f2235942
74 changed files with 413 additions and 440 deletions
|
|
@ -1,9 +1,10 @@
|
|||
import { getAPIUrl } from '@services/config/config'
|
||||
import { RequestBody } from '@services/utils/ts/requests'
|
||||
import { RequestBodyWithAuthHeader } from '@services/utils/ts/requests'
|
||||
|
||||
export async function startActivityAIChatSession(
|
||||
message: string,
|
||||
activity_uuid: string
|
||||
access_token: string,
|
||||
activity_uuid?: string
|
||||
) {
|
||||
const data = {
|
||||
message,
|
||||
|
|
@ -11,7 +12,7 @@ export async function startActivityAIChatSession(
|
|||
}
|
||||
const result = await fetch(
|
||||
`${getAPIUrl()}ai/start/activity_chat_session`,
|
||||
RequestBody('POST', data, null)
|
||||
RequestBodyWithAuthHeader('POST', data, null, access_token)
|
||||
)
|
||||
const json = await result.json()
|
||||
if (result.status === 200) {
|
||||
|
|
@ -34,7 +35,8 @@ export async function startActivityAIChatSession(
|
|||
export async function sendActivityAIChatMessage(
|
||||
message: string,
|
||||
aichat_uuid: string,
|
||||
activity_uuid: string
|
||||
activity_uuid: string,
|
||||
access_token: string
|
||||
) {
|
||||
const data = {
|
||||
aichat_uuid,
|
||||
|
|
@ -43,7 +45,7 @@ export async function sendActivityAIChatMessage(
|
|||
}
|
||||
const result = await fetch(
|
||||
`${getAPIUrl()}ai/send/activity_chat_message`,
|
||||
RequestBody('POST', data, null)
|
||||
RequestBodyWithAuthHeader('POST', data, null, access_token)
|
||||
)
|
||||
|
||||
const json = await result.json()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue