NextChat icon indicating copy to clipboard operation
NextChat copied to clipboard

Add DEFAULT_COMPRESS_MODEL configuration

Open noctiro opened this issue 10 months ago • 4 comments

💻 变更类型 | Change Type

  • [x] feat
  • [ ] fix
  • [ ] refactor
  • [ ] perf
  • [x] style
  • [ ] test
  • [x] docs
  • [ ] ci
  • [ ] chore
  • [x] build

🔀 变更说明 | Description of Change

  1. 添加自定义压缩(总结)模型默认项 Add DEFAULT_COMPRESS_MODEL configuration

  2. compress model 设置项的样式与 model 设置项的样式统一 Align the style of the compress model setting with that of the model setting.

📝 补充信息 | Additional Information

I also noticed that both 'compress' and 'summary' appear in the code. Should I merge them into 'summary' in this PR? 还有我注意到代码中存在compress和summary这两个词汇同时存在,需要顺便在我这个PR将其合为一个summary?

Summary by CodeRabbit

  • New Features
    • Introduced an optional environment variable to customize the default compression model used by the application.
  • Documentation
    • Updated help texts and guides across multiple languages to reflect the new configuration option and streamline related variable descriptions.
  • Refactor
    • Enhanced the model selection interface by grouping options by provider, making it easier to choose the appropriate model.

noctiro avatar Feb 04 '25 03:02 noctiro

@Noctiro is attempting to deploy a commit to the NextChat Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Feb 04 '25 03:02 vercel[bot]

Walkthrough

The changes introduce a new optional configuration parameter, DEFAULT_COMPRESS_MODEL, across multiple files. This variable is added to the environment template, documented in README files (including Chinese and Japanese versions), and integrated into both server-side configuration and frontend state management. The updates include adjustments to API configuration, conditional logic in the chat module, and UI enhancements for model selection grouping. The modifications ensure that the compression model setting flows from environment definition through to the application’s configuration and display logic.

Changes

File(s) Change Summary
.env.template Added new optional environment variable DEFAULT_COMPRESS_MODEL with a default empty value.
README.md, README_CN.md, README_JA.md Updated documentation: added description for DEFAULT_COMPRESS_MODEL; removed description for STABILITY_URL (in README.md); clarified sections such as VISION_MODELS (in README_CN.md).
app/api/config/route.ts Added new property defaultCompressModel to the DANGER_CONFIG object and updated the DangerConfig type definition.
app/config/server.ts Extended the ProcessEnv interface and updated getServerSideConfig to handle DEFAULT_COMPRESS_MODEL, including logic to reset this value when GPT-4 models are disabled.
app/store/access.ts Introduced new defaultCompressModel property in DEFAULT_ACCESS_STATE and modified the fetch logic to update the model configuration based on the received value from the server.
app/store/chat.ts Modified the getSummarizeModel function to conditionally return the compressModel and its provider if defined in the configuration, adjusting the selection flow.
app/components/model-config.tsx Updated the model selection rendering to group models by their provider using the groupBy function from lodash-es, enhancing the clarity of options in the user interface.

Sequence Diagram(s)

sequenceDiagram
  participant E as Environment (.env)
  participant S as Server (getServerSideConfig)
  participant A as Access Store
  participant C as Chat Module

  E->>S: Provide DEFAULT_COMPRESS_MODEL value
  S->>S: Read and process DEFAULT_COMPRESS_MODEL (reset if GPT-4 disabled)
  S->>A: Return configuration with defaultCompressModel
  A->>A: Update DEFAULT_ACCESS_STATE with defaultCompressModel
  C->>A: Request model config (via getSummarizeModel)
  A-->>C: Return compressModel and provider details

Poem

I'm a bunny with a curious code delight,
Hopping through configs from morning till night.
A new compress model now joins my garden so fair,
Guiding my code with gentle, playful care.
With whiskers twitching in lines of pure cheer, I celebrate these changes, oh dear!
🐰🌸


📜 Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between afdf3a5cd435e250fa1e2fd184171328b36b915f and 937e2b5a5437a75e21d4450a665b6197e4c4bbe8.

📒 Files selected for processing (6)
  • .env.template (1 hunks)
  • README.md (1 hunks)
  • README_CN.md (1 hunks)
  • README_JA.md (1 hunks)
  • app/config/server.ts (4 hunks)
  • app/store/access.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • .env.template
  • README_JA.md
  • README_CN.md
  • app/store/access.ts
  • app/config/server.ts
  • README.md

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

coderabbitai[bot] avatar Feb 04 '25 03:02 coderabbitai[bot]

为什么还不合入,直到今天很多模型总结还是用的自身

yywo avatar Mar 10 '25 12:03 yywo

Bot detected the issue body's language is not English, translate it automatically.


Why isn't it fit? To this day, many models are summarized by themselves.

Issues-translate-bot avatar Mar 10 '25 12:03 Issues-translate-bot