feat: 更新提示词逻辑,支持模板选择前的提示信息

This commit is contained in:
康猛 2026-01-07 18:16:26 +08:00
parent 474b4ca8b7
commit d24c15fc37
1 changed files with 9 additions and 7 deletions

View File

@ -31,11 +31,10 @@ type Template = {
* ========================= */ * ========================= */
const Generate = observer(function Generate() { const Generate = observer(function Generate() {
const router = useRouter() const router = useRouter()
const env = process.env.EXPO_PUBLIC_ENV
const { user, isAuthenticated } = userStore const { user, isAuthenticated } = userStore
const [prompt, setPrompt] = useState(`${env} update`) const [prompt, setPrompt] = useState(`输入提示词`)
const [selectedTemplateId, setSelectedTemplateId] = useState('') const [selectedTemplateId, setSelectedTemplateId] = useState('')
const [meImg, setMeImg] = useState({ uri: '', url: '' }) const [meImg, setMeImg] = useState({ uri: '', url: '' })
const [friendImg, setFriendImg] = useState({ uri: '', url: '' }) const [friendImg, setFriendImg] = useState({ uri: '', url: '' })
@ -268,7 +267,7 @@ const Generate = observer(function Generate() {
onPickMe={onPickMe} onPickMe={onPickMe}
selectedTemplate={selectedTemplate} selectedTemplate={selectedTemplate}
/> />
{!!textCount && <PromptSection prompt={prompt} onChangePrompt={setPrompt} />} <PromptSection prompt={prompt} onChangePrompt={setPrompt} />
<TemplateSectionHeader onRandom={handleRandom} /> <TemplateSectionHeader onRandom={handleRandom} />
</Block> </Block>
</Block> </Block>
@ -417,9 +416,10 @@ const UploadSection = memo<UploadSectionProps>(function UploadSection({
type PromptSectionProps = { type PromptSectionProps = {
prompt: string prompt: string
editable?: boolean
onChangePrompt: (v: string) => void onChangePrompt: (v: string) => void
} }
const PromptSection = memo<PromptSectionProps>(function PromptSection({ prompt, onChangePrompt }) { const PromptSection = memo<PromptSectionProps>(function PromptSection({ prompt, onChangePrompt, editable = true }) {
return ( return (
<Block className="mt-[24px] -skew-x-6"> <Block className="mt-[24px] -skew-x-6">
<Block className="mb-[4px] flex-row items-center px-[4px]"> <Block className="mb-[4px] flex-row items-center px-[4px]">
@ -428,13 +428,15 @@ const PromptSection = memo<PromptSectionProps>(function PromptSection({ prompt,
</Block> </Block>
</Block> </Block>
<Block className="border-[3px] border-black bg-white p-[4px]"> <Block className={`border-[3px] border-black bg-white p-[4px]`}>
<Input <Input
multiline multiline
className="font-700 min-h-[50px] w-full bg-transparent p-[8px] text-[14px] leading-[18px] text-black" className="w-full bg-transparent p-[8px] text-[14px] leading-[18px] text-black"
style={{ height: 50 }}
numberOfLines={2} numberOfLines={2}
placeholder="描述画面细节..." placeholder={editable ? '描述画面细节...' : '请先选择模板'}
value={prompt} value={prompt}
editable={editable}
onChangeText={onChangePrompt} onChangeText={onChangePrompt}
/> />
</Block> </Block>