diff --git a/service/src/index.ts b/service/src/index.ts index 94bbd6df41..b5a99ff358 100644 --- a/service/src/index.ts +++ b/service/src/index.ts @@ -649,7 +649,7 @@ router.post('/user-info', auth, async (req, res) => { router.post('/user-chat-model', auth, async (req, res) => { try { - const { chatModel } = req.query as { chatModel: CHATMODEL } + const { chatModel } = req.body as { chatModel: CHATMODEL } const userId = req.headers.userId.toString() const user = await getUserById(userId) diff --git a/service/src/storage/mongo.ts b/service/src/storage/mongo.ts index ffbd301362..ea9d576315 100644 --- a/service/src/storage/mongo.ts +++ b/service/src/storage/mongo.ts @@ -223,10 +223,11 @@ export async function getUsers(page: number, size: number): Promise<{ users: Use export async function getUserById(userId: string): Promise { const userInfo = await userCol.findOne({ _id: new ObjectId(userId) }) as UserInfo - if (userInfo.config == null) { + if (userInfo.config == null) userInfo.config = new UserConfig() + if (userInfo.config.chatModel == null) userInfo.config.chatModel = 'gpt-3.5-turbo' - } + return userInfo } diff --git a/src/components/common/Setting/index.vue b/src/components/common/Setting/index.vue index 7f3712d37c..890a6b1362 100644 --- a/src/components/common/Setting/index.vue +++ b/src/components/common/Setting/index.vue @@ -100,7 +100,7 @@ const show = computed({ - +