-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
提交 issue 前,请先确认:
- [✓] 我已看过 FAQ,此问题不在列表中
- [✓] 我已看过其他 issue,他们不能解决我的问题
- 我认为这不是 Mirai 或者 OpenAI 的 BUG
表现
项目 kirara-ai 在云部署(如 Render.com Docker 环境)时,发现即使设置了环境变量 DATABASE_URL
,项目依然强制使用本地 sqlite 数据库,无法使用外部数据库(如 MySQL)。查阅源码后发现,DatabaseManager
在入口初始化时并没有读取环境变量或配置文件的数据库地址参数,导致外部数据库配置无效。
运行环境:
- 操作系统:Render.com
- Docker:官方镜像
- 项目版本:v3.2.0
复现步骤
- 在云平台部署 kirara-ai,设置环境变量
DATABASE_URL=mysql+pymysql://...
- 启动容器
- 查看日志,发现数据库依然为本地 sqlite,外部数据库未生效
预期行为
项目应支持通过环境变量 DATABASE_URL
或配置文件,配置外部数据库(如 MySQL),而不是始终写死本地 sqlite。
截图
日志示例:
2025-09-08T09:49:14.778479945Z ==> Starting service...
2025-09-08T09:49:32.890071954Z Data directory does not exist, creating...
2025-09-08T09:49:32.895435575Z Data directory is empty, copying default data...
2025-09-08T09:49:32.915848183Z cp: cannot stat '/tmp/data/.': No such file or directory
2025-09-08T09:49:32.916338304Z Config file does not exist, creating...
2025-09-08T09:49:32.919167147Z Venv directory does not exist, creating...
2025-09-08T09:50:08.02661168Z /usr/local/lib/python3.11/site-packages/telegramify_markdown/customize.py:66: DeprecationWarning: markdown_symbol is deprecated, and will be removed in a future release. Use get_config().markdown_symbol instead
2025-09-08T09:50:08.026641361Z markdown_symbol = get_runtime_config().markdown_symbol
2025-09-08T09:50:08.026645781Z /usr/local/lib/python3.11/site-packages/telegramify_markdown/customize.py:69: DeprecationWarning: cite_expandable is deprecated, and will be removed in a future release. Use get_config().cite_expandable instead
2025-09-08T09:50:08.026648801Z cite_expandable = get_runtime_config().cite_expandable
2025-09-08T09:50:08.026651732Z /usr/local/lib/python3.11/site-packages/telegramify_markdown/customize.py:72: DeprecationWarning: strict_markdown is deprecated, and will be removed in a future release. Use get_config().strict_markdown instead
2025-09-08T09:50:08.026655681Z strict_markdown = True
2025-09-08T09:50:08.026659342Z /usr/local/lib/python3.11/site-packages/telegramify_markdown/customize.py:75: DeprecationWarning: unescape_html is deprecated, and will be removed in a future release. Use get_config().unescape_html instead
2025-09-08T09:50:08.026662282Z unescape_html = get_runtime_config().unescape_html
2025-09-08T09:50:09.520383941Z 2025-09-08 09:50:05.314 | INFO | Entrypoint | Initializing application...
2025-09-08T09:50:09.520407922Z 2025-09-08 09:50:05.315 | INFO | Entrypoint | Loading configuration from ./data/config.yaml
2025-09-08T09:50:09.520411902Z 2025-09-08 09:50:05.318 | INFO | Entrypoint | Configuration loaded successfully
2025-09-08T09:50:09.520417852Z 2025-09-08 17:50:05.416 | INFO | DB | Running database migrations...
2025-09-08T09:50:09.520420832Z 2025-09-08 17:50:05.533 | INFO | DB | Database migrations completed
2025-09-08T09:50:09.520423722Z 2025-09-08 17:50:05.533 | INFO | DB | Database initialized at sqlite:///./data/db/kirara.db
2025-09-08T09:50:09.520426482Z new MediaManager
2025-09-08T09:50:09.520429382Z 2025-09-08 17:50:05.718 | INFO | Entrypoint | Initializing memory system...
2025-09-08T09:50:09.520432132Z 2025-09-08 17:50:05.719 | INFO | Entrypoint | Initializing tracing system...
2025-09-08T09:50:09.520434862Z 2025-09-08 17:50:05.720 | INFO | TracingManager | Initializing tracing manager
2025-09-08T09:50:09.520438302Z 2025-09-08 17:50:05.720 | INFO | Tracking | Initializing llm tracer
2025-09-08T09:50:09.520441122Z 2025-09-08 17:50:05.720 | INFO | Tracking | llm tracer initialized
2025-09-08T09:50:09.520443842Z 2025-09-08 17:50:05.726 | INFO | TracingManager | Tracing manager initialized
2025-09-08T09:50:09.520446562Z 2025-09-08 17:50:05.726 | INFO | Entrypoint | Tracing system initialized
2025-09-08T09:50:09.520449283Z 2025-09-08 17:50:05.726 | INFO | Entrypoint | Discovering internal plugins...
2025-09-08T09:50:09.520452943Z 2025-09-08 17:50:05.726 | INFO | PluginLoader | Discovering internal plugins from directory: /usr/local/lib/python3.11/site-packages/kirara_ai/plugins
2025-09-08T09:50:09.520466343Z 2025-09-08 17:50:05.726 | DEBUG | PluginLoader | Found plugin directory: bundled_frpc
2025-09-08T09:50:09.520469843Z 2025-09-08 17:50:05.727 | INFO | PluginLoader | Loading plugin: bundled_frpc
2025-09-08T09:50:09.520472783Z 2025-09-08 17:50:05.817 | DEBUG | PluginLoader | Instantiating plugin class: FrpcPlugin
2025-09-08T09:50:09.520476243Z 2025-09-08 17:50:05.817 | INFO | PluginLoader | Internal plugin bundled_frpc loaded successfully
2025-09-08T09:50:09.520479213Z 2025-09-08 17:50:05.817 | DEBUG | PluginLoader | Found plugin directory: im_telegram_adapter
2025-09-08T09:50:09.520482243Z 2025-09-08 17:50:05.817 | INFO | PluginLoader | Loading plugin: im_telegram_adapter
2025-09-08T09:50:09.520485434Z 2025-09-08 17:50:08.128 | DEBUG | PluginLoader | Instantiating plugin class: TelegramAdapterPlugin
2025-09-08T09:50:09.520488194Z 2025-09-08 17:50:08.129 | INFO | PluginLoader | Internal plugin im_telegram_adapter loaded successfully
2025-09-08T09:50:09.520490834Z 2025-09-08 17:50:08.129 | DEBUG | PluginLoader | Found plugin directory: im_wecom_adapter
2025-09-08T09:50:09.520493554Z 2025-09-08 17:50:08.129 | INFO | PluginLoader | Loading plugin: im_wecom_adapter
2025-09-08T09:50:09.520496334Z 2025-09-08 17:50:08.631 | DEBUG | PluginLoader | Instantiating plugin class: WecomAdapterPlugin
2025-09-08T09:50:09.520499604Z 2025-09-08 17:50:08.632 | INFO | PluginLoader | Internal plugin im_wecom_adapter loaded successfully
2025-09-08T09:50:09.520504924Z 2025-09-08 17:50:08.632 | DEBUG | PluginLoader | Found plugin directory: im_qqbot_adapter
2025-09-08T09:50:09.520507484Z 2025-09-08 17:50:08.632 | INFO | PluginLoader | Loading plugin: im_qqbot_adapter
2025-09-08T09:50:09.520510324Z 2025-09-08 17:50:09.415 | DEBUG | PluginLoader | Instantiating plugin class: QQBotAdapterPlugin
2025-09-08T09:50:09.520512924Z 2025-09-08 17:50:09.416 | INFO | PluginLoader | Internal plugin im_qqbot_adapter loaded successfully
2025-09-08T09:50:09.520519164Z 2025-09-08 17:50:09.416 | DEBUG | PluginLoader | Found plugin directory: llm_preset_adapters
2025-09-08T09:50:09.520522464Z 2025-09-08 17:50:09.416 | INFO | PluginLoader | Loading plugin: llm_preset_adapters
2025-09-08T09:50:09.520524394Z 2025-09-08 17:50:09.426 | DEBUG | PluginLoader | Instantiating plugin class: LLMPresetAdaptersPlugin
2025-09-08T09:50:09.520526084Z 2025-09-08 17:50:09.426 | INFO | PluginLoader | Internal plugin llm_preset_adapters loaded successfully
2025-09-08T09:50:09.520527804Z 2025-09-08 17:50:09.426 | DEBUG | PluginLoader | Found plugin directory: im_http_legacy_adapter
2025-09-08T09:50:09.520529535Z 2025-09-08 17:50:09.426 | INFO | PluginLoader | Loading plugin: im_http_legacy_adapter
2025-09-08T09:50:09.520531424Z 2025-09-08 17:50:09.428 | DEBUG | PluginLoader | Instantiating plugin class: HttpLegacyAdapterPlugin
2025-09-08T09:50:09.520537635Z 2025-09-08 17:50:09.428 | INFO | PluginLoader | Internal plugin im_http_legacy_adapter loaded successfully
2025-09-08T09:50:09.520539495Z 2025-09-08 17:50:09.429 | INFO | Entrypoint | Discovering external plugins...
2025-09-08T09:50:09.520541255Z 2025-09-08 17:50:09.429 | INFO | PluginLoader | Discovering external plugins...
2025-09-08T09:50:09.520543025Z 2025-09-08 17:50:09.518 | INFO | Entrypoint | Loading plugins
2025-09-08T09:50:09.520544745Z 2025-09-08 17:50:09.518 | INFO | PluginLoader | Initializing plugins...
2025-09-08T09:50:09.520546365Z 2025-09-08 17:50:09.518 | INFO | PluginLoader | Plugin FrpcPlugin initialized
2025-09-08T09:50:09.520548015Z 2025-09-08 17:50:09.519 | INFO | PluginLoader | Plugin TelegramAdapterPlugin initialized
2025-09-08T09:50:09.520549665Z 2025-09-08 17:50:09.519 | INFO | PluginLoader | Plugin WecomAdapterPlugin initialized
2025-09-08T09:50:09.520551315Z 2025-09-08 17:50:09.519 | INFO | PluginLoader | Plugin QQBotAdapterPlugin initialized
2025-09-08T09:50:09.520553875Z 2025-09-08 17:50:09.519 | INFO | kirara_ai.llm.llm_registry | Registered LLM backend adapter: OpenAI, ability: LLMAbility.TextChat
2025-09-08T09:50:09.520555625Z 2025-09-08 17:50:09.519 | INFO | kirara_ai.llm.llm_registry | Registered LLM backend adapter: DeepSeek, ability: LLMAbility.TextChat
2025-09-08T09:50:09.520557335Z 2025-09-08 17:50:09.519 | INFO | kirara_ai.llm.llm_registry | Registered LLM backend adapter: Gemini, ability: LLMAbility.TextChat
2025-09-08T09:50:09.520558995Z 2025-09-08 17:50:09.519 | INFO | kirara_ai.llm.llm_registry | Registered LLM backend adapter: Ollama, ability: LLMAbility.TextChat
2025-09-08T09:50:09.520560635Z 2025-09-08 17:50:09.519 | INFO | kirara_ai.llm.llm_registry | Registered LLM backend adapter: Claude, ability: LLMAbility.TextChat
2025-09-08T09:50:09.520562285Z 2025-09-08 17:50:09.519 | INFO | kirara_ai.llm.llm_registry | Registered LLM backend adapter: SiliconFlow, ability: LLMAbility.TextChat
2025-09-08T09:50:09.520563955Z 2025-09-08 17:50:09.519 | INFO | kirara_ai.llm.llm_registry | Registered LLM backend adapter: TencentCloud, ability: LLMAbility.TextChat
2025-09-08T09:50:09.520565605Z 2025-09-08 17:50:09.519 | INFO | kirara_ai.llm.llm_registry | Registered LLM backend adapter: AlibabaCloud, ability: LLMAbility.TextChat
2025-09-08T09:50:09.520567275Z 2025-09-08 17:50:09.519 | INFO | kirara_ai.llm.llm_registry | Registered LLM backend adapter: Moonshot, ability: LLMAbility.TextChat
2025-09-08T09:50:09.520568925Z 2025-09-08 17:50:09.519 | INFO | kirara_ai.llm.llm_registry | Registered LLM backend adapter: OpenRouter, ability: LLMAbility.TextChat
2025-09-08T09:50:09.520570765Z 2025-09-08 17:50:09.519 | INFO | kirara_ai.llm.llm_registry | Registered LLM backend adapter: Minimax, ability: LLMAbility.TextChat
2025-09-08T09:50:09.520573825Z 2025-09-08 17:50:09.520 | INFO | kirara_ai.llm.llm_registry | Registered LLM backend adapter: Volcengine, ability: LLMAbility.TextChat
2025-09-08T09:50:15.52726147Z ==> Your service is live 🎉
2025-09-08T09:50:15.556687208Z ==>
2025-09-08T09:50:15.584640965Z ==> ///////////////////////////////////////////////////////////
2025-09-08T09:50:15.609905223Z ==>
2025-09-08T09:50:15.637591971Z ==> Available at your primary URL https://kirara-agent-framework-latest.onrender.com
2025-09-08T09:50:15.664884688Z ==>
2025-09-08T09:50:15.691938406Z ==> ///////////////////////////////////////////////////////////

其他内容
建议在入口文件实例化 DatabaseManager
时,优先读取环境变量 DATABASE_URL
感谢开发者!
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working