zhangxiao
2024-09-26 fa482274a588e97784c10099e45d030664aa4ceb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import axios from 'axios';
 
export interface ISessionListResult {
  code: number;
  msg: string;
  data: any;
}
// 会话列表
export function sessionListApi(dialog_id) {
  return axios.get<ISessionListResult>(
    "/api/conversation/list?modeltype=localragflow&dialogid=" + dialog_id,
  );
}
// 会话列表分页
export function sessionListApiPage(data) {
  if (data?.searchParam) {
    return axios.get<ISessionListResult>(
      `/api/conversation/list?modeltype=localragflow&search=${data.searchParam}&dialogid=&page=${data.page}&per_page=${data.page_size}`
    );
  } else {
    return axios.get<ISessionListResult>(
      `/api/conversation/list?modeltype=localragflow&dialogid=&page=${data.page}&per_page=${data.page_size}`
    );
  }
}
// 删除会话
export function deleteSessionApi(conversation_ids: string[]) {
  return axios.post<ISessionListResult>(
    '/api/v1/conversation/rm?modeltype=localragflow',
    { conversation_ids }
  );
}
// 新增会话
export function addSessionApi(params: any) {
  return axios.post<ISessionListResult>(
    '/api/v1/conversation/set?platform=localragflow',
    params
  );
}
 
// 聊天
export function chatApi(data: { conversation_id: string; messages: string }) {
  return axios.post<ISessionListResult>(
    '/api/tech/cloudminds/query?modeltype=localragflow',
    data
  );
}
 
// 获取会话详情
export function getSessionDetailsApi(conversation_id: string) {
  return axios.get<ISessionListResult>(
    '/api/conversation/get?modeltype=localragflow',
    { params: { conversation_id } }
  );
}
// 获取智能助手列表
export function getDialogListApi() {
  return axios.get<ISessionListResult>('/api/v1/dialog/list');
}
 
 
export function uploadWithoutKb(params) {
  const config = {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      // token: token,
    },
  };
  return axios.post('/api/v1/document/upload_without_kb', params, config);
}
 
 
export function upload_and_parse(params) {
  const config = {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      // token: token,
    },
  };
  return axios.post('/api/v1/document/upload_and_parse', params, config);
}
 
 
export function getDocumentStatus(doc_ids) {
  let params = { "doc_ids": doc_ids };
  return axios.post("/api/v1/document/infos", params);
}
 
 
// 获取解析方法列表
export function getParseMethodsListApi() {
  return axios.get<ISessionListResult>('/api/v1/user/parse-methods');
}
 
// 上传v1/document/upload_and_parse
export function uploadAndParse(params) {
  const config = {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      // token: token,
    },
  };
  return axios.post('/api/v1/document/upload_and_parse', params, config);
}
//上传解析v1/document/infos
 
export function chatInfos(data: { doc_ids: Array }) {
  return axios.post<ISessionListResult>(
    '/api/v1/document/infos',
    data
  );
}
 
//上传删除文档v1/document/rm
export function chatRm(data: { doc_id: Array }) {
  return axios.post<ISessionListResult>(
    '/api/v1/document/rm',
    data
  );
}
 
//高级会话
export function seniorAgentApi(params) {
  return axios.get<ISessionListResult>(
    '/api/v1/advanced-agent/list',
    params
  );
}