fix: LLM config query uses 'default' DB only, not calling module's DB

Problem: When integrated_crm_app calls llm_chat(), _get_llm_config() used
env.get_module_dbname('harnessed_agent') which returned 'crm_db' (the
calling module's DB), causing it to read stale/wrong config (qwen3-max)
instead of the correct config from default DB (qwen3.6-plus).

Fix: Remove get_module_dbname() call. LLM config is global and shared
across all modules, so always query from 'default' database.
This commit is contained in:
yumoqing 2026-05-07 15:49:12 +08:00
parent 6165c4b1cd
commit 8e10a24d55

View File

@ -76,15 +76,13 @@ LLM_PROVIDERS = {
# ============================================================
async def _get_llm_config() -> Dict[str, Any]:
"""Get LLM client configuration from harnessed_agent_config table."""
"""Get LLM client configuration from harnessed_agent_config table.
Uses 'default' database only, as LLM config is global and shared across modules.
Do NOT use get_module_dbname() which returns the calling module's DB (e.g. crm_db),
which may have stale or incorrect config data.
"""
dbnames_to_try = ['default']
try:
env = ServerEnv()
module_db = env.get_module_dbname('harnessed_agent')
if module_db not in dbnames_to_try:
dbnames_to_try.insert(0, module_db)
except Exception:
pass
for dbname in dbnames_to_try:
try: