Skip to content

docs(model-tool): 补充 reply tool 字段与工具元数据说明#25

Merged
CookSleep merged 1 commit intoChatLunaLab:mainfrom
CookSleep:docs/model-tool-reply-field-20260405
Apr 5, 2026
Merged

docs(model-tool): 补充 reply tool 字段与工具元数据说明#25
CookSleep merged 1 commit intoChatLunaLab:mainfrom
CookSleep:docs/model-tool-reply-field-20260405

Conversation

@CookSleep
Copy link
Copy Markdown
Member

Summary

  • 补充 registerToolmeta 工具元数据说明,说明 sourcegrouptagsdefaultAvailability.characterScope 的用途
  • 补充 chatluna-characterregisterReplyToolField() 开发说明,说明如何为 character_reply 挂载与消息交互相关的自定义字段

Verification

  • 文档改动,未执行构建或测试

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 5, 2026

Warning

Rate limit exceeded

@CookSleep has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 9 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 2 minutes and 9 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1c15bdbb-9492-41be-bcad-1508ca7ace09

📥 Commits

Reviewing files that changed from the base of the PR and between c5f52c2 and c136457.

📒 Files selected for processing (1)
  • docs/development/connect-to-core-services/model-tool.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@CookSleep CookSleep merged commit a4043d6 into ChatLunaLab:main Apr 5, 2026
1 check was pending
Copy link
Copy Markdown

@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

This pull request updates the documentation for tool registration, specifically adding details for the meta field and introducing a mechanism to register custom fields for the character_reply tool within the chatluna-character plugin. Feedback suggests improving the documentation's consistency by adding the description field to the parameter list, using string literals instead of undefined variables in examples, and including the Config interface in the example code to follow standard plugin patterns.

- `session` - 当前会话对象
- 返回:`Tool` 实例
- 用途:创建并返回工具的实例
- `meta`: 工具元数据(推荐填写)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

在下方的示例代码(第 193 行)中使用了 description 字段,但在 registerTool 的参数说明列表中未包含该字段。建议在此处补充 description 的说明,以保持文档的一致性。

Suggested change
- `meta`: 工具元数据(推荐填写
- `description`: 工具描述(可选
- `meta`: 工具元数据(推荐填写)


```ts
plugin.registerTool('web_search', {
description: SEARCH_TOOL_DESCRIPTION,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

建议使用字符串字面量代替未定义的变量 SEARCH_TOOL_DESCRIPTION,或者在代码块中提供其定义,这样可以使示例代码更加直观且易于理解。

Suggested change
description: SEARCH_TOOL_DESCRIPTION,
description: '网络搜索工具',

import { Context } from 'koishi'
import type {} from 'koishi-plugin-chatluna-character'

export function apply(ctx: Context) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

CharacterReplyToolField 接口定义中引用了 Config 类型,但在示例代码中未定义该接口。建议补充 Config 的定义并将其作为 apply 函数的参数,以符合 Koishi 插件的标准写法并保证代码片段的完整性。

Suggested change
export function apply(ctx: Context) {
export interface Config {}
export function apply(ctx: Context, config: Config) {

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