agentscope-ai / agentscope-ai/QwenPaw

[Feature]: Quote/Reference text from responses for follow-up context

未关闭
#5,110 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Python
星标
34.9k
派生
3.1k
平均合并
1 天 15 小时
30 天内合并 PR
225

描述

---
name: Feature Request
about: Suggest a new feature or enhancement
title: "[Feature]: Quote/Reference text from responses for follow-up context (like Perplexity)"
labels: ["enhancement", "triage"]
assignees: []
---

## Summary

Add a "Quote to follow-up" feature that allows users to select text from agent responses and automatically include it as quoted context in their next message, similar to Perplexity AI's "Add to follow-up" functionality.

## Component(s) Affected

- [x] Console (frontend web UI)
- [x] Core / Backend (message handling, context injection)

## Problem / Motivation

When working with AI agents on complex topics, users often need to reference specific parts of previous responses to ask follow-up questions. Currently, users must:

1. Manually copy text from responses
2. Paste it into their next message
3. Format it to indicate it's a quote

This is tedious and disrupts the conversation flow, especially when:
- Discussing technical details with multiple code snippets
- Asking clarifying questions about specific parts of long responses
- Building on previous context in multi-turn conversations

The Perplexity AI model demonstrates this feature effectively, allowing users to highlight text and click "Add to follow-up" to seamlessly include quoted context.

## Proposed Solution

### User Experience

1. **Text Selection**: User selects/highlights text within an agent response
2. **Floating Action**: A floating "Quote" or "Add to follow-up" button appears above the selection (similar to the copy button)
3. **Quote Display**: Selected text appears as a quoted block in the chat input area (styled differently from regular input)
4. **Context Injection**: When user sends their follow-up message, the quoted text is automatically included as context

### Technical Implementation

**Frontend (Console):**
- Add text selection detection in message components
- Implement floating action button for selected text
- Add quote display component in chat input area
- Style quoted text with distinct visual treatment (e.g., border-left, italic, or blockquote styling)

**Backend:**
- Add API endpoint to handle quote context
- Modify message handling to accept optional `quoted_context` field
- Include quoted text in system prompt or message context for the next turn

**Example UI Flow:**
```
[Agent Response with long explanation...]
User selects: "The key difference between X and Y is..."

[Floating button: "Quote to follow-up"]

[Chat input shows:]
> The key difference between X and Y is...

[User types:] What about Z?

[Message sent with quoted context included]
```

### Benefits

- **Improved UX**: Reduces friction in multi-turn conversations
- **Better Context**: Ensures AI understands exactly what the user is referencing
- **Consistency**: Standardizes how users reference previous content
- **Competitive**: Matches functionality available in other AI assistants

## Alternatives Considered

1. **Manual Copy-Paste**: Current workaround, but tedious and error-prone
2. **Reference by Line Number**: Less intuitive, requires users to count lines
3. **Plugin System**: Investigated, but current plugin architecture doesn't support modifying existing chat components (only adding new routes/pages)

## Additional Context

**Reference Implementation:**
- Perplexity AI: Users can highlight text and click "Add to follow-up" button

**Technical Notes:**
- The `@agentscope-ai/chat` package handles message rendering
- The plugin system supports adding routes but not modifying existing components
- This feature requires changes to core chat components

---

**Priority:** Medium-High
**Complexity:** Medium (requires frontend + backend changes)
**Impact:** High (improves core chat UX for all users)

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。