Skip to content

Commit

Permalink
feat: text generation
Browse files Browse the repository at this point in the history
  • Loading branch information
crazywoola committed Jun 20, 2024
1 parent 2cf8392 commit b06579e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion web/app/components/app/text-generate/item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import EditReplyModal from '@/app/components/app/annotation/edit-annotation-moda
import { useStore as useAppStore } from '@/app/components/app/store'
import WorkflowProcessItem from '@/app/components/base/chat/chat/answer/workflow-process'
import type { WorkflowProcess } from '@/app/components/base/chat/types'
import type { SiteInfo } from '@/models/share'

const MAX_DEPTH = 3

Expand Down Expand Up @@ -62,6 +63,7 @@ export type IGenerationItemProps = {
contentClassName?: string
footerClassName?: string
hideProcessDetail?: boolean
siteInfo: SiteInfo | null
}

export const SimpleBtn = ({ className, isDisabled, onClick, children }: {
Expand Down Expand Up @@ -113,6 +115,7 @@ const GenerationItem: FC<IGenerationItemProps> = ({
innerClassName,
contentClassName,
hideProcessDetail,
siteInfo,
}) => {
const { t } = useTranslation()
const params = useParams()
Expand Down Expand Up @@ -152,6 +155,7 @@ const GenerationItem: FC<IGenerationItemProps> = ({
installedAppId,
controlClearMoreLikeThis,
isWorkflow,
siteInfo,
}

const handleMoreLikeThis = async () => {
Expand Down Expand Up @@ -297,7 +301,7 @@ const GenerationItem: FC<IGenerationItemProps> = ({
}
<div className={`flex ${contentClassName}`}>
<div className='grow w-0'>
{workflowProcessData && (
{siteInfo && siteInfo.workflow === 'show' && workflowProcessData && (
<WorkflowProcessItem grayBg hideInfo data={workflowProcessData} expand={workflowProcessData.expand} hideProcessDetail={hideProcessDetail} />
)}
{workflowProcessData && !isError && (
Expand Down
1 change: 1 addition & 0 deletions web/app/components/share/text-generation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ const TextGeneration: FC<IMainProps> = ({
visionConfig={visionConfig}
completionFiles={completionFiles}
isShowTextToSpeech={!!textToSpeechConfig?.enabled}
siteInfo={siteInfo}
/>)

const renderBatchRes = () => {
Expand Down
4 changes: 4 additions & 0 deletions web/app/components/share/text-generation/result/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { TransferMethod, type VisionFile, type VisionSettings } from '@/types/ap
import { NodeRunningStatus, WorkflowRunningStatus } from '@/app/components/workflow/types'
import type { WorkflowProcess } from '@/app/components/base/chat/types'
import { sleep } from '@/utils'
import type { SiteInfo } from '@/models/share'

export type IResultProps = {
isWorkflow: boolean
Expand All @@ -42,6 +43,7 @@ export type IResultProps = {
moderationService?: (text: string) => ReturnType<ModerationService>
visionConfig: VisionSettings
completionFiles: VisionFile[]
siteInfo: SiteInfo | null
}

const Result: FC<IResultProps> = ({
Expand All @@ -65,6 +67,7 @@ const Result: FC<IResultProps> = ({
onCompleted,
visionConfig,
completionFiles,
siteInfo,
}) => {
const [isResponding, { setTrue: setRespondingTrue, setFalse: setRespondingFalse }] = useBoolean(false)
useEffect(() => {
Expand Down Expand Up @@ -375,6 +378,7 @@ const Result: FC<IResultProps> = ({
controlClearMoreLikeThis={controlClearMoreLikeThis}
isShowTextToSpeech={isShowTextToSpeech}
hideProcessDetail
siteInfo={siteInfo}
/>
)

Expand Down
1 change: 1 addition & 0 deletions web/models/share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type SiteInfo = {
copyright?: string
privacy_policy?: string
custom_disclaimer?: string
workflow?: string
}

export type AppMeta = {
Expand Down

0 comments on commit b06579e

Please sign in to comment.