zai-org / zai-org/feedback

[Feature Request] chat.z.ai: Add Delete Message Option for Individual Messages in Chat Sessions

Open
#307 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Feature Request: Add "Delete Message" Button to chat.z.ai

πŸ“‹ Summary

Add a DELETE button/option for individual messages within a chat session, allowing users to remove specific messages (both user and assistant) without deleting the entire conversation.


🎯 Problem Description

Current State

chat.z.ai currently provides these per-message actions:

  • βœ… Copy β€” Copy message text to clipboard
  • βœ… Generate Again β€” Regenerate the AI response
  • ❌ Delete β€” MISSING β€” No way to remove individual messages
User Pain Points
Scenario Impact
Accidentally sent sensitive info Cannot remove it from context
Wrong prompt sent Must delete entire session or live with it
Want to refine conversation flow No way to remove detours/mistakes
Context window management Irrelevant messages consume tokens
Privacy concerns Sensitive data persists in session history
User Feedback

"We have COPY and GENERATE AGAIN, but how about DELETE?"

"We have no 'Delete' button in Z.AI. For example, I want to delete the message [in the blue square], but I CANNOT achieve it now."

β€” Joyboy2333 [ER2] (Discord)


βœ… Proposed Solution

UI Design
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Current Message Hover Actions:                              β”‚β”‚                                                             β”‚β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”‚β”‚  β”‚   πŸ“‹     β”‚  β”‚    πŸ”„          β”‚  β”‚    πŸ—‘οΈ        β”‚       β”‚β”‚  β”‚  Copy    β”‚  β”‚ Generate Again  β”‚  β”‚  Delete      β”‚       β”‚β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚β”‚                                                             β”‚β”‚                    ↑ NEW FEATURE                            β”‚β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜```

### Delete Confirmation Flow

User clicks Delete (πŸ—‘οΈ) on a message
↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ⚠️ Delete this message? β”‚β”‚ β”‚
β”‚ This action cannot be undone. β”‚β”‚ The message will be removed from β”‚β”‚ the conversation context. β”‚β”‚ β”‚
β”‚ [Cancel] [Delete Message] β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓
If confirmed:
β†’ Message visually removed from UI
β†’ Message removed from context window
β†’ Subsequent messages re-contextualized
β†’ Optional: Show "1 message deleted" placeholder


### Scope Options

| Delete Mode | Behavior | Use Case |
|------------|----------|----------|
| **Single Message** | Remove only clicked message | Quick cleanup of one mistake |
| **Message + Below** | Remove message AND all responses after | "Start over from here" |
| **Multiple Select** | Checkbox mode, batch delete | Bulk cleanup of irrelevant parts |

**Recommended MVP:** Start with Single Message, add others based on usage data.

---

## πŸ”§ Technical Considerations

### Backend Requirements

```javascript
// Proposed API endpoint
DELETE /api/v1/sessions/:sessionId/messages/:messageId

// Request headers
Authorization: Bearer {token}

// Response
{
  success: true,
  deletedMessageId: "msg_abc123",
  affectedContextWindow: -450, // tokens freed
  remainingMessages: 23
}
Context Window Management

When a message is deleted:

  1. Immediate: Remove message from conversation history array

  2. Token recalculation: Update context window size (free up tokens)

  3. Continuity check: If deleted message breaks conversation flow:

    • Option A: Keep subsequent messages as-is (may be confusing)
    • Option B: Flag context gap with subtle indicator
    • Option C: Re-summarize context for AI (expensive but clean)
  4. Caching: Invalidate any cached context that included deleted message

Edge Cases
Edge Case Recommended Handling
Delete user's last message Also remove AI's response to it
Delete system/instruction message Block or warn (critical context)
Delete message with file attachment Remove attachment reference too
Delete in active generation Queue deletion after current response completes
Delete in shared/exported session Mark as deleted; don't show in export
Undo requested Restore from recent-deletion buffer (5-min window)

🎨 UI/UX Specifications

Visual Design

Hover State (Desktop):

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ [User Message Text]              [πŸ“‹][πŸ”„][πŸ—‘οΈ] β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                         ↑
                              Appears on hover
                              (like existing Copy/Regen)

Mobile (Touch):

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ [User Message Text]         [...]  β”‚  ← Swipe left OR
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     Long press
                                            ↓
                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                         β”‚ πŸ“‹ Copy         β”‚
                         β”‚ πŸ”„ Regenerate   β”‚
                         β”‚ πŸ—‘οΈ Delete      β”‚  ← Red color
                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Deleted Message Placeholder (Optional):**

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ—‘οΈ Message deleted                      β”‚
β”‚ ──────────────────────────────────────   β”‚
β”‚ [Undo] [Dismiss]                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         ↑ Shows for 10 seconds, then collapses to:
    "[1 message removed]" (click to expand details)
Accessibility
  • Keyboard shortcut: When message focused, Delete or Backspace triggers delete
  • Screen reader: Announce "Message deleted" and update message count
  • Color blind safe: Don't rely solely on red color; use icon + label
  • Animation: Smooth fade-out (not instant disappear) so user sees what happened

πŸ“Š Success Metrics

Metric Target
Feature adoption >15% of active users use within 2 weeks
Session retention Users delete & continue (not abandon session)
Support tickets Reduction in "delete my chat history" requests
Token efficiency Average 10-20% context reduction after deletions

πŸ”„ Implementation Priority

Phase Feature Effort Value
P0 Single message delete (UI + API) Medium High
P1 Delete confirmation dialog Low High
P1 Undo buffer (5-minute window) Medium Medium
P2 Batch/multi-select delete High Medium
P2 "Delete + messages below" mode Low Medium
P3 Export filtering (exclude deleted) Low Low

Recommended MVP: Ship P0 + P1 first β€” covers 80% of use cases.


πŸ§ͺ Testing Scenarios

  1. Basic Delete: Click delete on user message β†’ confirm β†’ message gone
  2. Cascade Delete: Delete user message β†’ verify AI response also handled
  3. Context Check: After delete, send new message β†’ AI doesn't reference deleted content
  4. Token Verify: Delete large message β†’ context token count decreases
  5. Mobile Test: Long press β†’ menu appears β†’ delete works
  6. Offline/Poor Network: Delete queues and syncs when connected
  7. Permission Check: Non-owner cannot delete messages in shared session
  8. Undo Flow: Delete β†’ undo within 5 min β†’ message restored

πŸ’‘ Additional Context


Submitted by:
Regards,
Roman (Discord: bignavi_x)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up β€” it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation files, tests, or entry points are identified in the issue. Start by locating the chat.z.ai message actions and the proposed DELETE /api/v1/sessions/:sessionId/messages/:messageId endpoint, then define the MVP boundary; done means a confirmed single-message deletion updates the UI and conversation context, with the listed basic and context checks passing.

Written by the indexing model from the issue text.

Assessment

Domain
api, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.