diff --git a/api/go/.gitignore b/api/go/.gitignore index f83ae784..d93a4fa5 100644 --- a/api/go/.gitignore +++ b/api/go/.gitignore @@ -16,3 +16,4 @@ tmp bin data config.toml +static/upload diff --git a/api/go/core/app_server.go b/api/go/core/app_server.go index 989f2640..aae63391 100644 --- a/api/go/core/app_server.go +++ b/api/go/core/app_server.go @@ -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 { diff --git a/api/go/core/config.go b/api/go/core/config.go index 06820da6..f32f76b0 100644 --- a/api/go/core/config.go +++ b/api/go/core/config.go @@ -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), diff --git a/api/go/core/types/config.go b/api/go/core/types/config.go index 3b623da1..ede1f7df 100644 --- a/api/go/core/types/config.go +++ b/api/go/core/types/config.go @@ -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 管理员 diff --git a/api/go/handler/user_handler.go b/api/go/handler/user_handler.go index 02a182d3..ea6b61a4 100644 --- a/api/go/handler/user_handler.go +++ b/api/go/handler/user_handler.go @@ -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) } diff --git a/api/go/static/hello.txt b/api/go/static/hello.txt new file mode 100644 index 00000000..270c611e --- /dev/null +++ b/api/go/static/hello.txt @@ -0,0 +1 @@ +hello, world! diff --git a/api/go/store/vo/user.go b/api/go/store/vo/user.go index 95b6a5ba..987b750e 100644 --- a/api/go/store/vo/user.go +++ b/api/go/store/vo/user.go @@ -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 } diff --git a/web/src/components/mobile/ChatPrompt.vue b/web/src/components/mobile/ChatPrompt.vue index 23b5c4d5..01bda6e9 100644 --- a/web/src/components/mobile/ChatPrompt.vue +++ b/web/src/components/mobile/ChatPrompt.vue @@ -47,7 +47,7 @@ onMounted(() => { margin-left 5px .van-image { - width 25px + width 32px img { border-radius 5px @@ -73,7 +73,7 @@ onMounted(() => { .content { word-break break-word; - padding: 6px 10px; + padding: 5px 10px; background-color: #98E165; color #444444 font-size: 16px diff --git a/web/src/components/mobile/ChatReply.vue b/web/src/components/mobile/ChatReply.vue index 8b33fb33..ca8be51b 100644 --- a/web/src/components/mobile/ChatReply.vue +++ b/web/src/components/mobile/ChatReply.vue @@ -56,7 +56,7 @@ onMounted(() => { margin-right 5px .van-image { - width 25px + width 32px img { border-radius 5px @@ -92,7 +92,7 @@ onMounted(() => { overflow-x auto min-height 20px; word-break break-word; - padding: 6px 10px; + padding: 5px 10px; color #444444 background-color: #ffffff; font-size: 16px diff --git a/web/src/main.js b/web/src/main.js index 37681649..bb1e6fb7 100644 --- a/web/src/main.js +++ b/web/src/main.js @@ -25,6 +25,7 @@ import { ShareSheet, Sticky, SwipeCell, + Switch, Tabbar, TabbarItem, TextEllipsis @@ -56,6 +57,7 @@ app.use(Sticky); app.use(SwipeCell); app.use(Dialog); app.use(ShareSheet); +app.use(Switch); app.use(router).use(ElementPlus).mount('#app') diff --git a/web/src/views/mobile/ChatList.vue b/web/src/views/mobile/ChatList.vue index f0a3f5b0..59e98b69 100644 --- a/web/src/views/mobile/ChatList.vue +++ b/web/src/views/mobile/ChatList.vue @@ -227,20 +227,22 @@ const removeChat = (item) => { \ No newline at end of file