|
156 | 156 |
|
157 | 157 | // Help command |
158 | 158 | if (trimmedInput === '/help' || trimmedInput === '/?') { |
| 159 | + // Add user message to chat history before clearing input |
| 160 | + const userMessage: ChatMessageType = { |
| 161 | + id: crypto.randomUUID(), |
| 162 | + role: 'user', |
| 163 | + content: messageInput.trim(), |
| 164 | + timestamp: Date.now() |
| 165 | + }; |
| 166 | + addMessage(userMessage); |
| 167 | + |
159 | 168 | messageInput = ''; |
160 | 169 | const helpMessage: ChatMessageType = { |
161 | 170 | id: crypto.randomUUID(), |
|
170 | 179 | `• [Click here to run: /find](cmd:/find%20)\n` + |
171 | 180 | `• [Click here to run: /help](cmd:/help)\n\n` + |
172 | 181 | `**Finding Exact Sentences:**\n` + |
173 | | - `• **Command**: \`/find Mormon\` - finds all sentences with "Mormon"\n` + |
| 182 | + `• **Command**: \`/find [term]\` - finds all sentences with "[term]"\n` + |
174 | 183 | `• **Natural Language**: Ask naturally using phrases like:\n` + |
175 | | - ` - "Find sentences containing Mormon"\n` + |
176 | | - ` - "Show me the exact sentence with Nephi"\n` + |
| 184 | + ` - "Find sentences containing [term]"\n` + |
| 185 | + ` - "Show me the exact sentence with [term]"\n` + |
177 | 186 | ` - "Quote the sentence about Jacob"\n` + |
178 | 187 | ` - "Find where it says about Lehi"\n` + |
179 | 188 | `• Results show exact sentences with terms **highlighted**\n\n` + |
|
190 | 199 |
|
191 | 200 | // Debug command to show RAG contents |
192 | 201 | if (trimmedInput === '/rag-debug' || trimmedInput === '/debug rag') { |
| 202 | + // Add user message to chat history before clearing input |
| 203 | + const userMessage: ChatMessageType = { |
| 204 | + id: crypto.randomUUID(), |
| 205 | + role: 'user', |
| 206 | + content: messageInput.trim(), |
| 207 | + timestamp: Date.now() |
| 208 | + }; |
| 209 | + addMessage(userMessage); |
| 210 | + |
193 | 211 | messageInput = ''; |
194 | 212 | await showRAGDebugInfo(); |
195 | 213 | return; |
|
198 | 216 | // Find command to search for exact sentences |
199 | 217 | if (trimmedInput.startsWith('/find ')) { |
200 | 218 | const searchTerm = messageInput.trim().substring(6); // Remove '/find ' |
| 219 | + |
| 220 | + // Add user message to chat history before clearing input |
| 221 | + const userMessage: ChatMessageType = { |
| 222 | + id: crypto.randomUUID(), |
| 223 | + role: 'user', |
| 224 | + content: messageInput.trim(), |
| 225 | + timestamp: Date.now() |
| 226 | + }; |
| 227 | + addMessage(userMessage); |
| 228 | + |
201 | 229 | messageInput = ''; |
202 | 230 | await findExactSentences(searchTerm); |
203 | 231 | return; |
|
0 commit comments