saw-go/proto/tool.go

198 lines
6.4 KiB
Go

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"`
}
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"`
}
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"`
}
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"` // 文件名称
}
// 第三方登录
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时需要
}
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"`
}
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"`
Error string `json:"error"`
ErrorDescription string `json:"error_description"`
}
type GoogleOAuthResponse struct {
}
type GoogleOAuthRequest struct {
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
Code string `json:"code"`
}
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"`
}
type GiteeOAuthRequest struct {
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
Code string `json:"code"`
RedirectURI string `json:"redirect_uri" `
//'grant_type': 'authorization_code',
GrantType string `json:"grant_type"`
}
type ThirdPartyUserInfo struct {
UserID string `json:"user_id"` // 第三方用户ID
Email string `json:"email"` // 第三方平台用户邮箱
Avatar string `json:"avatar"` // 第三方平台用户头像
Name string `json:"name"` // 第三方平台用户名
Url string `json:"url"` // 第三方平台用户主页,可选
// 其他信息
}
// github返回用户信息
type GitHubUserInfo struct {
LoginUserName string `json:"login"` // 用户名
UserID int `json:"id"` // 用户ID
AvatarUrl string `json:"avatar_url"` //头像
Url string `json:"url"` // 用户主页
}
type GoogleUserInfoResp struct {
ID string `json:"id"`
Email string `json:"email"`
VerifiedEmail bool `json:"verified_email"`
Name string `json:"name"`
GivenName string `json:"given_name"`
FamilyName string `json:"family_name"`
Picture string `json:"picture"`
}
// 国外服务器负责请求的请求
type OnlineServerReq struct {
Type string `json:"type" form:"type"` // 请求类型,get,post
Url string `json:"url" form:"url"` // 请求地址
Data any `json:"data" form:"data"` // 请求数据
Header []OutlineServerReqData `json:"header" form:"header"` // 请求头
}
type OutlineServerReqData struct {
Key string `json:"key" form:"key"` // 请求的key
Value string `json:"value" form:"value"` // 请求的值
}
type OnlineServerRespData struct {
Response string `json:"response"` // 响应数据
}
type OutlineServerResp struct {
Request OnlineServerReq `json:"request" form:"request"` // 请求
Response OnlineServerRespData `json:"response" form:"response"` // 响应
}
type OutlineServerReqResp struct {
Code int `json:"code"` // 响应码
Message string `json:"message"` // 响应信息
Data OutlineServerResp `json:"data"` // 响应数据
}
// google回调信息
type GoogleOAuthCallback struct {
Code string `json:"code"` // code
AccessToken string `json:"access_token"` // access_token
Scope string `json:"scope"` // scope
State string `json:"state"` // state
}