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'
import { useContext } from 'use-context-selector'
import cn from 'classnames'
import Recorder from 'js-audio-recorder'
import { usePathname } from 'next/navigation'
import { HandThumbDownIcon, HandThumbUpIcon } from '@heroicons/react/24/outline'
import { UserCircleIcon } from '@heroicons/react/24/solid'
import { useTranslation } from 'react-i18next'
......@@ -187,7 +186,6 @@ const Answer: FC<IAnswerProps> = ({ item, feedbackDisabled = false, isHideFeedba
const [localAdminFeedback, setLocalAdminFeedback] = useState<Feedbacktype | undefined | null>(adminFeedback)
const { userProfile } = useContext(AppContext)
const { t } = useTranslation()
const pathname = usePathname()
/**
* Render feedback results (distinguish between users and administrators)
......@@ -252,18 +250,13 @@ const Answer: FC<IAnswerProps> = ({ item, feedbackDisabled = false, isHideFeedba
}
const adminOperation = () => {
const inAppLogPage = /\/app\/.+\/logs/g.test(pathname)
return <div className='flex gap-1'>
{
inAppLogPage && (
<Tooltip selector={`user-feedback-${randomString(16)}`} content={t('appLog.detail.operation.addAnnotation') as string}>
{OperationBtn({
innerContent: <IconWrapper><EditIcon className='hover:text-gray-800' /></IconWrapper>,
onClick: () => setShowEdit(true),
})}
</Tooltip>
)
}
<Tooltip selector={`user-feedback-${randomString(16)}`} content={t('appLog.detail.operation.addAnnotation') as string}>
{OperationBtn({
innerContent: <IconWrapper><EditIcon className='hover:text-gray-800' /></IconWrapper>,
onClick: () => setShowEdit(true),
})}
</Tooltip>
{!localAdminFeedback?.rating && <>
<Tooltip selector={`user-feedback-${randomString(16)}`} content={t('appLog.detail.operation.like') as string}>
{OperationBtn({
......@@ -584,7 +577,7 @@ const Chat: FC<IChatProps> = ({
minHeight={48}
autoFocus
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={`${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> = ({
{
voiceInputShow && (
<VoiceInput
isPublic={displayScene === 'web'}
onCancel={() => setVoiceInputShow(false)}
onConverted={text => setQuery(text)}
/>
......
......@@ -79,7 +79,6 @@
.textArea {
padding-top: 13px;
padding-bottom: 13px;
padding-right: 90px;
border-radius: 12px;
line-height: 20px;
background-color: #fff;
......
......@@ -389,7 +389,6 @@ const Debug: FC<IDebug> = ({
}}
isShowSuggestion={doShowSuggestion}
suggestionList={suggestQuestions}
displayScene='console'
isShowSpeechToText={speechToTextConfig.enabled}
/>
</div>
......
......@@ -10,13 +10,11 @@ import { Loading02, XClose } from '@/app/components/base/icons/src/vender/line/g
import { audioToText } from '@/service/share'
type VoiceInputTypes = {
isPublic: boolean
onConverted: (text: string) => void
onCancel: () => void
}
const VoiceInput = ({
isPublic,
onCancel,
onConverted,
}: VoiceInputTypes) => {
......@@ -80,9 +78,11 @@ const VoiceInput = ({
formData.append('file', wavFile)
let url = ''
let isPublic = false
if (params.token) {
url = '/audio-to-text'
isPublic = true
}
else if (params.appId) {
if (pathname.search('explore/installed') > -1)
......
......@@ -29,7 +29,7 @@ const InstalledApp: FC<IInstalledAppProps> = ({
<div className='h-full p-2'>
{installedApp?.app.mode === 'chat'
? (
<ChatApp isInstalledApp installedAppInfo={installedApp} displayScene='console' />
<ChatApp isInstalledApp installedAppInfo={installedApp} />
)
: (
<TextGenerationApp isInstalledApp installedAppInfo={installedApp}/>
......
......@@ -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 type { ConversationItem, SiteInfo } from '@/models/share'
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 { changeLanguage } from '@/i18n/i18next-config'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
......@@ -28,13 +28,11 @@ import type { InstalledApp } from '@/models/explore'
import Confirm from '@/app/components/base/confirm'
export type IMainProps = {
displayScene?: DisplayScene
isInstalledApp?: boolean
installedAppInfo?: InstalledApp
}
const Main: FC<IMainProps> = ({
displayScene = 'web',
isInstalledApp = false,
installedAppInfo,
}) => {
......@@ -624,7 +622,6 @@ const Main: FC<IMainProps> = ({
controlFocus={controlFocus}
isShowSuggestion={doShowSuggestion}
suggestionList={suggestQuestions}
displayScene={displayScene}
isShowSpeechToText={speechToTextConfig?.enabled}
/>
</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