|
5 | 5 |
|
6 | 6 | class IMConfig(BaseModel): |
7 | 7 | """IM配置""" |
| 8 | + |
8 | 9 | name: str = Field(default="", description="IM标识名称") |
9 | 10 | enable: bool = Field(default=True, description="是否启用IM") |
10 | 11 | adapter: str = Field(default="dummy", description="IM适配器类型") |
11 | 12 | config: Dict[str, Any] = Field(default={}, description="IM的配置") |
12 | 13 |
|
| 14 | + |
13 | 15 | class LLMBackendConfig(BaseModel): |
14 | 16 | """LLM后端配置""" |
| 17 | + |
15 | 18 | name: str = Field(description="后端标识名称") |
16 | 19 | adapter: str = Field(description="LLM适配器类型") |
17 | 20 | config: Dict[str, Any] = Field(default={}, description="后端配置") |
18 | 21 | enable: bool = Field(default=True, description="是否启用") |
19 | 22 | models: List[str] = Field(default=[], description="支持的模型列表") |
20 | 23 |
|
| 24 | + |
21 | 25 | class LLMConfig(BaseModel): |
22 | | - api_backends: List[LLMBackendConfig] = Field(default=[], description="LLM API后端列表") |
| 26 | + api_backends: List[LLMBackendConfig] = Field( |
| 27 | + default=[], description="LLM API后端列表" |
| 28 | + ) |
| 29 | + |
23 | 30 |
|
24 | 31 | class DefaultConfig(BaseModel): |
25 | | - llm_model: str = Field(default="gemini-1.5-flash", description="默认使用的 LLM 模型名称") |
| 32 | + llm_model: str = Field( |
| 33 | + default="gemini-1.5-flash", description="默认使用的 LLM 模型名称" |
| 34 | + ) |
| 35 | + |
26 | 36 |
|
27 | 37 | class MemoryPersistenceConfig(BaseModel): |
28 | 38 | type: str = Field(default="file", description="持久化类型: file/redis") |
29 | 39 | file: Dict[str, Any] = Field( |
30 | | - default={ |
31 | | - "storage_dir": "./data/memory" |
32 | | - }, |
33 | | - description="文件持久化配置" |
| 40 | + default={"storage_dir": "./data/memory"}, description="文件持久化配置" |
34 | 41 | ) |
35 | 42 | redis: Dict[str, Any] = Field( |
36 | | - default={ |
37 | | - "host": "localhost", |
38 | | - "port": 6379, |
39 | | - "db": 0 |
40 | | - }, |
41 | | - description="Redis持久化配置" |
| 43 | + default={"host": "localhost", "port": 6379, "db": 0}, |
| 44 | + description="Redis持久化配置", |
42 | 45 | ) |
43 | 46 |
|
| 47 | + |
44 | 48 | class MemoryConfig(BaseModel): |
45 | 49 | persistence: MemoryPersistenceConfig = MemoryPersistenceConfig() |
46 | 50 | max_entries: int = Field(default=100, description="每个作用域最大记忆条目数") |
47 | 51 | default_scope: str = Field(default="member", description="默认作用域类型") |
48 | | - |
| 52 | + |
| 53 | + |
49 | 54 | class WebConfig(BaseModel): |
50 | 55 | host: str = Field(default="127.0.0.1", description="Web服务绑定的IP地址") |
51 | 56 | port: int = Field(default=8080, description="Web服务端口号") |
52 | 57 | secret_key: str = Field(default="", description="Web服务的密钥,用于JWT等加密") |
53 | | - password_file: str = Field(default="./data/web/password.hash", description="密码哈希存储路径") |
| 58 | + password_file: str = Field( |
| 59 | + default="./data/web/password.hash", description="密码哈希存储路径" |
| 60 | + ) |
| 61 | + |
54 | 62 |
|
55 | 63 | class PluginConfig(BaseModel): |
56 | 64 | """插件配置""" |
| 65 | + |
57 | 66 | enable: List[str] = Field(default=[], description="启用的外部插件列表") |
58 | | - market_base_url: str = Field(default="https://kirara-plugin.app.lss233.com/api/v1", description="插件市场基础URL") |
| 67 | + market_base_url: str = Field( |
| 68 | + default="https://kirara-plugin.app.lss233.com/api/v1", |
| 69 | + description="插件市场基础URL", |
| 70 | + ) |
| 71 | + |
59 | 72 |
|
60 | 73 | class GlobalConfig(BaseModel): |
61 | 74 | ims: List[IMConfig] = Field(default=[], description="IM配置列表") |
|
0 commit comments