Skip to content

Commit f2cb5b1

Browse files
fix: remove fake prompt for document-only sends
- Don't inject "What is this document about?" — model uses context instruction from system prompt - Use document name as chat title when no text input - Always query RAG when sources are enabled, even without text Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 805eae5 commit f2cb5b1

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

components/chat-screen/ChatScreen.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,13 @@ export default function ChatScreen({
114114
isGenerating
115115
)
116116
return;
117-
// If no text but documents attached, ask model to describe the document
118-
const effectiveInput =
119-
userInput.trim() || (hasDocuments ? 'What is this document about?' : '');
120-
121117
if (!(await checkIfChatExists(db, chatId!))) {
118+
const docName = attachments?.find((a) => a.type === 'document')?.name;
119+
const titleSource = userInput.trim() || docName || 'New chat';
122120
const newChatTitle =
123-
effectiveInput.length > 25
124-
? effectiveInput.slice(0, 25) + '...'
125-
: effectiveInput;
121+
titleSource.length > 25
122+
? titleSource.slice(0, 25) + '...'
123+
: titleSource;
126124
await addChat(newChatTitle, model!.id);
127125
}
128126

@@ -184,9 +182,9 @@ export default function ChatScreen({
184182
freshChat?.enabledSources || freshPhantom?.enabledSources || [];
185183
console.log('[SEND] currentEnabledSources (after):', currentEnabledSources);
186184

187-
if (currentEnabledSources.length > 0 && effectiveInput) {
185+
if (currentEnabledSources.length > 0) {
188186
const ragContext = await prepareContext(
189-
effectiveInput,
187+
userInput || 'document summary',
190188
currentEnabledSources,
191189
vectorStore!
192190
);
@@ -203,9 +201,9 @@ export default function ChatScreen({
203201
thinkingEnabled: chatSettings.thinkingEnabled,
204202
};
205203

206-
console.log('[SEND] effectiveInput:', effectiveInput);
204+
console.log('[SEND] userInput:', userInput);
207205
console.log('[SEND] settings:', JSON.stringify(settings));
208-
await sendChatMessage(effectiveInput, chatId!, context, settings, imagePath);
206+
await sendChatMessage(userInput, chatId!, context, settings, imagePath);
209207
};
210208

211209
const handleSelectModel = async (selectedModel: Model) => {

0 commit comments

Comments
 (0)