Skip to content

Commit

Permalink
在AI信息上方显示模型名称
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Mar 16, 2024
1 parent f9c13df commit 1bfdcd0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions web/src/typings/chat.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare namespace Chat {
loading?: boolean
conversationOptions?: ConversationRequest | null
tokens?: number
model?: string
}

interface History {
Expand Down
4 changes: 4 additions & 0 deletions web/src/views/chat/components/Message/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface Props {
loading?: boolean
tokens?: number
tokenPrefix?: string
model?: string
}
interface Emit {
Expand Down Expand Up @@ -106,6 +107,9 @@ async function handleCopy() {
<div class="overflow-hidden text-sm " :class="[inversion ? 'items-end' : 'items-start']">
<p class="text-xs text-[#b4bbc4]" :class="[inversion ? 'text-right' : 'text-left']">
{{ (new Date((dateTime ?? 0) * 1000)).toLocaleString() }}
<template v-if="!inversion && model">
| {{ model }}
</template>
<template v-if="undefined !== tokens">
| {{ tokenPrefix }}Tokens:{{ tokens }}
</template>
Expand Down
4 changes: 4 additions & 0 deletions web/src/views/chat/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ async function fetchStream() {
error: false,
loading: true,
tokens: data.message.tokens,
model: data.message.config.model ?? null,
},
)
}
Expand Down Expand Up @@ -468,6 +469,7 @@ async function handleMessageNextPage() {
const response = await messageList(id, lastMessageId, messagePageSize)
for (const item of response.list) {
const resultItem: Chat.Chat = { ...item }
resultItem.model = item.config.model ?? null
resultItem.inversion = item.role === 'user'
chatStore.addChatByUuid(id, resultItem, 'unshift')
lastMessageId = item.recordId
Expand Down Expand Up @@ -520,6 +522,7 @@ onMounted(async () => {
const result: Chat.Chat[] = []
for (const item of messageResponse.list) {
const resultItem: Chat.Chat = { ...item }
resultItem.model = item.config.model ?? null
resultItem.inversion = item.role === 'user'
result.push(resultItem)
lastMessageId = item.recordId
Expand Down Expand Up @@ -602,6 +605,7 @@ onUnmounted(() => {
:error="item.error"
:loading="item.loading"
:tokens="item.tokens"
:model="item.model"
@delete="handleDelete(index)"
/>
</template>
Expand Down

0 comments on commit 1bfdcd0

Please sign in to comment.