MCPcopy Create free account
hub / github.com/xerrors/Yuxi / run

Function run

web/src/utils/__tests__/messageProcessor.spec.js:7–119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5const databases = [{ name: '财税库' }, { name: 'DifyKB' }, { name: 'LightGraphKB' }]
6
7const run = () => {
8 const conv = {
9 messages: [
10 {
11 type: 'ai',
12 tool_calls: [
13 {
14 name: '财税库',
15 tool_call_result: {
16 content: JSON.stringify([
17 {
18 content: 'A',
19 score: 0.9,
20 metadata: { source: 'doc-a', chunk_id: 'c1', file_id: 'f1', chunk_index: 1 }
21 },
22 {
23 content: 'A',
24 score: 0.8,
25 metadata: { source: 'doc-a', chunk_id: 'c1', file_id: 'f1', chunk_index: 1 }
26 }
27 ])
28 }
29 },
30 {
31 name: 'LightGraphKB',
32 tool_call_result: {
33 content: JSON.stringify({
34 data: {
35 chunks: [
36 {
37 content: 'B',
38 score: 0.4,
39 metadata: { source: 'doc-b', chunk_id: 'c2', file_id: 'f2', chunk_index: 2 }
40 }
41 ]
42 }
43 })
44 }
45 },
46 {
47 name: 'not_kb_tool',
48 tool_call_result: {
49 content: JSON.stringify([{ content: 'X', score: 0.99, metadata: { chunk_id: 'cx' } }])
50 }
51 },
52 {
53 name: 'DifyKB',
54 tool_call_result: { content: 'not-json' }
55 }
56 ]
57 }
58 ]
59 }
60
61 const chunks = MessageProcessor.extractKnowledgeChunksFromConversation(conv, databases)
62
63 // 1. Milvus/Dify 数组提取
64 assert.equal(

Callers 1

Tested by

no test coverage detected