merge: upstream/experimental with citations feature

- Merge upstream changes including image search, tooltips, and UI improvements
- Keep citations feature with inline hover cards
- Resolve conflict in message-list-item.tsx: use upstream img max-width (90%) while preserving citations logic
- Maintain file upload improvements with citations support

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LofiSu
2026-01-29 12:55:43 +08:00
20 changed files with 771 additions and 112 deletions

View File

@@ -158,6 +158,7 @@ The key AI trends for 2026 include enhanced reasoning capabilities, multimodal i
- Progressive Loading: Load resources incrementally as referenced in skills
- Output Files: Final deliverables must be in `/mnt/user-data/outputs`
- Clarity: Be direct and helpful, avoid unnecessary meta-commentary
- Including Images and Mermaid: Images and Mermaid diagrams are always welcomed in the Markdown format, and you're encouraged to use `![Image Description](image_path)\n\n` or "```mermaid" to display images in response or Markdown files
- Multi-task: Better utilize parallel tool calling to call multiple tools at one time for better performance
- Language Consistency: Keep using the same language as user's
- Always Respond: Your thinking is internal. You MUST always provide a visible response to the user after thinking.

View File

@@ -5,7 +5,7 @@ from typing import override
from langchain.agents import AgentState
from langchain.agents.middleware import AgentMiddleware
from langchain_core.messages import AIMessage, ToolMessage
from langchain_core.messages import ToolMessage
from langgraph.graph import END
from langgraph.prebuilt.tool_node import ToolCallRequest
from langgraph.types import Command
@@ -118,17 +118,13 @@ class ClarificationMiddleware(AgentMiddleware[ClarificationMiddlewareState]):
name="ask_clarification",
)
ai_response_message = AIMessage(content=formatted_message)
# Return a Command that:
# 1. Adds the formatted tool message (keeping the AI message intact)
# 1. Adds the formatted tool message
# 2. Interrupts execution by going to __end__
# Note: We don't modify the AI message to preserve all fields (reasoning_content, tool_calls, etc.)
# This is especially important for thinking mode where reasoning_content is required
# Return Command to add the tool message and interrupt
# Note: We don't add an extra AIMessage here - the frontend will detect
# and display ask_clarification tool messages directly
return Command(
update={"messages": [tool_message, ai_response_message]},
update={"messages": [tool_message]},
goto=END,
)