Skip to content

feat: Support parameters for CreateChat#98

Merged
chyroc merged 2 commits intocoze-dev:mainfrom
Mibloom:add-parameters
May 19, 2025
Merged

feat: Support parameters for CreateChat#98
chyroc merged 2 commits intocoze-dev:mainfrom
Mibloom:add-parameters

Conversation

@Mibloom
Copy link
Contributor

@Mibloom Mibloom commented May 19, 2025

  • 在 CreateChatReq 类中添加了 parameters 属性,用于自定义参数
  • 使用 Map<String, Object> 类型以支持多种类型的自定义参数
  • 通过 JSON 注解@JsonProperty("parameters")进行序列化和反序列化

- 在 CreateChatReq 类中添加了 parameters 属性,用于自定义参数
- 使用 Map<String, Object> 类型以支持多种类型的自定义参数
- 通过 JSON 注解@JsonProperty("parameters")进行序列化和反序列化
@coderabbitai
Copy link

coderabbitai bot commented May 19, 2025

Walkthrough

A new field called parameters of type Map<String, Object> was added to the CreateChatReq class. This field is annotated for JSON serialization and is intended to store custom parameters. No other logic or methods were modified in this class.

Changes

File Change Summary
api/src/main/java/com/coze/openapi/client/chat/CreateChatReq.java Added parameters field to store custom parameters as a map.

Poem

A new map for chats, so clever and neat,
Now custom parameters make requests complete.
With keys and values, your wishes can flow,
Into the chat, where ideas grow.
🗝️✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 3a7a9c1 and 4461248.

📒 Files selected for processing (1)
  • api/src/main/java/com/coze/openapi/client/chat/CreateChatReq.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • api/src/main/java/com/coze/openapi/client/chat/CreateChatReq.java
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: test (Java 8 on macOS)
  • GitHub Check: test (Java 17 on Windows)
  • GitHub Check: test (Java 11 on Windows)
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
api/src/main/java/com/coze/openapi/client/chat/CreateChatReq.java (1)

89-91: 💡 Verification agent

🧩 Analysis chain

Consider updating clearBeforeReq() method

The clearBeforeReq() method currently only clears the conversationID field. Consider whether the new parameters field should also be cleared before requests. If parameters are conversation-specific, they should be cleared along with the conversation ID.


🏁 Script executed:

#!/bin/bash
# Look for usage patterns of the clearBeforeReq method to understand if parameters should be cleared

echo "Searching for clearBeforeReq method calls in the codebase:"
rg -A 2 -B 2 "clearBeforeReq" --type java

Length of output: 3999


Update clearBeforeReq() to also reset the new parameters field

In api/src/main/java/com/coze/openapi/client/chat/CreateChatReq.java, the clearBeforeReq() method currently only clears conversationID. For consistency (as seen in SubmitToolOutputsReq.clearBeforeReq()) and to avoid carrying over conversation-specific data, you should also null out the parameters field:

public void clearBeforeReq() {
    this.conversationID = null;
    this.parameters    = null;
}

– File: api/src/main/java/com/coze/openapi/client/chat/CreateChatReq.java
– Method: clearBeforeReq()

🧹 Nitpick comments (1)
api/src/main/java/com/coze/openapi/client/chat/CreateChatReq.java (1)

74-76: Consider enhancing the documentation comment

The current comment "The customized parameters" is minimal. Consider providing more details about:

  • What kinds of parameters can be stored here
  • Example use cases
  • Any constraints or expected formats
  /*
-   * The customized parameters
+   * Customized parameters that can hold various types of values.
+   * This field allows passing additional configuration options as key-value pairs
+   * where values can be of any object type, not limited to strings.
   * */
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between fc03b09 and 3a7a9c1.

📒 Files selected for processing (1)
  • api/src/main/java/com/coze/openapi/client/chat/CreateChatReq.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: test (Java 17 on Windows)
  • GitHub Check: test (Java 11 on Windows)
🔇 Additional comments (1)
api/src/main/java/com/coze/openapi/client/chat/CreateChatReq.java (1)

74-78: The new parameters field is well-implemented!

The addition of a Map<String, Object> type allows for flexible customized parameters with different value types, which is more versatile than the Map<String, String> used for other similar fields in this class. The implementation follows the established patterns in the class with proper JSON annotation.

@chyroc chyroc added the feature label May 19, 2025
@chyroc chyroc changed the title feat(api-client): 添加 CreateChatReq 类的自定义参数属性 feat: Support parameters for CreateChat May 19, 2025
@chyroc chyroc merged commit 209fc79 into coze-dev:main May 19, 2025
11 of 12 checks passed
@BingGo-1
Copy link

这个参数多久能发布新版本啊。急用

@chyroc
Copy link
Contributor

chyroc commented May 21, 2025

可以提交一个修改版本的 pr,合并后发版

@wstever
Copy link

wstever commented Nov 19, 2025

原来parameters 属性是个新增字段 !!!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants