kongdeqiang
2026-10-12 285bf234bd50ce54fcae7bb777f8fa579b91266e
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
import http from './axios'
 
/**
 * 对话分组(用户自建的文件夹)。
 *
 * 与「今天 / 昨天 / 更早」的时间分组无关:那是前端按时间算出来的视图归类,
 * 这里是存在数据库里、用户可以命名和增删的实体。
 */
 
/** 当前用户的全部分组(含每个分组的会话数) */
export function listChatGroups() {
  return http.get('/chat-groups')
}
 
/** 新建分组 */
export function createChatGroup(name) {
  return http.post('/chat-groups', { name })
}
 
/** 重命名分组 */
export function renameChatGroup(groupId, name) {
  return http.put(`/chat-groups/${groupId}`, { name })
}
 
/**
 * 删除分组。
 *
 * 只解除分组关系,**不会删除组内会话** —— 它们会回到「未分组」。
 * 返回值里带 movedChats(被移出的会话数),用于给用户一句明确的提示。
 */
export function deleteChatGroup(groupId) {
  return http.delete(`/chat-groups/${groupId}`)
}