21 lines
518 B
TypeScript
21 lines
518 B
TypeScript
import { type Message } from 'ai/react'
|
|
import api from './api'
|
|
import { ChatShareAPIPrefix } from '@/const/api';
|
|
|
|
export interface ChatShareRequest {
|
|
chatId: string
|
|
}
|
|
|
|
export interface ChatShareResp {
|
|
userID: number;
|
|
id: string;
|
|
messages: Message[];
|
|
}
|
|
|
|
export const getSharedChat = async (id: string) => {
|
|
const res = await api.post(ChatShareAPIPrefix + '/v1/chat/messages/share',
|
|
{ chatId: id } as ChatShareRequest,
|
|
)
|
|
console.log("getSharedChat api response: ", res.data)
|
|
return res.data as ChatShareResp
|
|
} |