Skip to content

Commit 1b120f8

Browse files
author
Kerwin
committed
fix: the model was not saved successfully(Close #152)
1 parent f161051 commit 1b120f8

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

service/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ router.post('/user-info', auth, async (req, res) => {
649649

650650
router.post('/user-chat-model', auth, async (req, res) => {
651651
try {
652-
const { chatModel } = req.query as { chatModel: CHATMODEL }
652+
const { chatModel } = req.body as { chatModel: CHATMODEL }
653653
const userId = req.headers.userId.toString()
654654

655655
const user = await getUserById(userId)

service/src/storage/mongo.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,11 @@ export async function getUsers(page: number, size: number): Promise<{ users: Use
223223

224224
export async function getUserById(userId: string): Promise<UserInfo> {
225225
const userInfo = await userCol.findOne({ _id: new ObjectId(userId) }) as UserInfo
226-
if (userInfo.config == null) {
226+
if (userInfo.config == null)
227227
userInfo.config = new UserConfig()
228+
if (userInfo.config.chatModel == null)
228229
userInfo.config.chatModel = 'gpt-3.5-turbo'
229-
}
230+
230231
return userInfo
231232
}
232233

src/components/common/Setting/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const show = computed({
100100
</template>
101101
<Audit />
102102
</NTabPane>
103-
<NTabPane name="UserConfig" tab="UserConfig">
103+
<NTabPane v-if="userStore.userInfo.root" name="UserConfig" tab="UserConfig">
104104
<template #tab>
105105
<SvgIcon class="text-lg" icon="ri-user-5-line" />
106106
<span class="ml-2">{{ $t('setting.userConfig') }}</span>

0 commit comments

Comments
 (0)