saw-go/proto/tool.go

276 lines
9.6 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 {
2025-04-28 13:42:22 +08:00
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"`
2025-04-28 13:14:51 +08:00
}
2025-04-28 21:16:35 +08:00
type GoogleOAuthResponse struct {
AccessToken string `json:"access_token"`
ExpiresIn int `json:"expires_in"`
Scope string `json:"scope"`
TokenType string `json:"token_type"`
IDToken string `json:"id_token"` // id_token
2025-04-28 21:16:35 +08:00
}
type GoogleOAuthRequest struct {
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
Code string `json:"code"`
RedirectURI string `json:"redirect_uri"`
GrantType string `json:"grant_type"` // authorization_code
2025-04-28 21:16:35 +08:00
}
2025-04-28 13:14:51 +08:00
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 {
2025-04-28 13:39:20 +08:00
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
Code string `json:"code"`
RedirectURI string `json:"redirect_uri" `
2025-04-28 13:38:42 +08:00
//'grant_type': 'authorization_code',
GrantType string `json:"grant_type"`
}
2025-04-30 14:37:36 +08:00
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"` // 第三方平台用户主页,可选
// 其他信息
}
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"` // 用户主页
}
2025-04-30 14:37:36 +08:00
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
PostType string `json:"post_type" form:"post_type"` // post请求类型,form,json
Url string `json:"url" form:"url"` // 请求地址
Data any `json:"data" form:"data"` // 请求数据
Header []OutlineServerReqData `json:"header" form:"header"` // 请求头
}
type OutlineServerReqData struct {
2025-04-29 11:35:43 +08:00
Key string `json:"key" form:"key"` // 请求的key
Value string `json:"value" form:"value"` // 请求的值
}
type OnlineServerRespData struct {
Response string `json:"response"` // 响应数据
}
type OutlineServerResp struct {
2025-04-29 11:35:43 +08:00
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"` // 响应数据
}
2025-04-30 14:37:36 +08:00
// 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
}
2025-05-01 12:54:54 +08:00
/**************************facebook****************************/
type FacebookOAuthResponse struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresIn int `json:"expires_in"`
}
type FaceBookOAuthRequest struct {
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
Code string `json:"code"`
RedirectURI string `json:"redirect_uri"`
}
type FaceBookUserInfoResp struct {
ID string `json:"id"`
Name string `json:"name"`
Picture FaceBookUserInfoPicture `json:"picture"`
}
type FaceBookUserInfoPicture struct {
Data FaceBookUserInfoPictureData `json:"data"`
}
type FaceBookUserInfoPictureData struct {
Height int `json:"height"`
Width int `json:"width"`
IsSilhouette bool `json:"is_silhouette"`
Url string `json:"url"`
}
2025-05-06 11:16:55 +08:00
/***************************Stackoverflow****************************/
type StackoverflowOAuthResponse struct {
AccessToken string `json:"access_token"`
Expires int `json:"expires"`
}
type StackoverflowUserInfoBadgeCounts struct {
Bronze int `json:"bronze"`
Silver int `json:"silver"`
Gold int `json:"gold"`
}
type StackoverflowUserInfo struct {
BadgeCounts StackoverflowUserInfoBadgeCounts `json:"badge_counts"`
AccountID int `json:"account_id"`
IsEmployee bool `json:"is_employee"`
LastAccessDate int `json:"last_access_date"`
ReputationChangeYear int `json:"reputation_change_year"`
ReputationChangeQuarter int `json:"reputation_change_quarter"`
ReputationChangeMonth int `json:"reputation_change_month"`
ReputationChangeWeek int `json:"reputation_change_week"`
ReputationChangeDay int `json:"reputation_change_day"`
Reputation int `json:"reputation"`
CreationDate int `json:"creation_date"`
UserType string `json:"user_type"`
UserID int `json:"user_id"`
Link string `json:"link"`
ProfileImage string `json:"profile_image"`
DisplayName string `json:"display_name"`
}
type StackoverflowUserInfoResponse struct {
Items []StackoverflowUserInfo `json:"items"`
HasMore bool `json:"has_more"`
Backoff int `json:"backoff"`
QuotaMax int `json:"quota_max"`
QuotaRemaining int `json:"quota_remaining"`
}