fix: 普通对话使用后台配置的LLM
This commit is contained in:
@@ -1345,8 +1345,18 @@ def get_frontend_config():
|
|||||||
conn = get_db()
|
conn = get_db()
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
|
|
||||||
# 获取默认LLM配置
|
# 先获取默认对话配置
|
||||||
cursor.execute('SELECT * FROM llm_configs WHERE is_default=1 AND is_active=1 LIMIT 1')
|
cursor.execute('SELECT * FROM chat_configs WHERE is_default=1 LIMIT 1')
|
||||||
|
chat_config = cursor.fetchone()
|
||||||
|
|
||||||
|
# 根据对话配置中的 llm_config_id 获取对应的 LLM 配置
|
||||||
|
llm_config_id = chat_config['llm_config_id'] if chat_config else 1
|
||||||
|
cursor.execute('SELECT * FROM llm_configs WHERE id=?', (llm_config_id,))
|
||||||
|
llm = cursor.fetchone()
|
||||||
|
|
||||||
|
# 如果找不到对应的LLM配置,使用默认的
|
||||||
|
if not llm:
|
||||||
|
cursor.execute('SELECT * FROM llm_configs WHERE is_default=1 LIMIT 1')
|
||||||
llm = cursor.fetchone()
|
llm = cursor.fetchone()
|
||||||
|
|
||||||
# 获取默认工具配置(搜索等)
|
# 获取默认工具配置(搜索等)
|
||||||
@@ -1361,10 +1371,6 @@ def get_frontend_config():
|
|||||||
cursor.execute('SELECT agent_id, name, avatar, category, description, system_prompt, heat, tags, enable_tools FROM agents WHERE is_online=1 AND is_active=1')
|
cursor.execute('SELECT agent_id, name, avatar, category, description, system_prompt, heat, tags, enable_tools FROM agents WHERE is_online=1 AND is_active=1')
|
||||||
agents = [dict(row) for row in cursor.fetchall()]
|
agents = [dict(row) for row in cursor.fetchall()]
|
||||||
|
|
||||||
# 获取默认对话配置
|
|
||||||
cursor.execute('SELECT * FROM chat_configs WHERE is_default=1 LIMIT 1')
|
|
||||||
chat_config = cursor.fetchone()
|
|
||||||
|
|
||||||
# 获取系统配置
|
# 获取系统配置
|
||||||
cursor.execute('SELECT key, value FROM system_configs')
|
cursor.execute('SELECT key, value FROM system_configs')
|
||||||
system = {row['key']: row['value'] for row in cursor.fetchall()}
|
system = {row['key']: row['value'] for row in cursor.fetchall()}
|
||||||
|
|||||||
Reference in New Issue
Block a user