mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-07-03 13:26:04 +08:00
fix: did not properly display custom model name
This commit is contained in:
@@ -67,10 +67,7 @@ Browser.runtime.onConnect.addListener((port) => {
|
||||
if (!session) return
|
||||
const config = await getUserConfig()
|
||||
if (!session.modelName) session.modelName = config.modelName
|
||||
if (!session.aiName)
|
||||
session.aiName =
|
||||
Models[session.modelName].desc +
|
||||
(isUsingCustomModel(config) ? ` (${config.customModelName})` : '')
|
||||
if (!session.aiName) session.aiName = Models[session.modelName].desc
|
||||
port.postMessage({ session })
|
||||
|
||||
try {
|
||||
|
||||
@@ -222,7 +222,7 @@ function ConversationCard(props) {
|
||||
required
|
||||
onChange={(e) => {
|
||||
const modelName = e.target.value
|
||||
const newSession = { ...session, modelName, aiName: t(Models[modelName].desc) }
|
||||
const newSession = { ...session, modelName, aiName: Models[modelName].desc }
|
||||
if (config.autoRegenAfterSwitchModel) getRetryFn(newSession)()
|
||||
else setSession(newSession)
|
||||
}}
|
||||
|
||||
@@ -4,10 +4,13 @@ import CopyButton from '../CopyButton'
|
||||
import PropTypes from 'prop-types'
|
||||
import MarkdownRender from '../MarkdownRender/markdown.jsx'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { isUsingCustomModel } from '../../config/index.mjs'
|
||||
import { useConfig } from '../../hooks/use-config.mjs'
|
||||
|
||||
export function ConversationItem({ type, content, session, done, port, onRetry }) {
|
||||
const { t } = useTranslation()
|
||||
const [collapsed, setCollapsed] = useState(false)
|
||||
const config = useConfig()
|
||||
|
||||
switch (type) {
|
||||
case 'question':
|
||||
@@ -44,7 +47,11 @@ export function ConversationItem({ type, content, session, done, port, onRetry }
|
||||
<div className={type} dir="auto">
|
||||
<div className="gpt-header">
|
||||
<p style="white-space: nowrap;">
|
||||
{session && session.aiName ? `${t(session.aiName)}:` : t('Loading...')}
|
||||
{session && session.aiName
|
||||
? `${t(session.aiName)}${
|
||||
isUsingCustomModel(session) ? ' (' + config.customModelName + ')' : ''
|
||||
}:`
|
||||
: t('Loading...')}
|
||||
</p>
|
||||
<div className="gpt-util-group">
|
||||
{!done && (
|
||||
|
||||
Reference in New Issue
Block a user