Commit f2530912 authored by StyleZhang's avatar StyleZhang

fix textarea padding

parent 024d03e8
...@@ -4,7 +4,6 @@ import React, { useEffect, useLayoutEffect, useRef, useState } from 'react' ...@@ -4,7 +4,6 @@ import React, { useEffect, useLayoutEffect, useRef, useState } from 'react'
import { useContext } from 'use-context-selector' import { useContext } from 'use-context-selector'
import cn from 'classnames' import cn from 'classnames'
import Recorder from 'js-audio-recorder' import Recorder from 'js-audio-recorder'
import { usePathname } from 'next/navigation'
import { HandThumbDownIcon, HandThumbUpIcon } from '@heroicons/react/24/outline' import { HandThumbDownIcon, HandThumbUpIcon } from '@heroicons/react/24/outline'
import { UserCircleIcon } from '@heroicons/react/24/solid' import { UserCircleIcon } from '@heroicons/react/24/solid'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
...@@ -187,7 +186,6 @@ const Answer: FC<IAnswerProps> = ({ item, feedbackDisabled = false, isHideFeedba ...@@ -187,7 +186,6 @@ const Answer: FC<IAnswerProps> = ({ item, feedbackDisabled = false, isHideFeedba
const [localAdminFeedback, setLocalAdminFeedback] = useState<Feedbacktype | undefined | null>(adminFeedback) const [localAdminFeedback, setLocalAdminFeedback] = useState<Feedbacktype | undefined | null>(adminFeedback)
const { userProfile } = useContext(AppContext) const { userProfile } = useContext(AppContext)
const { t } = useTranslation() const { t } = useTranslation()
const pathname = usePathname()
/** /**
* Render feedback results (distinguish between users and administrators) * Render feedback results (distinguish between users and administrators)
...@@ -252,18 +250,13 @@ const Answer: FC<IAnswerProps> = ({ item, feedbackDisabled = false, isHideFeedba ...@@ -252,18 +250,13 @@ const Answer: FC<IAnswerProps> = ({ item, feedbackDisabled = false, isHideFeedba
} }
const adminOperation = () => { const adminOperation = () => {
const inAppLogPage = /\/app\/.+\/logs/g.test(pathname)
return <div className='flex gap-1'> return <div className='flex gap-1'>
{
inAppLogPage && (
<Tooltip selector={`user-feedback-${randomString(16)}`} content={t('appLog.detail.operation.addAnnotation') as string}> <Tooltip selector={`user-feedback-${randomString(16)}`} content={t('appLog.detail.operation.addAnnotation') as string}>
{OperationBtn({ {OperationBtn({
innerContent: <IconWrapper><EditIcon className='hover:text-gray-800' /></IconWrapper>, innerContent: <IconWrapper><EditIcon className='hover:text-gray-800' /></IconWrapper>,
onClick: () => setShowEdit(true), onClick: () => setShowEdit(true),
})} })}
</Tooltip> </Tooltip>
)
}
{!localAdminFeedback?.rating && <> {!localAdminFeedback?.rating && <>
<Tooltip selector={`user-feedback-${randomString(16)}`} content={t('appLog.detail.operation.like') as string}> <Tooltip selector={`user-feedback-${randomString(16)}`} content={t('appLog.detail.operation.like') as string}>
{OperationBtn({ {OperationBtn({
...@@ -584,7 +577,7 @@ const Chat: FC<IChatProps> = ({ ...@@ -584,7 +577,7 @@ const Chat: FC<IChatProps> = ({
minHeight={48} minHeight={48}
autoFocus autoFocus
controlFocus={controlFocus} controlFocus={controlFocus}
className={`${cn(s.textArea)} resize-none block w-full pl-3 bg-gray-50 border border-gray-200 rounded-md focus:outline-none sm:text-sm text-gray-700`} className={`${cn(s.textArea)} ${isShowSpeechToText ? 'pr-[130px]' : 'pr-[90px]'} resize-none block w-full pl-3 bg-gray-50 border border-gray-200 rounded-md focus:outline-none sm:text-sm text-gray-700`}
/> />
<div className="absolute top-0 right-2 flex items-center h-[48px]"> <div className="absolute top-0 right-2 flex items-center h-[48px]">
<div className={`${s.count} mr-4 h-5 leading-5 text-sm bg-gray-50 text-gray-500`}>{query.trim().length}</div> <div className={`${s.count} mr-4 h-5 leading-5 text-sm bg-gray-50 text-gray-500`}>{query.trim().length}</div>
...@@ -627,7 +620,6 @@ const Chat: FC<IChatProps> = ({ ...@@ -627,7 +620,6 @@ const Chat: FC<IChatProps> = ({
{ {
voiceInputShow && ( voiceInputShow && (
<VoiceInput <VoiceInput
isPublic={displayScene === 'web'}
onCancel={() => setVoiceInputShow(false)} onCancel={() => setVoiceInputShow(false)}
onConverted={text => setQuery(text)} onConverted={text => setQuery(text)}
/> />
......
...@@ -79,7 +79,6 @@ ...@@ -79,7 +79,6 @@
.textArea { .textArea {
padding-top: 13px; padding-top: 13px;
padding-bottom: 13px; padding-bottom: 13px;
padding-right: 90px;
border-radius: 12px; border-radius: 12px;
line-height: 20px; line-height: 20px;
background-color: #fff; background-color: #fff;
......
...@@ -389,7 +389,6 @@ const Debug: FC<IDebug> = ({ ...@@ -389,7 +389,6 @@ const Debug: FC<IDebug> = ({
}} }}
isShowSuggestion={doShowSuggestion} isShowSuggestion={doShowSuggestion}
suggestionList={suggestQuestions} suggestionList={suggestQuestions}
displayScene='console'
isShowSpeechToText={speechToTextConfig.enabled} isShowSpeechToText={speechToTextConfig.enabled}
/> />
</div> </div>
......
...@@ -10,13 +10,11 @@ import { Loading02, XClose } from '@/app/components/base/icons/src/vender/line/g ...@@ -10,13 +10,11 @@ import { Loading02, XClose } from '@/app/components/base/icons/src/vender/line/g
import { audioToText } from '@/service/share' import { audioToText } from '@/service/share'
type VoiceInputTypes = { type VoiceInputTypes = {
isPublic: boolean
onConverted: (text: string) => void onConverted: (text: string) => void
onCancel: () => void onCancel: () => void
} }
const VoiceInput = ({ const VoiceInput = ({
isPublic,
onCancel, onCancel,
onConverted, onConverted,
}: VoiceInputTypes) => { }: VoiceInputTypes) => {
...@@ -80,9 +78,11 @@ const VoiceInput = ({ ...@@ -80,9 +78,11 @@ const VoiceInput = ({
formData.append('file', wavFile) formData.append('file', wavFile)
let url = '' let url = ''
let isPublic = false
if (params.token) { if (params.token) {
url = '/audio-to-text' url = '/audio-to-text'
isPublic = true
} }
else if (params.appId) { else if (params.appId) {
if (pathname.search('explore/installed') > -1) if (pathname.search('explore/installed') > -1)
......
...@@ -29,7 +29,7 @@ const InstalledApp: FC<IInstalledAppProps> = ({ ...@@ -29,7 +29,7 @@ const InstalledApp: FC<IInstalledAppProps> = ({
<div className='h-full p-2'> <div className='h-full p-2'>
{installedApp?.app.mode === 'chat' {installedApp?.app.mode === 'chat'
? ( ? (
<ChatApp isInstalledApp installedAppInfo={installedApp} displayScene='console' /> <ChatApp isInstalledApp installedAppInfo={installedApp} />
) )
: ( : (
<TextGenerationApp isInstalledApp installedAppInfo={installedApp}/> <TextGenerationApp isInstalledApp installedAppInfo={installedApp}/>
......
...@@ -17,7 +17,7 @@ import Header from '@/app/components/share/header' ...@@ -17,7 +17,7 @@ import Header from '@/app/components/share/header'
import { delConversation, fetchAppInfo, fetchAppParams, fetchChatList, fetchConversations, fetchSuggestedQuestions, pinConversation, sendChatMessage, stopChatMessageResponding, unpinConversation, updateFeedback } from '@/service/share' import { delConversation, fetchAppInfo, fetchAppParams, fetchChatList, fetchConversations, fetchSuggestedQuestions, pinConversation, sendChatMessage, stopChatMessageResponding, unpinConversation, updateFeedback } from '@/service/share'
import type { ConversationItem, SiteInfo } from '@/models/share' import type { ConversationItem, SiteInfo } from '@/models/share'
import type { PromptConfig, SuggestedQuestionsAfterAnswerConfig } from '@/models/debug' import type { PromptConfig, SuggestedQuestionsAfterAnswerConfig } from '@/models/debug'
import type { DisplayScene, Feedbacktype, IChatItem } from '@/app/components/app/chat' import type { Feedbacktype, IChatItem } from '@/app/components/app/chat'
import Chat from '@/app/components/app/chat' import Chat from '@/app/components/app/chat'
import { changeLanguage } from '@/i18n/i18next-config' import { changeLanguage } from '@/i18n/i18next-config'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
...@@ -28,13 +28,11 @@ import type { InstalledApp } from '@/models/explore' ...@@ -28,13 +28,11 @@ import type { InstalledApp } from '@/models/explore'
import Confirm from '@/app/components/base/confirm' import Confirm from '@/app/components/base/confirm'
export type IMainProps = { export type IMainProps = {
displayScene?: DisplayScene
isInstalledApp?: boolean isInstalledApp?: boolean
installedAppInfo?: InstalledApp installedAppInfo?: InstalledApp
} }
const Main: FC<IMainProps> = ({ const Main: FC<IMainProps> = ({
displayScene = 'web',
isInstalledApp = false, isInstalledApp = false,
installedAppInfo, installedAppInfo,
}) => { }) => {
...@@ -624,7 +622,6 @@ const Main: FC<IMainProps> = ({ ...@@ -624,7 +622,6 @@ const Main: FC<IMainProps> = ({
controlFocus={controlFocus} controlFocus={controlFocus}
isShowSuggestion={doShowSuggestion} isShowSuggestion={doShowSuggestion}
suggestionList={suggestQuestions} suggestionList={suggestQuestions}
displayScene={displayScene}
isShowSpeechToText={speechToTextConfig?.enabled} isShowSpeechToText={speechToTextConfig?.enabled}
/> />
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment