docs: modernize file delivery protocol and update tutorials

This commit is contained in:
fujie
2026-02-10 17:01:18 +08:00
parent fe170bedb9
commit 3986eb854f
5 changed files with 18 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

View File

@@ -95,6 +95,9 @@ The Agent responds:
>
> [📊 Download: Category_Summary.xlsx](/api/v1/files/uuid-hash/content)"
#### Execution Screenshot
![GitHub Copilot SDK Test Result](2026-02-10_165530.png)
---
## ⭐ Continuous Improvement

View File

@@ -95,6 +95,9 @@ Agent 会向用户展示:
>
> [📊 点击下载:分类销售统计报表.xlsx](/api/v1/files/uuid-hash/content)”
#### 实际运行截图示例
![GitHub Copilot SDK 测试结果](2026-02-10_165530.png)
---
## ⭐ 持续改进

View File

@@ -134,10 +134,12 @@ BASE_GUIDELINES = (
" - 2. **Render**: Immediately output the SAME code in a ` ```html ` block so the user can interact with it.\n"
" - **Result**: The user gets both a saved file AND a live app. Never force the user to choose one over the other.\n"
"4. **Images & Files**: ALWAYS embed generated images/files directly using `![caption](url)`. Never provide plain text links.\n"
"5. **File Delivery & Publishing (Complementary Goal)**:\n"
" - **Philosophy**: Publishing files is essential when the user needs to *possess* the data (download, edit offline, archive). However, this should **NOT** replace chat-page visualizations (HTML artifacts, Mermaid, Markdown tables). Aim for 'Visual First + File for Persistence'.\n"
" - **Implicit Requests**: If the user wants to 'get' or 'export' something, you MUST: 1. Visualize/summarize in the chat. 2. Write to a local file. 3. Call `publish_file_from_workspace`. 4. Provide the link.\n"
" - **Standard Sequence**: 1. **Write Local**: Create file in `.` (only workspace). 2. **Publish**: Call `publish_file_from_workspace(filename='your_file.ext')`. 3. **Link**: Present the `download_url` as a Markdown link.\n"
"5. **File Delivery Protocol (Dual-Channel Delivery)**:\n"
" - **Philosophy**: Visual Artifacts (HTML/Mermaid) and Downloadable Files are **COMPLEMENTARY**. Always aim to provide BOTH: instant visual insight in the chat AND a persistent file for the user to keep.\n"
" - **The Rule**: When the user needs to *possess* data (download/export), you MUST publish it. Creating a local file alone is useless because the user cannot access your container.\n"
" - **Implicit Requests**: If asked to 'export', 'get link', or 'save', automatically trigger this sequence.\n"
" - **Execution Sequence**: 1. **Write Local**: Create file in `.` (current directory). 2. **Publish**: Call `publish_file_from_workspace(filename='your_file.ext')`. 3. **Link**: Present the `download_url` as a Markdown link.\n"
" - **Bypass RAG**: This protocol automatically handles S3 storage and bypasses RAG, ensuring 100% accurate data delivery.\n"
"6. **TODO Visibility**: Every time you call the `update_todo` tool, you **MUST** immediately follow up with a beautifully formatted **Markdown summary** of the current TODO list. Use task checkboxes (`- [ ]`), progress indicators, and clear headings so the user can see the status directly in the chat.\n"
"7. **Python Execution Standard**: For ANY task requiring Python logic (not just data analysis), you **MUST NOT** embed multi-line code directly in a shell command (e.g., using `python -c` or `<< 'EOF'`).\n"
' - **Exception**: Trivial one-liners (e.g., `python -c "print(1+1)"`) are permitted.\n'

View File

@@ -63,10 +63,12 @@ FORMATTING_GUIDELINES = (
"1. **Markdown & 多媒体**:自由使用粗体、斜体、表格和列表。\n"
"2. **Mermaid 图表**:请务必使用标准的 ```mermaid 代码块。\n"
"3. **交互式 HTML/JS**:你可以输出完整的 ```html 代码块(含 CSS/JS将在 iframe 中渲染。\n"
"4. **文件交付与发布 (互补目标)**\n"
" - **设计理念**当用户需要“拥有”数据(下载、离线编辑、归档)时,发布文件是必不可少的。但这**不应**取代聊天页面的视觉化展示(如 HTML 应用、Mermaid 图表、Markdown 表格)。应追求“直观预览 + 持久产物”的双重体验\n"
" - **隐式请求**用户要求“获取内容”或“导出数据”你应当1. 在聊天中进行视觉化汇总/预览。2. 将完整内容写入本地文件。3. 调用 `publish_file_from_workspace`。4. 展示下载链接\n"
" - **标准流程**1. **本地写入**:在当前目录 (`.`) 创建文件。2. **发布文件**:调用 `publish_file_from_workspace(filename='your_file.ext')`。3. **呈现链接**:从返回结果中提取 `download_url` 并在回复末尾展示\n"
"4. **文件交付与发布协议 (双渠道交付)**\n"
" - **核心理念**视觉产物 (HTML/Mermaid) 与可下载文件是**互补**的。应始终追求双重交付:既在聊天中提供直观的视觉洞察,又提供持久的文件供用户保存\n"
" - **基本原则**用户需要“拥有”数据(下载、离线编辑)时,你必须发布文件。仅在本地生成文件是无用的,因为用户无法访问你的容器\n"
" - **隐式动作**:若用户说“导出”、“保存”或“给我链接”,自动执行三步曲\n"
" - **执行序列**1. **本地写入**:将文件写入当前目录 (`.`)。2. **发布文件**:调用 `publish_file_from_workspace(filename='name.ext')`。3. **呈现链接**:展示返回的 `download_url` 链接。\n"
" - **RAG 绕过**:此流程会自动适配 S3 存储映射并绕过 RAG确保数据交付 100% 准确。\n"
"7. **主动与自主**: 你是专家工程师。对于显而易见的步骤,**不要**请求许可。**不要**停下来问“我通过吗?”或“是否继续?”。\n"
" - **行为模式**: 分析用户请求 -> 制定计划 -> **立即执行**计划。\n"
" - **澄清**: 仅当请求模棱两可或具有高风险(例如破坏性操作)时才提出问题。\n"