mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-11 11:43:43 +08:00
feat: vue-mobile => 完成移动端聊天配置功能
This commit is contained in:
1
api/go/.gitignore
vendored
1
api/go/.gitignore
vendored
@@ -16,3 +16,4 @@ tmp
|
||||
bin
|
||||
data
|
||||
config.toml
|
||||
static/upload
|
||||
|
||||
@@ -51,6 +51,9 @@ func (s *AppServer) Init(debug bool) {
|
||||
s.Engine.Use(authorizeMiddleware(s))
|
||||
s.Engine.Use(errorHandler)
|
||||
//gob.Register(model.User{})
|
||||
|
||||
// 添加静态资源访问
|
||||
s.Engine.Static("/static", s.AppConfig.StaticDir)
|
||||
}
|
||||
|
||||
func (s *AppServer) Run(db *gorm.DB) error {
|
||||
|
||||
@@ -15,9 +15,10 @@ var logger = logger2.GetLogger()
|
||||
|
||||
func NewDefaultConfig() *types.AppConfig {
|
||||
return &types.AppConfig{
|
||||
Listen: "0.0.0.0:5678",
|
||||
ProxyURL: "",
|
||||
Manager: types.Manager{Username: "admin", Password: "admin123"},
|
||||
Listen: "0.0.0.0:5678",
|
||||
ProxyURL: "",
|
||||
Manager: types.Manager{Username: "admin", Password: "admin123"},
|
||||
StaticDir: "./static",
|
||||
|
||||
Session: types.Session{
|
||||
SecretKey: utils.RandString(64),
|
||||
|
||||
@@ -5,12 +5,13 @@ import (
|
||||
)
|
||||
|
||||
type AppConfig struct {
|
||||
Path string `toml:"-"`
|
||||
Listen string
|
||||
Session Session
|
||||
ProxyURL string
|
||||
MysqlDns string // mysql 连接地址
|
||||
Manager Manager // 后台管理员账户信息
|
||||
Path string `toml:"-"`
|
||||
Listen string
|
||||
Session Session
|
||||
ProxyURL string
|
||||
MysqlDns string // mysql 连接地址
|
||||
Manager Manager // 后台管理员账户信息
|
||||
StaticDir string // 静态资源目录
|
||||
}
|
||||
|
||||
// Manager 管理员
|
||||
|
||||
@@ -289,8 +289,6 @@ func (h *UserHandler) Profile(c *gin.Context) {
|
||||
}
|
||||
|
||||
userVo.Id = user.Id
|
||||
userVo.CreatedAt = user.CreatedAt.Unix()
|
||||
userVo.UpdatedAt = user.UpdatedAt.Unix()
|
||||
resp.SUCCESS(c, userVo)
|
||||
}
|
||||
|
||||
|
||||
1
api/go/static/hello.txt
Normal file
1
api/go/static/hello.txt
Normal file
@@ -0,0 +1 @@
|
||||
hello, world!
|
||||
@@ -4,16 +4,16 @@ import "chatplus/core/types"
|
||||
|
||||
type User struct {
|
||||
BaseVo
|
||||
Username string `json:"username"`
|
||||
Nickname string `json:"nickname"`
|
||||
Avatar string `json:"avatar"`
|
||||
Salt string `json:"salt"` // 密码盐
|
||||
Tokens int64 `json:"tokens"` // 剩余tokens
|
||||
Calls int `json:"calls"` // 剩余对话次数
|
||||
ChatConfig types.ChatConfig `json:"chat_config"` // 聊天配置
|
||||
ChatRoles []string `json:"chat_roles"` // 聊天角色集合
|
||||
ExpiredTime int64 `json:"expired_time"` // 账户到期时间
|
||||
Status bool `json:"status"` // 当前状态
|
||||
LastLoginAt int64 `json:"last_login_at"` // 最后登录时间
|
||||
LastLoginIp string `json:"last_login_ip"` // 最后登录 IP
|
||||
Username string `json:"username,omitempty"`
|
||||
Nickname string `json:"nickname,omitempty"`
|
||||
Avatar string `json:"avatar,omitempty"`
|
||||
Salt string `json:"salt,omitempty"` // 密码盐
|
||||
Tokens int64 `json:"tokens,omitempty"` // 剩余tokens
|
||||
Calls int `json:"calls,omitempty"` // 剩余对话次数
|
||||
ChatConfig types.ChatConfig `json:"chat_config,omitempty"` // 聊天配置
|
||||
ChatRoles []string `json:"chat_roles,omitempty"` // 聊天角色集合
|
||||
ExpiredTime int64 `json:"expired_time,omitempty"` // 账户到期时间
|
||||
Status bool `json:"status,omitempty"` // 当前状态
|
||||
LastLoginAt int64 `json:"last_login_at,omitempty"` // 最后登录时间
|
||||
LastLoginIp string `json:"last_login_ip,omitempty"` // 最后登录 IP
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user