chore: remove debug code

feat/enchance-prompt-and-code-fe
Joel 7 months ago
parent f60792bcc7
commit df95b6eba0

@ -131,8 +131,8 @@ const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
},
]
const [instruction, setInstruction] = useState<string>('The travel plan to Anshun of Guizhou Province in China') // TODO: test value
const [ideaOutput, setIdeaOutput] = useState<string>('use json format to output the result. Content in result uses Chinese. Format: {"summary: "summary content", "result": "result content"}')
const [instruction, setInstruction] = useState<string>('')
const [ideaOutput, setIdeaOutput] = useState<string>('')
const handleChooseTemplate = useCallback((key: string) => {
return () => {
@ -158,14 +158,6 @@ const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
storageKey,
})
// useEffect(() => {
// // if (!versions.length) {
// addVersion({
// modified: 'ddd',
// })
// // }
// }, [])
useEffect(() => {
if (defaultModel) {
const localModel = localStorage.getItem('auto-gen-model')
@ -364,15 +356,14 @@ const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
onClick={onGenerate}
disabled={isLoading}
>
<Generator className='h-4 w-4 text-white' />
<Generator className='h-4 w-4' />
<span className='text-xs font-semibold'>{t('appDebug.generate.generate')}</span>
</Button>
</div>
</div>
</div>
{/* {(!isLoading && res) && ( */}
{
{(!isLoading && current) && (
<div className='h-full w-0 grow p-6 pb-0'>
<Result
current={current!}
@ -383,7 +374,7 @@ const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
generatorType={GeneratorType.prompt}
/>
</div>
}
)}
{isLoading && renderLoading}
{isShowAutoPromptResPlaceholder() && !renderNoData}
{isShowConfirmOverwrite && (

@ -71,7 +71,7 @@ export const GetCodeGeneratorResModal: FC<IGetCodeGeneratorResProps> = (
defaultModel,
} = useModelListAndDefaultModelAndCurrentProviderAndModel(ModelTypeEnum.textGeneration)
const [instruction, setInstruction] = useState<string>('')
const [ideaOutput, setIdeaOutput] = useState<string>('Write comment in Janpanese')
const [ideaOutput, setIdeaOutput] = useState<string>('')
const [isLoading, { setTrue: setLoadingTrue, setFalse: setLoadingFalse }] = useBoolean(false)
const storageKey = `${flowId}-${nodeId}}`
@ -79,15 +79,6 @@ export const GetCodeGeneratorResModal: FC<IGetCodeGeneratorResProps> = (
storageKey,
})
// useEffect(() => {
// if (!versions?.length) {
// addVersion({
// modified: `def main(num1: float, num2: float) -> dict:
// return {'result': num1 + num2}`,
// })
// }
// }, [])
const isValid = () => {
if (instruction.trim() === '') {
Toast.notify({
@ -144,7 +135,7 @@ export const GetCodeGeneratorResModal: FC<IGetCodeGeneratorResProps> = (
message: error,
})
}
else {
else {
addVersion(res)
}
}
@ -247,7 +238,7 @@ export const GetCodeGeneratorResModal: FC<IGetCodeGeneratorResProps> = (
onClick={onGenerate}
disabled={isLoading}
>
<Generator className='h-4 w-4 ' />
<Generator className='h-4 w-4' />
<span className='text-xs font-semibold '>{t('appDebug.codegen.generate')}</span>
</Button>
</div>
@ -255,18 +246,18 @@ export const GetCodeGeneratorResModal: FC<IGetCodeGeneratorResProps> = (
</div>
{isLoading && renderLoading}
{!isLoading && !current && renderNoData}
{/* {(!isLoading && res) && ( */}
<div className='h-full w-0 grow p-6 pb-0'>
<Result
current={current!}
currentVersionIndex={currentVersionIndex || 0}
setCurrentVersionIndex={setCurrentVersionIndex}
versions={versions || []}
onApply={showConfirmOverwrite}
generatorType={GeneratorType.prompt}
/>
</div>
{/* )} */}
{(!isLoading && current) && (
<div className='h-full w-0 grow p-6 pb-0'>
<Result
current={current!}
currentVersionIndex={currentVersionIndex || 0}
setCurrentVersionIndex={setCurrentVersionIndex}
versions={versions || []}
onApply={showConfirmOverwrite}
generatorType={GeneratorType.prompt}
/>
</div>
)}
</div>
{isShowConfirmOverwrite && (
<Confirm

Loading…
Cancel
Save