Skip to content

Commit 542b801

Browse files
committed
fix the deletion bug
1 parent 29d8975 commit 542b801

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

helper_utils.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ def save_session():
3636
# 清理旧记录
3737
c.execute("""
3838
DELETE FROM history
39-
WHERE id NOT IN (
40-
SELECT id FROM history
41-
WHERE username = ?
39+
WHERE username = ?
40+
AND id NOT IN (
41+
SELECT id
42+
FROM history
43+
WHERE username = ?
4244
ORDER BY updated_at DESC
4345
LIMIT 10
4446
)
45-
""", (username,))
47+
""", (username, username))
4648

4749
except Exception as e:
4850
st.error(f"保存会话失败: {str(e)}")

0 commit comments

Comments
 (0)