mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-19 03:05:56 +08:00
Feat/15534 support replacing the bot in chat input placeholder with the bots name (#20473)
This commit is contained in:
parent
91eeb2ab76
commit
8e2d342de6
@ -99,7 +99,15 @@ const DebugWithMultipleModel = () => {
|
|||||||
}, [twoLine, threeLine, fourLine])
|
}, [twoLine, threeLine, fourLine])
|
||||||
|
|
||||||
const setShowAppConfigureFeaturesModal = useAppStore(s => s.setShowAppConfigureFeaturesModal)
|
const setShowAppConfigureFeaturesModal = useAppStore(s => s.setShowAppConfigureFeaturesModal)
|
||||||
const inputsForm = modelConfig.configs.prompt_variables.filter(item => item.type !== 'api').map(item => ({ ...item, label: item.name, variable: item.key })) as InputForm[]
|
const inputsForm = modelConfig.configs.prompt_variables
|
||||||
|
.filter(item => item.type !== 'api')
|
||||||
|
.map(item => ({
|
||||||
|
...item,
|
||||||
|
label: item.name,
|
||||||
|
variable: item.key,
|
||||||
|
hide: item.hide ?? false,
|
||||||
|
required: item.required ?? false,
|
||||||
|
})) as InputForm[]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='flex h-full flex-col'>
|
<div className='flex h-full flex-col'>
|
||||||
@ -133,6 +141,7 @@ const DebugWithMultipleModel = () => {
|
|||||||
{isChatMode && (
|
{isChatMode && (
|
||||||
<div className='shrink-0 px-6 pb-0'>
|
<div className='shrink-0 px-6 pb-0'>
|
||||||
<ChatInputArea
|
<ChatInputArea
|
||||||
|
botName='Bot'
|
||||||
showFeatureBar
|
showFeatureBar
|
||||||
showFileUpload={false}
|
showFileUpload={false}
|
||||||
onFeatureBarClick={setShowAppConfigureFeaturesModal}
|
onFeatureBarClick={setShowAppConfigureFeaturesModal}
|
||||||
|
@ -29,6 +29,7 @@ import type { FileUpload } from '@/app/components/base/features/types'
|
|||||||
import { TransferMethod } from '@/types/app'
|
import { TransferMethod } from '@/types/app'
|
||||||
|
|
||||||
type ChatInputAreaProps = {
|
type ChatInputAreaProps = {
|
||||||
|
botName?: string
|
||||||
showFeatureBar?: boolean
|
showFeatureBar?: boolean
|
||||||
showFileUpload?: boolean
|
showFileUpload?: boolean
|
||||||
featureBarDisabled?: boolean
|
featureBarDisabled?: boolean
|
||||||
@ -43,6 +44,7 @@ type ChatInputAreaProps = {
|
|||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
}
|
}
|
||||||
const ChatInputArea = ({
|
const ChatInputArea = ({
|
||||||
|
botName,
|
||||||
showFeatureBar,
|
showFeatureBar,
|
||||||
showFileUpload,
|
showFileUpload,
|
||||||
featureBarDisabled,
|
featureBarDisabled,
|
||||||
@ -192,7 +194,7 @@ const ChatInputArea = ({
|
|||||||
className={cn(
|
className={cn(
|
||||||
'body-lg-regular w-full resize-none bg-transparent p-1 leading-6 text-text-tertiary outline-none',
|
'body-lg-regular w-full resize-none bg-transparent p-1 leading-6 text-text-tertiary outline-none',
|
||||||
)}
|
)}
|
||||||
placeholder={t('common.chat.inputPlaceholder') || ''}
|
placeholder={t('common.chat.inputPlaceholder', { botName }) || ''}
|
||||||
autoFocus
|
autoFocus
|
||||||
minRows={1}
|
minRows={1}
|
||||||
onResize={handleTextareaResize}
|
onResize={handleTextareaResize}
|
||||||
|
@ -303,6 +303,7 @@ const Chat: FC<ChatProps> = ({
|
|||||||
{
|
{
|
||||||
!noChatInput && (
|
!noChatInput && (
|
||||||
<ChatInputArea
|
<ChatInputArea
|
||||||
|
botName={appData?.site.title || ''}
|
||||||
disabled={inputDisabled}
|
disabled={inputDisabled}
|
||||||
showFeatureBar={showFeatureBar}
|
showFeatureBar={showFeatureBar}
|
||||||
showFileUpload={showFileUpload}
|
showFileUpload={showFileUpload}
|
||||||
|
@ -550,7 +550,7 @@ const translation = {
|
|||||||
vectorHash: 'Vektorhash:',
|
vectorHash: 'Vektorhash:',
|
||||||
hitScore: 'Abrufwertung:',
|
hitScore: 'Abrufwertung:',
|
||||||
},
|
},
|
||||||
inputPlaceholder: 'Sprechen Sie mit dem Bot',
|
inputPlaceholder: 'Sprechen Sie mit dem {{botName}}',
|
||||||
thought: 'Gedanke',
|
thought: 'Gedanke',
|
||||||
thinking: 'Denken...',
|
thinking: 'Denken...',
|
||||||
resend: 'Erneut senden',
|
resend: 'Erneut senden',
|
||||||
|
@ -569,7 +569,7 @@ const translation = {
|
|||||||
vectorHash: 'Vector hash:',
|
vectorHash: 'Vector hash:',
|
||||||
hitScore: 'Retrieval Score:',
|
hitScore: 'Retrieval Score:',
|
||||||
},
|
},
|
||||||
inputPlaceholder: 'Talk to Bot',
|
inputPlaceholder: 'Talk to {{botName}}',
|
||||||
thinking: 'Thinking...',
|
thinking: 'Thinking...',
|
||||||
thought: 'Thought',
|
thought: 'Thought',
|
||||||
resend: 'Resend',
|
resend: 'Resend',
|
||||||
|
@ -554,7 +554,7 @@ const translation = {
|
|||||||
vectorHash: 'Hash de vector:',
|
vectorHash: 'Hash de vector:',
|
||||||
hitScore: 'Puntuación de recuperación:',
|
hitScore: 'Puntuación de recuperación:',
|
||||||
},
|
},
|
||||||
inputPlaceholder: 'Hablar con el bot',
|
inputPlaceholder: 'Hablar con el {{botName}}',
|
||||||
thinking: 'Pensamiento...',
|
thinking: 'Pensamiento...',
|
||||||
thought: 'Pensamiento',
|
thought: 'Pensamiento',
|
||||||
resend: 'Reenviar',
|
resend: 'Reenviar',
|
||||||
|
@ -550,7 +550,7 @@ const translation = {
|
|||||||
vectorHash: 'Hachage vectoriel:',
|
vectorHash: 'Hachage vectoriel:',
|
||||||
hitScore: 'Score de Récupération:',
|
hitScore: 'Score de Récupération:',
|
||||||
},
|
},
|
||||||
inputPlaceholder: 'Parler au bot',
|
inputPlaceholder: 'Parler au {{botName}}',
|
||||||
thinking: 'Pensée...',
|
thinking: 'Pensée...',
|
||||||
thought: 'Pensée',
|
thought: 'Pensée',
|
||||||
resend: 'Renvoyer',
|
resend: 'Renvoyer',
|
||||||
|
@ -581,7 +581,7 @@ const translation = {
|
|||||||
vectorHash: 'Hash del vettore:',
|
vectorHash: 'Hash del vettore:',
|
||||||
hitScore: 'Punteggio di recupero:',
|
hitScore: 'Punteggio di recupero:',
|
||||||
},
|
},
|
||||||
inputPlaceholder: 'Parla con il bot',
|
inputPlaceholder: 'Parla con il {{botName}}',
|
||||||
thinking: 'Pensante...',
|
thinking: 'Pensante...',
|
||||||
thought: 'Pensiero',
|
thought: 'Pensiero',
|
||||||
resend: 'Reinvia',
|
resend: 'Reinvia',
|
||||||
|
@ -570,7 +570,7 @@ const translation = {
|
|||||||
vectorHash: 'ベクトルハッシュ:',
|
vectorHash: 'ベクトルハッシュ:',
|
||||||
hitScore: '検索スコア:',
|
hitScore: '検索スコア:',
|
||||||
},
|
},
|
||||||
inputPlaceholder: 'ボットと話す',
|
inputPlaceholder: '{{botName}} と話す',
|
||||||
thought: '思考',
|
thought: '思考',
|
||||||
thinking: '考え中...',
|
thinking: '考え中...',
|
||||||
resend: '再送信してください',
|
resend: '再送信してください',
|
||||||
|
@ -565,7 +565,7 @@ const translation = {
|
|||||||
vectorHash: 'Wektor hash:',
|
vectorHash: 'Wektor hash:',
|
||||||
hitScore: 'Wynik trafień:',
|
hitScore: 'Wynik trafień:',
|
||||||
},
|
},
|
||||||
inputPlaceholder: 'Porozmawiaj z botem',
|
inputPlaceholder: 'Porozmawiaj z {{botName}}',
|
||||||
thought: 'Myśl',
|
thought: 'Myśl',
|
||||||
thinking: 'Myślenie...',
|
thinking: 'Myślenie...',
|
||||||
resend: 'Prześlij ponownie',
|
resend: 'Prześlij ponownie',
|
||||||
|
@ -550,7 +550,7 @@ const translation = {
|
|||||||
vectorHash: 'Hash de vetor:',
|
vectorHash: 'Hash de vetor:',
|
||||||
hitScore: 'Pontuação de recuperação:',
|
hitScore: 'Pontuação de recuperação:',
|
||||||
},
|
},
|
||||||
inputPlaceholder: 'Fale com o bot',
|
inputPlaceholder: 'Fale com o {{botName}}',
|
||||||
thinking: 'Pensante...',
|
thinking: 'Pensante...',
|
||||||
thought: 'Pensamento',
|
thought: 'Pensamento',
|
||||||
resend: 'Reenviar',
|
resend: 'Reenviar',
|
||||||
|
@ -550,7 +550,7 @@ const translation = {
|
|||||||
vectorHash: 'Hash vector:',
|
vectorHash: 'Hash vector:',
|
||||||
hitScore: 'Scor de recuperare:',
|
hitScore: 'Scor de recuperare:',
|
||||||
},
|
},
|
||||||
inputPlaceholder: 'Vorbește cu Bot',
|
inputPlaceholder: 'Vorbește cu {{botName}}',
|
||||||
thinking: 'Gândire...',
|
thinking: 'Gândire...',
|
||||||
thought: 'Gând',
|
thought: 'Gând',
|
||||||
resend: 'Reexpediați',
|
resend: 'Reexpediați',
|
||||||
|
@ -554,7 +554,7 @@ const translation = {
|
|||||||
vectorHash: 'Vektör Hash:',
|
vectorHash: 'Vektör Hash:',
|
||||||
hitScore: 'Geri Alım Skoru:',
|
hitScore: 'Geri Alım Skoru:',
|
||||||
},
|
},
|
||||||
inputPlaceholder: 'Bot ile konuş',
|
inputPlaceholder: '{{botName}} ile konuş',
|
||||||
thought: 'Düşünce',
|
thought: 'Düşünce',
|
||||||
thinking: 'Düşünü...',
|
thinking: 'Düşünü...',
|
||||||
resend: 'Yeniden gönder',
|
resend: 'Yeniden gönder',
|
||||||
|
@ -550,7 +550,7 @@ const translation = {
|
|||||||
vectorHash: 'Vector hash:',
|
vectorHash: 'Vector hash:',
|
||||||
hitScore: 'Điểm truy xuất:',
|
hitScore: 'Điểm truy xuất:',
|
||||||
},
|
},
|
||||||
inputPlaceholder: 'Nói chuyện với Bot',
|
inputPlaceholder: 'Nói chuyện với {{botName}}',
|
||||||
thought: 'Tư duy',
|
thought: 'Tư duy',
|
||||||
thinking: 'Suy nghĩ...',
|
thinking: 'Suy nghĩ...',
|
||||||
resend: 'Gửi lại',
|
resend: 'Gửi lại',
|
||||||
|
@ -569,7 +569,7 @@ const translation = {
|
|||||||
vectorHash: '向量哈希:',
|
vectorHash: '向量哈希:',
|
||||||
hitScore: '召回得分:',
|
hitScore: '召回得分:',
|
||||||
},
|
},
|
||||||
inputPlaceholder: '和机器人聊天',
|
inputPlaceholder: '和 {{botName}} 聊天',
|
||||||
thinking: '深度思考中...',
|
thinking: '深度思考中...',
|
||||||
thought: '已深度思考',
|
thought: '已深度思考',
|
||||||
resend: '重新发送',
|
resend: '重新发送',
|
||||||
|
@ -552,7 +552,7 @@ const translation = {
|
|||||||
vectorHash: '向量雜湊:',
|
vectorHash: '向量雜湊:',
|
||||||
hitScore: '召回得分:',
|
hitScore: '召回得分:',
|
||||||
},
|
},
|
||||||
inputPlaceholder: '與 Bot 對話',
|
inputPlaceholder: '與 {{botName}} 對話',
|
||||||
thinking: '思維。。。',
|
thinking: '思維。。。',
|
||||||
thought: '思想',
|
thought: '思想',
|
||||||
resend: '重新發送',
|
resend: '重新發送',
|
||||||
|
@ -59,6 +59,7 @@ export type PromptVariable = {
|
|||||||
config?: Record<string, any>
|
config?: Record<string, any>
|
||||||
icon?: string
|
icon?: string
|
||||||
icon_background?: string
|
icon_background?: string
|
||||||
|
hide?: boolean // used in frontend to hide variable
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CompletionParams = {
|
export type CompletionParams = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user