Compare commits

..

5 Commits

Author SHA1 Message Date
RockYang
53fa4a20e9 chore: change ubuntu docker image with aliyun 2023-06-29 15:56:11 +08:00
RockYang
43c1de51f5 chore: add test code for fix role icon url of db 2023-06-29 08:58:19 +08:00
RockYang
7eb8c5ec35 fix: 修正前端 user_init_call 字段错误和用户注册初始化头像路径问题 2023-06-28 20:01:44 +08:00
RockYang
296bf63196 fix: 修复 PC 端聊天界面滚动条问题 2023-06-28 18:16:28 +08:00
RockYang
6c65a21692 opt: 优化启动参数接收处理 2023-06-28 05:51:55 +08:00
8 changed files with 22 additions and 9 deletions

View File

@@ -108,6 +108,7 @@ func sessionMiddleware(config *types.AppConfig) gin.HandlerFunc {
store = cookie.NewStore([]byte(config.Session.SecretKey)) store = cookie.NewStore([]byte(config.Session.SecretKey))
break break
default: default:
config.Session.Driver = types.SessionDriverCookie
store = cookie.NewStore([]byte(config.Session.SecretKey)) store = cookie.NewStore([]byte(config.Session.SecretKey))
} }

View File

@@ -113,8 +113,11 @@ func (h *ManagerHandler) Migrate(c *gin.Context) {
var message []model.HistoryMessage var message []model.HistoryMessage
h.db.Find(&message) h.db.Find(&message)
for _, r := range message { for _, r := range message {
r.Icon = "/" + r.Icon if !strings.HasPrefix(r.Icon, "/") {
h.db.Updates(&r) r.Icon = "/" + r.Icon
h.db.Updates(&r)
}
} }
break break

View File

@@ -72,7 +72,7 @@ func (h *UserHandler) Register(c *gin.Context) {
Username: data.Username, Username: data.Username,
Password: utils.GenPassword(data.Password, salt), Password: utils.GenPassword(data.Password, salt),
Nickname: fmt.Sprintf("极客学长@%d", utils.RandomNumber(5)), Nickname: fmt.Sprintf("极客学长@%d", utils.RandomNumber(5)),
Avatar: "images/avatar/user.png", Avatar: "/images/avatar/user.png",
Salt: salt, Salt: salt,
Status: true, Status: true,
ChatRoles: utils.JsonEncode(roleKeys), ChatRoles: utils.JsonEncode(roleKeys),

View File

@@ -45,7 +45,16 @@ func (l *AppLifecycle) OnStop(context.Context) error {
func main() { func main() {
configFile := os.Getenv("CONFIG_FILE") configFile := os.Getenv("CONFIG_FILE")
debug, _ := strconv.ParseBool(os.Getenv("DEBUG")) if configFile == "" {
configFile = "config.toml"
}
var debug bool
debugEnv := os.Getenv("DEBUG")
if debugEnv == "" {
debug = true
} else {
debug, _ = strconv.ParseBool(os.Getenv("DEBUG"))
}
logger.Info("Loading config file: ", configFile) logger.Info("Loading config file: ", configFile)
defer func() { defer func() {
if err := recover(); err != nil { if err := recover(); err != nil {

View File

@@ -1,5 +1,5 @@
# GO api docker 镜像创建 # GO api docker 镜像创建
FROM ubuntu:22.04 FROM registry.cn-hangzhou.aliyuncs.com/geekmaster/ubuntu-ca:22.04
MAINTAINER yangjian<yangjian102621@163.com> MAINTAINER yangjian<yangjian102621@163.com>

View File

@@ -81,8 +81,8 @@ import {httpGet, httpPost} from "@/utils/http";
import {ElMessage} from "element-plus"; import {ElMessage} from "element-plus";
import {Plus} from "@element-plus/icons-vue"; import {Plus} from "@element-plus/icons-vue";
import Compressor from "compressorjs"; import Compressor from "compressorjs";
import {showNotify} from "vant";
// eslint-disable-next-line no-undef
const props = defineProps({ const props = defineProps({
show: Boolean, show: Boolean,
user: Object, user: Object,
@@ -140,6 +140,7 @@ const afterRead = (file) => {
}); });
}; };
// eslint-disable-next-line no-undef
const emits = defineEmits(['hide', 'update-user']); const emits = defineEmits(['hide', 'update-user']);
const save = function () { const save = function () {
httpPost('/api/user/profile/update', form.value).then(() => { httpPost('/api/user/profile/update', form.value).then(() => {

View File

@@ -310,7 +310,7 @@ const getRoleById = function (rid) {
const resizeElement = function () { const resizeElement = function () {
chatBoxHeight.value = window.innerHeight - 51 - 82 - 38; chatBoxHeight.value = window.innerHeight - 51 - 82 - 38;
mainWinHeight.value = window.innerHeight - 51; mainWinHeight.value = window.innerHeight - 51;
leftBoxHeight.value = window.innerHeight - 43 - 47 - 44; leftBoxHeight.value = window.innerHeight - 43 - 47 - 45;
}; };
// 新建会话 // 新建会话

View File

@@ -10,7 +10,7 @@
<el-input v-model="system['admin_title']"/> <el-input v-model="system['admin_title']"/>
</el-form-item> </el-form-item>
<el-form-item label="注册赠送次数" prop="init_calls"> <el-form-item label="注册赠送次数" prop="init_calls">
<el-input v-model.number="system['init_calls']" placeholder="新用户注册赠送对话次数"/> <el-input v-model.number="system['user_init_calls']" placeholder="新用户注册赠送对话次数"/>
</el-form-item> </el-form-item>
<el-alert type="info" show-icon :closable="false"> <el-alert type="info" show-icon :closable="false">
<p>在这里维护前端聊天页面可用的 GPT 模型列表</p> <p>在这里维护前端聊天页面可用的 GPT 模型列表</p>
@@ -84,7 +84,6 @@ const system = ref({models: []})
const chat = ref({}) const chat = ref({})
const loading = ref(true) const loading = ref(true)
const systemFormRef = ref(null) const systemFormRef = ref(null)
const tempModel = ref('')
const models = ref([]) const models = ref([])
onMounted(() => { onMounted(() => {