refactor: match provider and model using a consistent method (#7933)
* refactor: match provider and model using a consistent method * refactor: use keywords matching across model selectors * refactor: update match, reuse getFancyProviderName * refactor: use modelSelectFilter in knowledgebase settings * refactor: use filter in ModelList * refactor: add filterModelsByKeywords * refactor: add getModelSelectOptions * style: better function names * fix: update effect dependencies in popup and panel components Adjusted dependency arrays in HtmlArtifactsPopup and QuickPanelView to ensure correct effect execution. This change improves state synchronization and prevents unnecessary updates. * refactor: use match in memory settings * refactor: add avatar to model selector * refactor: simplify utils, move select options to components * docs: add comments * refactor: move filter to SelectOptions * test: add tests for SelectOptions * test: remove type mock * refactor: use match in EditModelsPopup * refactor: use SelectOptions in SelectProviderModelPopup, add more tests * fix: api check model select * refactor: improve websearch rag model select style * refactor: add a ModelSelector * test: update tests for ModelSelector * docs: comments --------- Co-authored-by: 自由的世界人 <3196812536@qq.com>
This commit is contained in:
@@ -145,8 +145,8 @@ In a development environment, you can define environment variables to filter dis
|
||||
|
||||
Environment variables can be set in the terminal or defined in the `.env` file in the project's root directory. The available variables are as follows:
|
||||
|
||||
| Variable Name | Description |
|
||||
| ------- | ------- |
|
||||
| Variable Name | Description |
|
||||
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| CSLOGGER_MAIN_LEVEL | Log level for the `main` process. Logs below this level will not be displayed. |
|
||||
| CSLOGGER_MAIN_SHOW_MODULES | Filters log modules for the `main` process. Use a comma (`,`) to separate modules. The filter is case-sensitive. Only logs from modules in this list will be displayed. |
|
||||
| CSLOGGER_RENDERER_LEVEL | Log level for the `renderer` process. Logs below this level will not be displayed. |
|
||||
@@ -160,6 +160,7 @@ CSLOGGER_MAIN_SHOW_MODULES=MCPService,SelectionService
|
||||
```
|
||||
|
||||
Note:
|
||||
|
||||
- Environment variables are only effective in the development environment.
|
||||
- These variables only affect the logs displayed in the terminal or DevTools. They do not affect file logging or the `logToMain` recording logic.
|
||||
|
||||
@@ -168,7 +169,7 @@ Note:
|
||||
There are many log levels. The following are the guidelines that should be followed in CherryStudio for when to use each level:
|
||||
(Arranged from highest to lowest log level)
|
||||
|
||||
| Log Level | Core Definition & Use case | Example |
|
||||
| Log Level | Core Definition & Use case | Example |
|
||||
| :------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **`error`** | **Critical error causing the program to crash or core functionality to become unusable.** <br> This is the highest-priority log, usually requiring immediate reporting or user notification. | - Main or renderer process crash. <br> - Failure to read/write critical user data files (e.g., database, configuration files), preventing the application from running. <br> - All unhandled exceptions. |
|
||||
| **`warn`** | **Potential issue or unexpected situation that does not affect the program's core functionality.** <br> The program can recover or use a fallback. | - Configuration file `settings.json` is missing; started with default settings. <br> - Auto-update check failed, but does not affect the use of the current version. <br> - A non-essential plugin failed to load. |
|
||||
|
||||
@@ -145,12 +145,12 @@ const logger = loggerService.initWindowSource('Worker').withContext('LetsWork')
|
||||
|
||||
环境变量可以在终端中自行设置,或者在开发根目录的`.env`文件中进行定义,可以定义的变量如下:
|
||||
|
||||
| 变量名 | 含义 |
|
||||
| ----- | ----- |
|
||||
| CSLOGGER_MAIN_LEVEL | 用于`main`进程的日志级别,低于该级别的日志将不显示 |
|
||||
| CSLOGGER_MAIN_SHOW_MODULES | 用于`main`进程的日志module筛选,用`,`分隔,区分大小写。只有在该列表中的module的日志才会显示 |
|
||||
| CSLOGGER_RENDERER_LEVEL | 用于`renderer`进程的日志级别,低于该级别的日志将不显示 |
|
||||
| CSLOGGER_RENDERER_SHOW_MODULES | 用于`renderer`进程的日志module筛选,用`,`分隔,区分大小写。只有在该列表中的module的日志才会显示 |
|
||||
| 变量名 | 含义 |
|
||||
| ------------------------------ | ----------------------------------------------------------------------------------------------- |
|
||||
| CSLOGGER_MAIN_LEVEL | 用于`main`进程的日志级别,低于该级别的日志将不显示 |
|
||||
| CSLOGGER_MAIN_SHOW_MODULES | 用于`main`进程的日志module筛选,用`,`分隔,区分大小写。只有在该列表中的module的日志才会显示 |
|
||||
| CSLOGGER_RENDERER_LEVEL | 用于`renderer`进程的日志级别,低于该级别的日志将不显示 |
|
||||
| CSLOGGER_RENDERER_SHOW_MODULES | 用于`renderer`进程的日志module筛选,用`,`分隔,区分大小写。只有在该列表中的module的日志才会显示 |
|
||||
|
||||
示例:
|
||||
|
||||
@@ -160,6 +160,7 @@ CSLOGGER_MAIN_SHOW_MODULES=MCPService,SelectionService
|
||||
```
|
||||
|
||||
注意:
|
||||
|
||||
- 环境变量仅在开发环境中生效
|
||||
- 该变量仅会改变在终端或在devTools中显示的日志,不会影响文件日志和`logToMain`的记录逻辑
|
||||
|
||||
|
||||
Reference in New Issue
Block a user