add: cn proxy

This commit is contained in:
Asadz
2026-04-24 20:26:06 +08:00
committed by wwweww
parent e4fcc4e74e
commit e7210260d6
6 changed files with 109 additions and 64 deletions
+35 -36
View File
@@ -6,38 +6,41 @@ type (
Id int64 `path:"id"`
}
CreateGroupReq {
Name string `json:"name"`
Participants []int64 `json:"participants,optional"`
}
CreateDMReq {
TargetId int64 `json:"targetId"`
}
ChatSession {
Id int64 `json:"id"`
Type string `json:"type"` // order, consultation
OrderId string `json:"orderId,optional"`
Participants []SimpleUser `json:"participants"`
LastMessage string `json:"lastMessage"`
UnreadCount int `json:"unreadCount"`
Id int64 `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
CreatorId int64 `json:"creatorId"`
Participants []int64 `json:"participants"`
LastMessage string `json:"lastMessage"`
LastMessageAt int64 `json:"lastMessageAt"`
CreatedAt int64 `json:"createdAt"`
}
ChatSessionListResp {
Items []ChatSession `json:"items"`
Meta PageMeta `json:"meta"`
}
ChatMessage {
Id int64 `json:"id"`
SessionId string `json:"sessionId"`
SenderId string `json:"senderId"`
Type string `json:"type"` // text, image, system
Content string `json:"content"`
CreatedAt string `json:"createdAt"`
Id int64 `json:"id"`
SessionId int64 `json:"sessionId"`
SenderId int64 `json:"senderId"`
Type string `json:"type"`
Content string `json:"content"`
CreatedAt int64 `json:"createdAt"`
}
ChatMessageListResp {
Items []ChatMessage `json:"items"`
Meta PageMeta `json:"meta"`
}
SendMessageReq {
SessionIdReq
Type string `json:"type"`
Content string `json:"content"`
}
ListMessageReq {
@@ -51,27 +54,23 @@ type (
group: chat
)
service chat-api {
@doc "获取会话列表"
@doc "create group session"
@handler CreateGroup
post /sessions/group (CreateGroupReq) returns (ChatSession)
@doc "create dm session"
@handler CreateDM
post /sessions/dm (CreateDMReq) returns (ChatSession)
@doc "list user sessions"
@handler ListSessions
get /sessions (PageReq) returns (ChatSessionListResp)
@doc "获取会话详情"
@doc "get session detail"
@handler GetSession
get /sessions/:id (SessionIdReq) returns (ChatSession)
@doc "获取消息历史"
@doc "get message history"
@handler ListMessages
get /sessions/:id/messages (ListMessageReq) returns (ChatMessageListResp)
@doc "发送消息"
@handler SendMessage
post /sessions/:id/messages (SendMessageReq) returns (ChatMessage)
@doc "创建/获取订单会话"
@handler EnsureOrderSession
post /sessions/order (EmptyResp) returns (ChatSession)
@doc "创建咨询会话"
@handler CreateConsultation
post /sessions/consultation (EmptyResp) returns (ChatSession)
}
}