Skip to content

Commit bf3e8cd

Browse files
committed
chore: 添加 bug 修复发布流程和更新 CallStatsComponent 及 KnowledgeStatsComponent 以优化数据展示
1 parent b8bfc97 commit bf3e8cd

File tree

4 files changed

+163
-175
lines changed

4 files changed

+163
-175
lines changed

docs/changelog/contributing.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,43 @@ test: 添加测试
5858
chore: 构建过程或辅助工具的变动
5959
```
6060

61+
62+
## 🐞 Bug 修复发布流程
63+
64+
如果在发布 `v0.3.0` 后发现 bug:
65+
66+
### ✅ 情况 1:main 上没有未完成的新功能
67+
68+
直接在 main 修复并发布:
69+
70+
```bash
71+
git commit -m "fix: resolve config parser crash"
72+
git tag -a v0.3.1 -m "Hotfix v0.3.1"
73+
git push origin main --tags
74+
```
75+
76+
### ⚙️ 情况 2:main 上已有新功能未完成
77+
78+
从上一个 tag 建立 hotfix 分支:
79+
80+
```bash
81+
git checkout -b hotfix/0.3.1 v0.3.0
82+
# 修复问题
83+
git commit -m "fix: resolve config parser crash"
84+
git push origin hotfix/0.3.1
85+
86+
# 测试后合并回 main 并打 tag
87+
git checkout main
88+
git merge --no-ff hotfix/0.3.1
89+
git tag -a v0.3.1 -m "Hotfix v0.3.1"
90+
git push origin main --tags
91+
92+
# 删除临时分支
93+
git branch -d hotfix/0.3.1
94+
git push origin --delete hotfix/0.3.1
95+
```
96+
97+
6198
### 测试要求
6299

63100
::: tip 测试

server/routers/graph_router.py

Lines changed: 0 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -221,152 +221,6 @@ async def get_neo4j_node(
221221
# =============================================================================
222222

223223

224-
@graph.get("/lightrag/test-data")
225-
async def create_test_graph_data(
226-
db_id: str = Query(..., description="数据库ID"), current_user: User = Depends(get_admin_user)
227-
):
228-
"""
229-
创建测试图谱数据(临时API,用于演示图谱功能)
230-
"""
231-
try:
232-
logger.info(f"创建测试图谱数据 - db_id: {db_id}")
233-
234-
# 检查是否是 LightRAG 数据库
235-
if not knowledge_base.is_lightrag_database(db_id):
236-
raise HTTPException(
237-
status_code=400, detail=f"数据库 {db_id} 不是 LightRAG 类型,图谱功能仅支持 LightRAG 知识库"
238-
)
239-
240-
# 获取 LightRAG 实例
241-
rag_instance = await knowledge_base._get_lightrag_instance(db_id)
242-
if not rag_instance:
243-
raise HTTPException(status_code=404, detail=f"LightRAG 数据库 {db_id} 不存在或无法访问")
244-
245-
# 创建测试图谱数据
246-
test_nodes = [
247-
{
248-
'id': '宋晓宁',
249-
'labels': ['人物'],
250-
'entity_type': 'person',
251-
'properties': {
252-
'entity_id': '宋晓宁',
253-
'entity_type': 'person',
254-
'description': '人工智能学院项目负责人',
255-
'file_path': 'test'
256-
}
257-
},
258-
{
259-
'id': '江南大学',
260-
'labels': ['机构'],
261-
'entity_type': 'organization',
262-
'properties': {
263-
'entity_id': '江南大学',
264-
'entity_type': 'organization',
265-
'description': '江南大学',
266-
'file_path': 'test'
267-
}
268-
},
269-
{
270-
'id': '食品安全知识图谱',
271-
'labels': ['项目'],
272-
'entity_type': 'project',
273-
'properties': {
274-
'entity_id': '食品安全知识图谱',
275-
'entity_type': 'project',
276-
'description': '食品安全知识图谱和监管控制平台的构建与应用示范',
277-
'file_path': 'test'
278-
}
279-
},
280-
{
281-
'id': '无锡君桥汽车租赁有限公司',
282-
'labels': ['公司'],
283-
'entity_type': 'company',
284-
'properties': {
285-
'entity_id': '无锡君桥汽车租赁有限公司',
286-
'entity_type': 'company',
287-
'description': '汽车租赁服务公司',
288-
'file_path': 'test'
289-
}
290-
},
291-
{
292-
'id': '租车费',
293-
'labels': ['费用'],
294-
'entity_type': 'expense',
295-
'properties': {
296-
'entity_id': '租车费',
297-
'entity_type': 'expense',
298-
'description': '租车费用300元',
299-
'file_path': 'test'
300-
}
301-
}
302-
]
303-
304-
test_edges = [
305-
{
306-
'id': '宋晓宁-江南大学-工作于',
307-
'source': '宋晓宁',
308-
'target': '江南大学',
309-
'type': 'WORKS_AT',
310-
'properties': {
311-
'description': '宋晓宁工作于江南大学',
312-
'keywords': '工作关系'
313-
}
314-
},
315-
{
316-
'id': '宋晓宁-食品安全知识图谱-负责',
317-
'source': '宋晓宁',
318-
'target': '食品安全知识图谱',
319-
'type': 'RESPONSIBLE_FOR',
320-
'properties': {
321-
'description': '宋晓宁负责食品安全知识图谱项目',
322-
'keywords': '负责关系'
323-
}
324-
},
325-
{
326-
'id': '宋晓宁-租车费-产生',
327-
'source': '宋晓宁',
328-
'target': '租车费',
329-
'type': 'INCURRED',
330-
'properties': {
331-
'description': '宋晓宁产生租车费用',
332-
'keywords': '费用关系'
333-
}
334-
},
335-
{
336-
'id': '租车费-无锡君桥汽车租赁有限公司-支付给',
337-
'source': '租车费',
338-
'target': '无锡君桥汽车租赁有限公司',
339-
'type': 'PAID_TO',
340-
'properties': {
341-
'description': '租车费支付给无锡君桥汽车租赁有限公司',
342-
'keywords': '支付关系'
343-
}
344-
}
345-
]
346-
347-
result = {
348-
"success": True,
349-
"data": {
350-
"nodes": test_nodes,
351-
"edges": test_edges,
352-
"is_truncated": False,
353-
"total_nodes": len(test_nodes),
354-
"total_edges": len(test_edges),
355-
},
356-
}
357-
358-
logger.info(f"成功创建测试图谱 - 节点数: {len(test_nodes)}, 边数: {len(test_edges)}")
359-
return result
360-
361-
except HTTPException:
362-
# 重新抛出 HTTP 异常
363-
raise
364-
except Exception as e:
365-
logger.error(f"创建测试图谱数据失败: {e}")
366-
logger.error(f"Traceback: {traceback.format_exc()}")
367-
raise HTTPException(status_code=500, detail=f"创建测试图谱数据失败: {str(e)}")
368-
369-
370224
@graph.get("/lightrag/stats")
371225
async def get_lightrag_stats(
372226
db_id: str = Query(..., description="数据库ID"), current_user: User = Depends(get_admin_user)

web/src/components/dashboard/CallStatsComponent.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const props = defineProps({
5252
const callStatsData = ref(null)
5353
const callStatsLoading = ref(false)
5454
const callTimeRange = ref('14days')
55-
const callDataType = ref('models')
55+
const callDataType = ref('agents')
5656
const timeRangeOptions = [
5757
{ value: '14hours', label: '近14小时' },
5858
{ value: '14days', label: '近14天' },

0 commit comments

Comments
 (0)