chat.ts 1.0 KB

123456789101112131415161718192021222324
  1. /**
  2. * Copyright (c) 2013-Now https://jeesite.com All rights reserved.
  3. * No deletion without permission, or be held responsible to law.
  4. * @author ThinkGem
  5. */
  6. import { defHttp } from '@jeesite/core/utils/http/axios';
  7. import { useGlobSetting } from '@jeesite/core/hooks/setting';
  8. import { Conversation, Message } from './dto';
  9. const { adminPath } = useGlobSetting();
  10. export const saveConversation = (data: Conversation) =>
  11. defHttp.postJson<void>({ url: adminPath + '/ai/session', data });
  12. export const getAllConversations = () => defHttp.get<Conversation[]>({ url: adminPath + '/ai/list' });
  13. export const getMessagesByConversation = (params?: string) =>
  14. defHttp.get<Message[]>({ url: adminPath + '/ai/getMessagesByConversation', params: { id: params } });
  15. export const editConversation = (data: Conversation) =>
  16. defHttp.postJson<void>({ url: adminPath + '/ai/editConversation', data });
  17. export const deleteConversation = (id: string) =>
  18. defHttp.get<void>({ url: adminPath + '/ai/deleteConversation', params: { id } });