ar9avg commited on
Commit
b15235a
·
1 Parent(s): c2894a4

Reset SQL on new attempt so attempts don't concatenate in the same box

Browse files
frontend/src/components/ChatPanel.tsx CHANGED
@@ -416,7 +416,12 @@ export function ChatPanel() {
416
 
417
  try {
418
  for await (const event of streamExecuteQuery(question, taskId, previousSql)) {
419
- if (event.type === 'sql') {
 
 
 
 
 
420
  updateMessage(msgId, { sql: event.sql as string })
421
  } else if (event.type === 'sql_chunk') {
422
  // incremental SQL streaming — read current sql from store
 
416
 
417
  try {
418
  for await (const event of streamExecuteQuery(question, taskId, previousSql)) {
419
+ if (event.type === 'attempt_start') {
420
+ // New attempt — clear SQL so previous attempt's SQL doesn't bleed through
421
+ if ((event.attempt as number) > 1) {
422
+ updateMessage(msgId, { sql: '', attempts: event.attempt as number })
423
+ }
424
+ } else if (event.type === 'sql') {
425
  updateMessage(msgId, { sql: event.sql as string })
426
  } else if (event.type === 'sql_chunk') {
427
  // incremental SQL streaming — read current sql from store