-
Notifications
You must be signed in to change notification settings - Fork 9
增加toon #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
增加toon #170
Conversation
- Implement support for Toon format in prompt rendering and parsing. - Add new Toon-specific templates and partials (`output.toon.mustache`, `agent.user.events.toon.mustache`). - Enhance prompt service to dynamically select format based on configuration. - Introduce `ToonParser` utility for parsing Toon format responses. - Update `Config` to include `PromptFormatConfig` for format selection. - Log detailed parsing issues for improved troubleshooting.
…vices - Add warnings and errors for missing chat model candidates or configurations in `chat-switcher`. - Refine OpenAI provider configuration with simplified `retry` and `retryDelay` keys and improved initialization logic. - Enhance proxy agent configuration with timeout support. - Update `SharedProvider` to bind runtime configurations dynamically for methods (`chat`, `model`, etc.), including base URL and API key support. - Add and update models (`nemotron-3-nano-30b-a3b`), adjust aliases, and modify resource definitions in the shared model index. - Improve heartbeat processor to handle missing selected models and null LLM raw responses gracefully.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds support for a new "Toon" format for prompts alongside the existing JSON format, while also improving error handling and configuration across core services and providers. The PR introduces a configurable prompt format system that allows switching between JSON and Toon formats, which is claimed to be more token-efficient for long conversations.
Key changes include:
- Introduction of
ToonParserutility for parsing Toon format responses with detailed logging - Addition of
PromptFormatConfigto enable format selection between JSON and Toon - Simplification of OpenAI provider configuration with renamed keys and refactored initialization
- Enhanced error handling in chat-switcher and heartbeat processor with better logging
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
plugins/provider-openai/src/index.ts |
Simplified config keys (retry, retryDelay), removed local baseURL normalization, and refactored to use createOpenAI for provider initialization |
packages/shared-model/src/utils.ts |
Added 30-second connection timeout to proxy agent configuration |
packages/shared-model/src/index.ts |
Refactored runtime method binding to dynamically inject baseURL and apiKey for each model method call |
packages/shared-model/resources/model-index.json |
Added nemotron-3-nano-30b-a3b model, relocated and renamed qwen3-235b model from "Venice Large 1.1" to "Qwen3-235B-A22B" |
packages/core/src/shared/utils/toon-parser.ts |
Implemented new ToonParser class to parse Toon format with code block extraction and line-by-line parsing logic |
packages/core/src/shared/utils/index.ts |
Exported ToonParser for use in other modules |
packages/core/src/services/prompt/service.ts |
Enhanced render method to support format-specific template selection and partial mapping based on promptFormat config |
packages/core/src/services/prompt/config.ts |
Added PromptFormatConfig interface and schema with union type for "json" or "toon" format selection |
packages/core/src/services/model/service.ts |
Changed provider registration to log info instead of throwing error when provider already exists |
packages/core/src/services/model/chat-switcher.ts |
Added warning/error logs for missing candidate models and configuration retrieval failures |
packages/core/src/services/horizon/chat-mode/default-chat.ts |
Registered Toon-specific templates with try-catch blocks to gracefully handle missing templates |
packages/core/src/config.ts |
Integrated PromptFormatConfig into main config schema |
packages/core/src/agent/heartbeat-processor.ts |
Integrated ToonParser, improved null handling for model responses, enhanced validation with detailed error logging |
packages/core/resources/templates/partials/output.toon.mustache |
Added Toon format output template with specific formatting requirements |
packages/core/resources/templates/agent.user.events.toon.mustache |
Added Toon format user events template with structured conversation history |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ed event handling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated 23 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
河里 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
河里 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
河里 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
嗯~ Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
嗯 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
我觉得又解决了 |
…condition fix(event-manager): simplify data handling in record method refactor(service): remove unnecessary history cleanup on format change
|
我觉得又又解决了:D 1. 数据库存储逻辑变更 (event-manager.ts)
2. 移除历史记录清理逻辑 (service.ts)
3. 动态 Prompt 模板渲染 (default-chat.ts)
|
|
提示词应该已经和json的一致了:D |
feat: improve error handling and configuration in core and shared services
Add warnings and errors for missing chat model candidates or configurations in
chat-switcher.Refine OpenAI provider configuration with simplified
retryandretryDelaykeys and improved initialization logic.Enhance proxy agent configuration with timeout support.
Update
SharedProviderto bind runtime configurations dynamically for methods (chat,model, etc.), including base URL and API key support.Add and update models (
nemotron-3-nano-30b-a3b), adjust aliases, and modify resource definitions in the shared model index.Improve heartbeat processor to handle missing selected models and null LLM raw responses gracefully.
feat: add Toon format support for prompts and templates
Implement support for Toon format in prompt rendering and parsing.
Add new Toon-specific templates and partials (
output.toon.mustache,agent.user.events.toon.mustache).Enhance prompt service to dynamically select format based on configuration.
Introduce
ToonParserutility for parsing Toon format responses.Update
Configto includePromptFormatConfigfor format selection.Log detailed parsing issues for improved troubleshooting.
toon可谓是十分有潜力,加开关了所以自由切换,我相信在长对话一定可以省不少