session.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import axios from 'axios';
  2. export interface ISessionListResult {
  3. code: number;
  4. msg: string;
  5. data: any;
  6. }
  7. // 会话列表
  8. export function sessionListApi(dialog_id) {
  9. return axios.get<ISessionListResult>(
  10. "/api/conversation/list?modeltype=localragflow&dialogid=" + dialog_id
  11. );
  12. }
  13. // 删除会话
  14. export function deleteSessionApi(conversation_ids: string[]) {
  15. return axios.post<ISessionListResult>(
  16. '/api/conversation/del?modeltype=localragflow',
  17. { conversation_ids }
  18. );
  19. }
  20. // 新增会话
  21. export function addSessionApi(params: any) {
  22. return axios.get<ISessionListResult>(
  23. '/api/getConId/kdwithai?platform=localragflow',
  24. { params }
  25. );
  26. }
  27. // 聊天
  28. export function chatApi(data: { conversation_id: string; messages: string }) {
  29. return axios.post<ISessionListResult>(
  30. '/api/tech/cloudminds/query?modeltype=localragflow',
  31. data
  32. );
  33. }
  34. // 获取会话详情
  35. export function getSessionDetailsApi(conversation_id: string) {
  36. return axios.get<ISessionListResult>(
  37. '/api/conversation/get?modeltype=localragflow',
  38. { params: { conversation_id } }
  39. );
  40. }
  41. // 获取智能助手列表
  42. export function getDialogListApi() {
  43. return axios.get<ISessionListResult>('/api/dialog/list');
  44. }