saw-go/proto/tool.go

129 lines
4.0 KiB
Go
Raw Normal View History

2025-03-31 15:36:34 +08:00
package proto
// 基础统计信息,会话数,问答数,用户数,今日处理问答数
type DashBoardStatisticsSt struct {
SessionNum int64 `json:"session_num"`
MessageCount int64 `json:"message_count"`
UserCount int64 `json:"user_count"`
TodayMessageCount int64 `json:"today_message_count"`
}
// 统计过去一周每天的会话数、消息数
type DashBoardStatisticsWeekSt struct {
SessionCount []DashBoardStatisticsWeekCount `json:"session_count"`
MessageCount []DashBoardStatisticsWeekCount `json:"message_count"`
}
type DashBoardStatisticsWeekCount struct {
Count int64 `json:"count"`
}
2025-03-31 15:36:34 +08:00
type DashBoardStatisticsResp struct {
DashBoardStatisticsSt DashBoardStatisticsSt `json:"dashboard_statistics_st"`
DashBoardStatisticsWeekSt DashBoardStatisticsWeekSt `json:"dashboard_statistics_week"`
// 模型的使用统计
DashBoardStatisticsModelSt []MessageModelIDCountSt `json:"dashboard_statistics_model_st"`
}
type MessageModelIDCountSt struct {
ModelID uint `json:"model_id"`
ModelName string `json:"name"`
Count int `json:"value"`
2025-03-31 15:36:34 +08:00
}
type FileContentReq struct {
UserFileID int `json:"user_file_id" form:"user_file_id"` // 用户文件ID
FileID int `json:"file_id" form:"file_id"` // 文件ID
FileContent string `json:"file_content" form:"file_content"` // 文件内容
}
type FileContentResp struct {
Code int `json:"code"`
Message string `json:"message"`
Data any `json:"data"`
}
2025-04-08 15:58:29 +08:00
type GenerateResp struct {
Code int `json:"code"`
Message string `json:"message"`
Data any `json:"data"`
}
type MessageConvertFileReq struct {
MessageID int `json:"message_id" form:"message_id"` // 消息ID
FileType string `json:"file_type" form:"file_type"` // 需要转成的文件类型
FileName string `json:"file_name" form:"file_name"` // 文件名称
}
2025-04-26 10:40:08 +08:00
// 第三方登录
type ThirdPartyLoginStatus struct {
Status int `json:"status"` // 登录状态,0:登录成功,1:登录失败
Type string `json:"type"` // 登录类型,qq,github
UserInfo UserLoginInfo `json:"user_info"` // 用户信息
}
type UserLoginInfo struct {
UserID int `json:"id"` // 用户ID
Username string `json:"username"` // 用户名
Email string `json:"email"` // 用户邮箱
Token string `json:"token"` // 用户token
}
// 第三方登录state
type ThirdPartyLoginState struct {
UUID string `json:"uuid"` // uuid
Type string `json:"type"` // 操作类型add,login
Project string `json:"project"` // 项目名称,saw
//第三方平台
Platform string `json:"platform"` // 平台名称,qq,github
UserID int `json:"user_id"` // 用户ID,当为add时需要
}
2025-04-28 13:14:51 +08:00
type OAuthResponse struct {
AccessToken string `json:"access_token"` // access_token
}
// github
type GitHubOAuthResponse struct {
AccessToken string `json:"access_token"`
Scope string `json:"scope"`
TokenType string `json:"token_type"`
}
2025-04-28 13:14:51 +08:00
type GiteeOAuthTokenResponse struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresIn int `json:"expires_in"`
RefreshToken string `json:"refresh_token"`
Scope string `json:"scope"`
CreatedAt int `json:"created_at"`
}
type OAuthGetTokenRequest struct {
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
Code string `json:"code"`
RedirectURI string `json:"redirect_uri" `
}
type GitHubOAuthRequest struct {
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
Code string `json:"code"`
RedirectURI string `json:"redirect_uri"`
}
2025-04-27 10:00:19 +08:00
2025-04-28 13:38:42 +08:00
type GiteeOAuthRequest struct {
OAuthGetTokenRequest
//'grant_type': 'authorization_code',
GrantType string `json:"grant_type"`
}
2025-04-27 10:00:19 +08:00
// github返回用户信息
type GitHubUserInfo struct {
LoginUserName string `json:"login"` // 用户名
UserID int `json:"id"` // 用户ID
AvatarUrl string `json:"avatar_url"` //头像
Url string `json:"url"` // 用户主页
}