MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / delete_chat_session

Function delete_chat_session

skills/storage-helper/scripts/db_ops.py:489–510  ·  view source on GitHub ↗

Delete a GUI chat session and its messages.

(user_id: str, session_id: str)

Source from the content-addressed store, hash-verified

487
488
489def delete_chat_session(user_id: str, session_id: str) -> bool:
490 """Delete a GUI chat session and its messages."""
491 normalized_user_id = _normalize_identifier(user_id)
492 normalized_session_id = _normalize_identifier(session_id)
493 if not normalized_user_id or not normalized_session_id:
494 raise ValueError("user_id and session_id are required")
495
496 ensure_chat_tables()
497 conn = get_connection()
498 cursor = conn.cursor()
499 cursor.execute(
500 "DELETE FROM chat_messages WHERE user_id = ? AND session_id = ?",
501 (normalized_user_id, normalized_session_id),
502 )
503 cursor.execute(
504 "DELETE FROM chat_sessions WHERE user_id = ? AND session_id = ?",
505 (normalized_user_id, normalized_session_id),
506 )
507 deleted = cursor.rowcount > 0
508 conn.commit()
509 conn.close()
510 return deleted
511
512
513def clear_chat_sessions(user_id: str) -> int:

Callers

nothing calls this directly

Calls 6

_normalize_identifierFunction · 0.85
ensure_chat_tablesFunction · 0.85
cursorMethod · 0.80
get_connectionFunction · 0.70
executeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected