Skip to content

Conversation

@wtqn0206
Copy link

增加 智能体提示词替换说明文档

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @wtqn0206, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求的主要目的是通过添加关于智能体提示词替换功能的详细文档,来增强现有 WebSocket 协议的说明。这有助于开发者理解如何利用 agent_params 中的 custom_replace_prompt 字段进行个性化提示词配置,从而提高系统的灵活性和用户体验。

Highlights

  • 新增智能体提示词替换说明: 在 docs/xrobot/platform/websocket.md 文件中增加了关于智能体提示词替换消息的详细说明,包括参数规则和使用示例,以指导如何动态生成系统提示词。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次 PR 添加了关于智能体提示词替换功能的说明文档。整体内容清晰,但存在一些可以改进的地方以提高文档的准确性和可读性。主要问题包括:新功能的标题和描述存在误导性,参数规则的描述不够精确,以及示例代码中包含了不应出现的字段。我已经针对这些问题提出了具体的修改建议。

Comment on lines 296 to 297
##### 5. 智能体提示词替换 消息
用于设备端向服务器告知检测到唤醒词。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

此处的标题和描述存在误导性。标题“5. 智能体提示词替换 消息”暗示这是一个新的消息类型,但实际上它是对 hello 消息的扩展。同时,描述“用于设备端向服务器告知检测到唤醒词”是错误的,似乎是从上一节复制而来。建议修改标题和描述,以准确说明该功能是通过 hello 消息传递参数来替换提示词中的占位符。

Suggested change
##### 5. 智能体提示词替换 消息
用于设备端向服务器告知检测到唤醒词
##### 5. Hello 消息扩展:智能体提示词替换
此功能通过在 `hello` 消息中添加 `agent_params` 字段,允许设备端在建立连接时传递动态参数,用于替换智能体系统提示词中的占位符

##### 5. 智能体提示词替换 消息
用于设备端向服务器告知检测到唤醒词。
###### 参数规则:
- key: 只能英文(小写)、并且是 snake_case 的命名风格,不能出现数字和非英文的字符,最长50字符,超过50将丢弃当前参数
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

参数 key 的规则描述“不能出现数字和非英文的字符”不够精确。根据示例,key 中可以包含下划线 _。为了避免歧义,建议明确说明允许的字符集。

Suggested change
- key: 只能英文(小写)、并且是 snake_case 的命名风格,不能出现数字和非英文的字符,最长50字符,超过50将丢弃当前参数
- key: 必须为小写蛇形命名法(snake_case)风格,且只能包含小写英文字母和下划线。最长为50个字符,超过部分将被丢弃。

@wtqn0206
Copy link
Author

/review

@wtqn0206
Copy link
Author

/review

@wtqn0206
Copy link
Author

/review

@xgopilot
Copy link

xgopilot bot commented Dec 16, 2025

Review Summary

Clear usage example, but missing critical documentation:

Critical Issues:

  • No parameter constraints (length/count limits)
  • No input validation requirements
  • No security guidance for prompt injection prevention

Impact: Implementations risk resource exhaustion and security vulnerabilities. Add constraint specifications and security requirements before merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant