fix: pass user message as RAG query text, fix Sidebar rename input controlled warning
This commit is contained in:
1 parent
6617672e4a
commit
3a524b06dc
2 files changed
+3
-3
No files matched your search
@@ -197,7 +197,7 @@ export default function AiSidebar({ onInsertText }) {
|
||||
const { apiConfig } = getProjectSettings();
|
||||
const apiEndpoint = apiConfig?.provider === 'gemini-native' ? '/api/ai/gemini' : '/api/ai';
|
||||
|
||||
const context = await buildContext(activeChapterId, '', contextSelection.size > 0 ? contextSelection : null);
|
||||
const context = await buildContext(activeChapterId, text, contextSelection.size > 0 ? contextSelection : null);
|
||||
const systemPrompt = compileSystemPrompt(context, 'chat');
|
||||
const historyForApi = selectedHistory.map(m => `${m.role === 'user' ? t('aiSidebar.roleYou') : t('aiSidebar.roleAi')}: ${m.content}`).join('\n');
|
||||
const userPrompt = historyForApi ? `${historyForApi}\n${t('aiSidebar.roleYou')}: ${text}` : text;
|
||||
@@ -261,7 +261,7 @@ export default function AiSidebar({ onInsertText }) {
|
||||
const { apiConfig } = getProjectSettings();
|
||||
const apiEndpoint = apiConfig?.provider === 'gemini-native' ? '/api/ai/gemini' : '/api/ai';
|
||||
|
||||
const context = await buildContext(activeChapterId, '', contextSelection.size > 0 ? contextSelection : null);
|
||||
const context = await buildContext(activeChapterId, userMsg.content, contextSelection.size > 0 ? contextSelection : null);
|
||||
const systemPrompt = compileSystemPrompt(context, 'chat');
|
||||
const historyForApi = priorHistory
|
||||
.filter(m => m.role === 'user' || m.role === 'assistant')
|
||||
|
||||
@@ -129,7 +129,7 @@ export default function Sidebar() {
|
||||
<input
|
||||
className="modal-input"
|
||||
style={{ margin: 0, padding: '4px 8px', fontSize: '13px' }}
|
||||
value={renameTitle}
|
||||
value={renameTitle || ''}
|
||||
onChange={e => setRenameTitle(e.target.value)}
|
||||
onBlur={() => handleRename(ch.id)}
|
||||
onKeyDown={e => e.key === 'Enter' && handleRename(ch.id)}
|
||||
|
||||
Reference in new issue
Block a user