add
This commit is contained in:
+120
-5
@@ -5,10 +5,125 @@ description: 执行sql的时候需要参考该技能的说明
|
||||
|
||||
# mis-table
|
||||
|
||||
请结合<库表与字段信息>生成最终要执行的sql。
|
||||
请根据下文内容生成sql。
|
||||
|
||||
## 库表与字段信息
|
||||
## 查询智能体对话日志
|
||||
|
||||
|数据库|表|字段|说明|
|
||||
|---|---|---|---|
|
||||
|mis-agent|log_agent_chat|chat_window_id|会话ID|
|
||||
### 输入要求
|
||||
|
||||
必须要求用户提供**会话ID**。
|
||||
|
||||
### 查询步骤
|
||||
|
||||
1. 查询所有切片号,假设查询出来的`part`是[1,2]
|
||||
|
||||
```sql
|
||||
select part from log_agent_chat where del_flag = '0';
|
||||
```
|
||||
|
||||
2. 根据切片号查询并合并各个切片表的数据
|
||||
|
||||
```sql
|
||||
select * from log_agent_chat_1 where chat_window_id = <会话ID>
|
||||
UNION ALL
|
||||
select * from log_agent_chat_2 where chat_window_id = <会话ID>
|
||||
```
|
||||
|
||||
## 查询智能体信息
|
||||
|
||||
### 输入要求
|
||||
|
||||
必须提供**智能体ID**,在不明确用户查询的是单智能体还是多智能体时,友好的询问要查询哪种智能体。
|
||||
|
||||
### 执行查询单智能体信息
|
||||
|
||||
```sql
|
||||
with agent_info AS (
|
||||
select
|
||||
agent_id,
|
||||
agent_name,
|
||||
system_prompt,
|
||||
`description`,
|
||||
max_messages,
|
||||
max_tokens,
|
||||
kb_uuids,
|
||||
kb_configs,
|
||||
kb_similarity_threshold,
|
||||
kb_top_k,
|
||||
kb_max_recall_toekn,
|
||||
llm_name,
|
||||
long_term_memory,
|
||||
case kb_mode when '1' then '直接检索' when '2' then 'tool检索' else '' end AS kb_mode,
|
||||
case kb_search_type when '0' then '向量检索' when '1' then '混合检索' when '2' then '智能检索' else '' end AS kb_search_type
|
||||
from mis-agent.agent
|
||||
where agent_id = <智能体ID>
|
||||
),
|
||||
agent_skill AS (
|
||||
select
|
||||
<智能体ID> AS agent_id,
|
||||
GROUP_CONCAT(skill_name) AS skill_names
|
||||
from mis-mcp.skill
|
||||
where skill_id in (
|
||||
select skill_id from mis-agent.agent_skill_mapping
|
||||
where agent_id = <智能体ID>
|
||||
)
|
||||
),
|
||||
agent_mcp_tool AS (
|
||||
select
|
||||
<智能体ID> AS agent_id,
|
||||
GROUP_CONCAT(tool_name) AS tool_names
|
||||
from mis-mcp.map_tools
|
||||
where mcp_server_uuid in (
|
||||
select mcp_server_uuid from mis-agent.agent_tool_mapping
|
||||
where relate_agent_id = <智能体ID>
|
||||
)
|
||||
)
|
||||
|
||||
select * from agent_info AS a
|
||||
left join agent_skill AS b on a.agent_id = b.agent_id
|
||||
left join agent_mcp_tool AS c on a.agent_id = c.agent_id
|
||||
```
|
||||
|
||||
### 执行查询多智能体信息
|
||||
|
||||
```sql
|
||||
select * from mis-agent.agent_release_info where release_id in (
|
||||
select
|
||||
release_id
|
||||
from mis-agent.multi_agent_sub
|
||||
where main_agent_id = <智能体ID>
|
||||
)
|
||||
```
|
||||
|
||||
## 查询智能体使用数据
|
||||
|
||||
### 输入要求
|
||||
|
||||
必须提供**智能体ID**。
|
||||
|
||||
|
||||
### 执行查询
|
||||
|
||||
```sql
|
||||
select * from mis-agent.agent_usage_stats_daily where agent_id = <智能体ID> order by daily desc
|
||||
```
|
||||
|
||||
## 查询项目统计数据
|
||||
|
||||
### 输入要求
|
||||
|
||||
必须提供**项目名称**。
|
||||
|
||||
### 查询步骤
|
||||
|
||||
1. 查询项目注册表,判断是否包含该项目。用户提供的项目名称大概率是模糊的,比如"认证"、"ebiz",要根据语义判断究竟是哪一个,如果猜不准就询问一下用户是哪个。重要:`project_stats_registry`里的`id`字段,称为项目ID,或者叫project_id,后面的步骤需要用到。
|
||||
|
||||
```sql
|
||||
select * from mis-agent.project_stats_registry
|
||||
```
|
||||
|
||||
2. 查询项目统计数据
|
||||
|
||||
```sql
|
||||
select * from mis-agent.project_data_stats_daily where project_id = <project_id>
|
||||
```
|
||||
Reference in New Issue
Block a user