Skip to content

Commit

Permalink
Merge pull request #14 from Kerwin1202/main
Browse files Browse the repository at this point in the history
fix: the model was not saved successfully(Close Chanzhaoyu#152)
  • Loading branch information
EvanDbg authored May 22, 2023
2 parents b80db6b + 1b120f8 commit 19b5d25
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions service/src/storage/mongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,11 @@ export async function getUsers(page: number, size: number): Promise<{ users: Use

export async function getUserById(userId: string): Promise<UserInfo> {
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
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/common/Setting/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const show = computed({
</template>
<Audit />
</NTabPane>
<NTabPane name="UserConfig" tab="UserConfig">
<NTabPane v-if="userStore.userInfo.root" name="UserConfig" tab="UserConfig">
<template #tab>
<SvgIcon class="text-lg" icon="ri-user-5-line" />
<span class="ml-2">{{ $t('setting.userConfig') }}</span>
Expand Down

0 comments on commit 19b5d25

Please sign in to comment.