Skip to content

Commit 5c3707a

Browse files
committed
feat: support adds default prompt for image and text mode when adding images
1 parent 7930004 commit 5c3707a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

react-native/src/chat/ChatScreen.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,15 +646,27 @@ function ChatScreen(): React.JSX.Element {
646646
if (message[0]?.text || files.length > 0) {
647647
if (!message[0]?.text) {
648648
if (modeRef.current === ChatMode.Text) {
649-
message[0].text = getFileTypeSummary(files);
649+
// use system prompt name as user prompt
650+
if (systemPromptRef.current) {
651+
message[0].text = systemPromptRef.current.name;
652+
} else {
653+
message[0].text = getFileTypeSummary(files);
654+
}
650655
} else {
656+
// use selected system prompt as user prompt
651657
message[0].text = systemPromptRef.current?.prompt ?? 'Empty Message';
652658
if (systemPromptRef.current?.id === -7) {
653659
saveLastVirtualTryOnImgFile(files[0]);
654660
saveCurrentImageSystemPrompt(null);
655661
sendEventRef.current('unSelectSystemPrompt');
656662
}
657663
}
664+
} else {
665+
// append user prompt after system prompt in image mode
666+
if (modeRef.current === ChatMode.Image && systemPromptRef.current) {
667+
message[0].text =
668+
systemPromptRef.current?.prompt + '\n' + message[0].text;
669+
}
658670
}
659671
if (selectedFilesRef.current.length > 0) {
660672
message[0].image = JSON.stringify(selectedFilesRef.current);

0 commit comments

Comments
 (0)