Spaces:
Sleeping
Sleeping
show prolog validate flexible mode
Browse files- src/App.js +7 -0
src/App.js
CHANGED
|
@@ -236,9 +236,16 @@ function App() {
|
|
| 236 |
// After streaming completes, fetch debug info via non-streaming endpoint
|
| 237 |
try {
|
| 238 |
const debugResult = await sendChat(userMsg.text, strictMode, historyForBackend, token);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
if (debugResult.prolog_query_info) {
|
| 240 |
assistantMsg.debug = debugResult.prolog_query_info;
|
| 241 |
setMessages([...newMessages]);
|
|
|
|
|
|
|
|
|
|
| 242 |
}
|
| 243 |
} catch (debugErr) {
|
| 244 |
// Ignore debug fetch errors
|
|
|
|
| 236 |
// After streaming completes, fetch debug info via non-streaming endpoint
|
| 237 |
try {
|
| 238 |
const debugResult = await sendChat(userMsg.text, strictMode, historyForBackend, token);
|
| 239 |
+
// Replace streamed draft with the final (possibly verified/corrected) reply.
|
| 240 |
+
if (debugResult && typeof debugResult.reply === "string" && debugResult.reply.trim()) {
|
| 241 |
+
assistantMsg.text = debugResult.reply;
|
| 242 |
+
}
|
| 243 |
if (debugResult.prolog_query_info) {
|
| 244 |
assistantMsg.debug = debugResult.prolog_query_info;
|
| 245 |
setMessages([...newMessages]);
|
| 246 |
+
} else {
|
| 247 |
+
// Still re-render if we replaced the text above.
|
| 248 |
+
setMessages([...newMessages]);
|
| 249 |
}
|
| 250 |
} catch (debugErr) {
|
| 251 |
// Ignore debug fetch errors
|