ltcai 6.5.0 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -35
- package/docs/CHANGELOG.md +59 -2
- package/frontend/openapi.json +65 -1
- package/frontend/src/App.tsx +78 -3
- package/frontend/src/api/client.ts +1 -0
- package/frontend/src/api/openapi.ts +86 -0
- package/frontend/src/features/brain/BrainComposer.tsx +20 -1
- package/frontend/src/features/brain/BrainConversation.tsx +57 -4
- package/frontend/src/features/brain/BrainHome.tsx +41 -1
- package/frontend/src/features/brain/BrainOverviewPanel.tsx +62 -1
- package/frontend/src/features/brain/brainData.ts +54 -1
- package/frontend/src/features/brain/types.ts +37 -0
- package/frontend/src/i18n.ts +54 -0
- package/frontend/src/routes.ts +31 -17
- package/frontend/src/styles.css +216 -0
- package/lattice_brain/__init__.py +1 -1
- package/lattice_brain/graph/ingest.py +41 -6
- package/lattice_brain/ingestion.py +1 -0
- package/lattice_brain/runtime/multi_agent.py +1 -1
- package/latticeai/__init__.py +1 -1
- package/latticeai/api/knowledge_graph.py +11 -0
- package/latticeai/api/memory.py +14 -0
- package/latticeai/app_factory.py +2 -0
- package/latticeai/core/marketplace.py +1 -1
- package/latticeai/core/workspace_os.py +1 -1
- package/latticeai/runtime/chat_wiring.py +2 -0
- package/latticeai/runtime/router_registration.py +3 -0
- package/latticeai/services/memory_service.py +122 -2
- package/latticeai/services/router_context.py +1 -0
- package/latticeai/services/upload_service.py +12 -0
- package/package.json +1 -1
- package/src-tauri/Cargo.lock +1 -1
- package/src-tauri/Cargo.toml +1 -1
- package/src-tauri/tauri.conf.json +1 -1
- package/static/app/asset-manifest.json +84 -6
- package/static/app/assets/Act-DGN37eR4.js +2 -0
- package/static/app/assets/Act-DGN37eR4.js.map +1 -0
- package/static/app/assets/Brain-HDcIwPHW.js +322 -0
- package/static/app/assets/Brain-HDcIwPHW.js.map +1 -0
- package/static/app/assets/Capture--eZfb_Ex.js +2 -0
- package/static/app/assets/Capture--eZfb_Ex.js.map +1 -0
- package/static/app/assets/Library-BbagRFyd.js +2 -0
- package/static/app/assets/Library-BbagRFyd.js.map +1 -0
- package/static/app/assets/System-C6pd3Mp_.js +2 -0
- package/static/app/assets/System-C6pd3Mp_.js.map +1 -0
- package/static/app/assets/index-C950aES_.js +17 -0
- package/static/app/assets/index-C950aES_.js.map +1 -0
- package/static/app/assets/index-ztppMg0c.css +2 -0
- package/static/app/assets/primitives-Bcm5lZRu.js +2 -0
- package/static/app/assets/primitives-Bcm5lZRu.js.map +1 -0
- package/static/app/assets/textarea-C2PLu6_O.js +2 -0
- package/static/app/assets/textarea-C2PLu6_O.js.map +1 -0
- package/static/app/index.html +2 -2
- package/static/app/assets/index-C1J_1441.js +0 -16
- package/static/app/assets/index-C1J_1441.js.map +0 -1
- package/static/app/assets/index-CdCVz_i4.css +0 -2
package/frontend/src/styles.css
CHANGED
|
@@ -964,6 +964,69 @@ body {
|
|
|
964
964
|
overflow: hidden;
|
|
965
965
|
}
|
|
966
966
|
|
|
967
|
+
.brain-shell-page {
|
|
968
|
+
position: relative;
|
|
969
|
+
z-index: 2;
|
|
970
|
+
height: 100vh;
|
|
971
|
+
overflow: auto;
|
|
972
|
+
padding: 0.9rem 1rem 2rem;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
.brain-shell-nav {
|
|
976
|
+
position: sticky;
|
|
977
|
+
top: 0.65rem;
|
|
978
|
+
z-index: 20;
|
|
979
|
+
display: flex;
|
|
980
|
+
flex-wrap: wrap;
|
|
981
|
+
justify-content: center;
|
|
982
|
+
gap: 0.45rem;
|
|
983
|
+
width: min(100%, 72rem);
|
|
984
|
+
margin: 0 auto 1rem;
|
|
985
|
+
border: 1px solid hsl(var(--border) / 0.66);
|
|
986
|
+
border-radius: 8px;
|
|
987
|
+
background: hsl(var(--surface-glass));
|
|
988
|
+
padding: 0.35rem;
|
|
989
|
+
backdrop-filter: blur(18px);
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
.brain-shell-nav button {
|
|
993
|
+
min-height: 2.25rem;
|
|
994
|
+
border: 1px solid transparent;
|
|
995
|
+
border-radius: 6px;
|
|
996
|
+
background: transparent;
|
|
997
|
+
color: hsl(var(--fg-muted));
|
|
998
|
+
padding: 0 0.78rem;
|
|
999
|
+
font-size: 0.78rem;
|
|
1000
|
+
font-weight: 820;
|
|
1001
|
+
letter-spacing: 0;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
.brain-shell-nav button:hover,
|
|
1005
|
+
.brain-shell-nav button:focus-visible,
|
|
1006
|
+
.brain-shell-nav button.is-active {
|
|
1007
|
+
border-color: hsl(var(--brain-core) / 0.58);
|
|
1008
|
+
background: hsl(var(--brain-core) / 0.1);
|
|
1009
|
+
color: hsl(var(--fg));
|
|
1010
|
+
outline: none;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
.brain-shell-content {
|
|
1014
|
+
width: min(100%, 72rem);
|
|
1015
|
+
margin: 0 auto;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
.brain-shell-loader {
|
|
1019
|
+
min-height: 18rem;
|
|
1020
|
+
display: grid;
|
|
1021
|
+
place-items: center;
|
|
1022
|
+
border: 1px solid hsl(var(--border) / 0.58);
|
|
1023
|
+
border-radius: 8px;
|
|
1024
|
+
background: hsl(var(--surface-glass));
|
|
1025
|
+
color: hsl(var(--fg-muted));
|
|
1026
|
+
font-size: 0.82rem;
|
|
1027
|
+
font-weight: 760;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
967
1030
|
/* Subtle living field behind everything */
|
|
968
1031
|
.brain-field {
|
|
969
1032
|
position: fixed;
|
|
@@ -1238,6 +1301,7 @@ body {
|
|
|
1238
1301
|
display: flex;
|
|
1239
1302
|
align-items: center;
|
|
1240
1303
|
justify-content: space-between;
|
|
1304
|
+
flex-wrap: wrap;
|
|
1241
1305
|
gap: 0.75rem;
|
|
1242
1306
|
padding-bottom: 0.65rem;
|
|
1243
1307
|
color: hsl(var(--fg-muted));
|
|
@@ -1265,6 +1329,16 @@ body {
|
|
|
1265
1329
|
white-space: nowrap;
|
|
1266
1330
|
}
|
|
1267
1331
|
|
|
1332
|
+
.brain-flow-actions {
|
|
1333
|
+
display: flex;
|
|
1334
|
+
flex: 0 1 auto;
|
|
1335
|
+
flex-wrap: wrap;
|
|
1336
|
+
justify-content: flex-end;
|
|
1337
|
+
gap: 0.35rem;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
.brain-flow-actions button,
|
|
1341
|
+
.brain-model-pill,
|
|
1268
1342
|
.brain-admin-link {
|
|
1269
1343
|
display: inline-flex;
|
|
1270
1344
|
min-height: 2rem;
|
|
@@ -1282,6 +1356,15 @@ body {
|
|
|
1282
1356
|
transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
|
|
1283
1357
|
}
|
|
1284
1358
|
|
|
1359
|
+
.brain-model-pill {
|
|
1360
|
+
max-width: 13rem;
|
|
1361
|
+
overflow: hidden;
|
|
1362
|
+
text-overflow: ellipsis;
|
|
1363
|
+
white-space: nowrap;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
.brain-flow-actions button:hover,
|
|
1367
|
+
.brain-flow-actions button:focus-visible,
|
|
1285
1368
|
.brain-admin-link:hover,
|
|
1286
1369
|
.brain-admin-link:focus-visible {
|
|
1287
1370
|
border-color: hsl(var(--brain-core) / 0.72);
|
|
@@ -1475,6 +1558,91 @@ body {
|
|
|
1475
1558
|
transition: width 260ms ease;
|
|
1476
1559
|
}
|
|
1477
1560
|
|
|
1561
|
+
.brain-proof-strip {
|
|
1562
|
+
display: grid;
|
|
1563
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
1564
|
+
gap: 0.58rem;
|
|
1565
|
+
margin-top: 0.62rem;
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
.brain-proof-point {
|
|
1569
|
+
display: grid;
|
|
1570
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
1571
|
+
align-items: center;
|
|
1572
|
+
gap: 0.12rem 0.44rem;
|
|
1573
|
+
min-height: 4.1rem;
|
|
1574
|
+
border: 1px solid hsl(var(--border) / 0.5);
|
|
1575
|
+
border-radius: 8px;
|
|
1576
|
+
background: hsl(var(--surface) / 0.56);
|
|
1577
|
+
padding: 0.58rem;
|
|
1578
|
+
color: hsl(var(--fg));
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
.brain-proof-point svg {
|
|
1582
|
+
grid-row: span 2;
|
|
1583
|
+
color: hsl(var(--knowledge));
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
.brain-proof-point span {
|
|
1587
|
+
overflow: hidden;
|
|
1588
|
+
color: hsl(var(--fg-muted));
|
|
1589
|
+
font-size: 0.62rem;
|
|
1590
|
+
font-weight: 820;
|
|
1591
|
+
text-overflow: ellipsis;
|
|
1592
|
+
text-transform: uppercase;
|
|
1593
|
+
white-space: nowrap;
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
.brain-proof-point strong {
|
|
1597
|
+
overflow: hidden;
|
|
1598
|
+
font-size: 0.75rem;
|
|
1599
|
+
line-height: 1.2;
|
|
1600
|
+
text-overflow: ellipsis;
|
|
1601
|
+
white-space: nowrap;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
.brain-recall-proof {
|
|
1605
|
+
display: grid;
|
|
1606
|
+
width: 100%;
|
|
1607
|
+
gap: 0.2rem;
|
|
1608
|
+
margin-top: 0.62rem;
|
|
1609
|
+
border: 1px solid hsl(var(--memory) / 0.34);
|
|
1610
|
+
border-radius: 8px;
|
|
1611
|
+
background: hsl(var(--memory) / 0.07);
|
|
1612
|
+
color: hsl(var(--fg));
|
|
1613
|
+
padding: 0.68rem;
|
|
1614
|
+
text-align: left;
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
.brain-recall-proof.is-empty {
|
|
1618
|
+
border-color: hsl(var(--border) / 0.5);
|
|
1619
|
+
background: hsl(var(--surface) / 0.5);
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
.brain-recall-proof span {
|
|
1623
|
+
color: hsl(var(--fg-muted));
|
|
1624
|
+
font-size: 0.64rem;
|
|
1625
|
+
font-weight: 820;
|
|
1626
|
+
text-transform: uppercase;
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
.brain-recall-proof strong,
|
|
1630
|
+
.brain-recall-proof small {
|
|
1631
|
+
display: block;
|
|
1632
|
+
overflow: hidden;
|
|
1633
|
+
text-overflow: ellipsis;
|
|
1634
|
+
white-space: nowrap;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
.brain-recall-proof strong {
|
|
1638
|
+
font-size: 0.86rem;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
.brain-recall-proof small {
|
|
1642
|
+
color: hsl(var(--fg-muted));
|
|
1643
|
+
font-size: 0.76rem;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1478
1646
|
.brain-save-feedback {
|
|
1479
1647
|
display: grid;
|
|
1480
1648
|
grid-template-columns: auto minmax(0, 1fr);
|
|
@@ -2766,6 +2934,7 @@ body {
|
|
|
2766
2934
|
font-size: 0.88rem;
|
|
2767
2935
|
}
|
|
2768
2936
|
|
|
2937
|
+
.brain-document-input,
|
|
2769
2938
|
.brain-image-input {
|
|
2770
2939
|
display: inline-flex;
|
|
2771
2940
|
cursor: pointer;
|
|
@@ -2778,6 +2947,19 @@ body {
|
|
|
2778
2947
|
font-size: 0.78rem;
|
|
2779
2948
|
}
|
|
2780
2949
|
|
|
2950
|
+
.brain-document-input {
|
|
2951
|
+
border-color: hsl(var(--memory) / 0.42);
|
|
2952
|
+
background: hsl(var(--memory) / 0.08);
|
|
2953
|
+
color: hsl(var(--fg));
|
|
2954
|
+
font-weight: 760;
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2957
|
+
.brain-document-input.is-disabled,
|
|
2958
|
+
.mind-empty-upload.is-disabled {
|
|
2959
|
+
cursor: wait;
|
|
2960
|
+
opacity: 0.68;
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2781
2963
|
.mind-empty-kicker {
|
|
2782
2964
|
margin-bottom: 0.4rem;
|
|
2783
2965
|
font-size: 0.72rem;
|
|
@@ -2864,6 +3046,37 @@ body {
|
|
|
2864
3046
|
line-height: 1.45;
|
|
2865
3047
|
}
|
|
2866
3048
|
|
|
3049
|
+
.mind-empty-upload {
|
|
3050
|
+
display: inline-flex;
|
|
3051
|
+
cursor: pointer;
|
|
3052
|
+
align-items: center;
|
|
3053
|
+
justify-content: center;
|
|
3054
|
+
gap: 0.42rem;
|
|
3055
|
+
margin-top: 1rem;
|
|
3056
|
+
border: 1px solid hsl(var(--memory) / 0.46);
|
|
3057
|
+
border-radius: 999px;
|
|
3058
|
+
background: hsl(var(--memory) / 0.1);
|
|
3059
|
+
color: hsl(var(--fg));
|
|
3060
|
+
padding: 0.55rem 0.9rem;
|
|
3061
|
+
font-size: 0.82rem;
|
|
3062
|
+
font-weight: 820;
|
|
3063
|
+
transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
.mind-empty-upload:hover,
|
|
3067
|
+
.mind-empty-upload:focus-within {
|
|
3068
|
+
border-color: hsl(var(--memory) / 0.72);
|
|
3069
|
+
background: hsl(var(--memory) / 0.16);
|
|
3070
|
+
transform: translateY(-1px);
|
|
3071
|
+
}
|
|
3072
|
+
|
|
3073
|
+
.mind-empty-upload-hint {
|
|
3074
|
+
display: block;
|
|
3075
|
+
margin-top: 0.42rem;
|
|
3076
|
+
color: hsl(var(--fg-muted));
|
|
3077
|
+
font-size: 0.72rem;
|
|
3078
|
+
}
|
|
3079
|
+
|
|
2867
3080
|
.mind-empty-prompts {
|
|
2868
3081
|
display: flex;
|
|
2869
3082
|
flex-wrap: wrap;
|
|
@@ -2964,6 +3177,9 @@ body {
|
|
|
2964
3177
|
.brain-overview-grid {
|
|
2965
3178
|
grid-template-columns: 1fr;
|
|
2966
3179
|
}
|
|
3180
|
+
.brain-proof-strip {
|
|
3181
|
+
grid-template-columns: 1fr;
|
|
3182
|
+
}
|
|
2967
3183
|
.brain-overview-head {
|
|
2968
3184
|
align-items: flex-start;
|
|
2969
3185
|
flex-direction: column;
|
|
@@ -15,6 +15,7 @@ class KnowledgeGraphIngestMixin:
|
|
|
15
15
|
user_nickname: Optional[str] = None,
|
|
16
16
|
source: Optional[str] = None,
|
|
17
17
|
conversation_id: Optional[str] = None,
|
|
18
|
+
workspace_id: Optional[str] = None,
|
|
18
19
|
raw: Optional[Dict[str, Any]] = None,
|
|
19
20
|
) -> Dict[str, Any]:
|
|
20
21
|
content = str(content or "")
|
|
@@ -28,6 +29,7 @@ class KnowledgeGraphIngestMixin:
|
|
|
28
29
|
"role": role,
|
|
29
30
|
"source": source,
|
|
30
31
|
"conversation_id": conversation_id,
|
|
32
|
+
"workspace_id": workspace_id,
|
|
31
33
|
"user_email": user_email,
|
|
32
34
|
"user_nickname": user_nickname,
|
|
33
35
|
"chars": len(content),
|
|
@@ -47,7 +49,9 @@ class KnowledgeGraphIngestMixin:
|
|
|
47
49
|
"Chat",
|
|
48
50
|
chat_title,
|
|
49
51
|
summary=_clean_text(content)[:400],
|
|
50
|
-
metadata={"source": source, "conversation_id": conversation_id},
|
|
52
|
+
metadata={"source": source, "conversation_id": conversation_id, "workspace_id": workspace_id},
|
|
53
|
+
owner=user_email,
|
|
54
|
+
workspace_id=workspace_id,
|
|
51
55
|
)
|
|
52
56
|
|
|
53
57
|
# ── 2. Person node (점: 명사 — 사람) ─────────────────────────────
|
|
@@ -61,6 +65,8 @@ class KnowledgeGraphIngestMixin:
|
|
|
61
65
|
"Person",
|
|
62
66
|
user_nickname or user_email or "Unknown",
|
|
63
67
|
metadata={"email": user_email, "nickname": user_nickname},
|
|
68
|
+
owner=user_email,
|
|
69
|
+
workspace_id=workspace_id,
|
|
64
70
|
)
|
|
65
71
|
# 선: 동사 — Person이 Chat을 "작성함"
|
|
66
72
|
self._upsert_edge(
|
|
@@ -81,6 +87,8 @@ class KnowledgeGraphIngestMixin:
|
|
|
81
87
|
summary=_clean_text(content)[:500],
|
|
82
88
|
metadata=metadata,
|
|
83
89
|
raw=raw or metadata,
|
|
90
|
+
owner=user_email,
|
|
91
|
+
workspace_id=workspace_id,
|
|
84
92
|
)
|
|
85
93
|
# 선: Chat이 메시지를 "포함함"
|
|
86
94
|
self._upsert_edge(
|
|
@@ -97,6 +105,8 @@ class KnowledgeGraphIngestMixin:
|
|
|
97
105
|
f"chunk {index + 1}",
|
|
98
106
|
summary=chunk[:500],
|
|
99
107
|
metadata={"index": index, "source_node": node_id},
|
|
108
|
+
owner=user_email,
|
|
109
|
+
workspace_id=workspace_id,
|
|
100
110
|
)
|
|
101
111
|
self._upsert_chunk(
|
|
102
112
|
conn,
|
|
@@ -118,7 +128,9 @@ class KnowledgeGraphIngestMixin:
|
|
|
118
128
|
cid,
|
|
119
129
|
node_t,
|
|
120
130
|
concept,
|
|
121
|
-
metadata={"auto_extracted": True, "source": source},
|
|
131
|
+
metadata={"auto_extracted": True, "source": source, "workspace_id": workspace_id},
|
|
132
|
+
owner=user_email,
|
|
133
|
+
workspace_id=workspace_id,
|
|
122
134
|
)
|
|
123
135
|
# 선: Chat이 개념을 "언급함"
|
|
124
136
|
self._upsert_edge(
|
|
@@ -155,8 +167,10 @@ class KnowledgeGraphIngestMixin:
|
|
|
155
167
|
sem_type,
|
|
156
168
|
sem_title,
|
|
157
169
|
summary=item["summary"],
|
|
158
|
-
metadata={"auto_extracted": True, "source_node": node_id},
|
|
170
|
+
metadata={"auto_extracted": True, "source_node": node_id, "workspace_id": workspace_id},
|
|
159
171
|
raw=item,
|
|
172
|
+
owner=user_email,
|
|
173
|
+
workspace_id=workspace_id,
|
|
160
174
|
)
|
|
161
175
|
# 선: Chat이 Task/Decision을 "생성함"
|
|
162
176
|
self._upsert_edge(conn, conv_id, sem_id, "생성함", weight=0.9)
|
|
@@ -236,6 +250,8 @@ class KnowledgeGraphIngestMixin:
|
|
|
236
250
|
summary=(text or filename)[:500],
|
|
237
251
|
metadata=metadata,
|
|
238
252
|
raw=metadata,
|
|
253
|
+
owner=owner or uploader,
|
|
254
|
+
workspace_id=workspace_id,
|
|
239
255
|
)
|
|
240
256
|
self._ingest_structure_nodes(conn, file_id, filename, doc_meta)
|
|
241
257
|
|
|
@@ -265,6 +281,8 @@ class KnowledgeGraphIngestMixin:
|
|
|
265
281
|
"Person",
|
|
266
282
|
uploader,
|
|
267
283
|
metadata={"email": uploader},
|
|
284
|
+
owner=uploader,
|
|
285
|
+
workspace_id=workspace_id,
|
|
268
286
|
)
|
|
269
287
|
# 선: 동사 — Person이 Document를 "업로드함"
|
|
270
288
|
self._upsert_edge(conn, person_id, file_id, "업로드함", weight=1.0)
|
|
@@ -272,7 +290,15 @@ class KnowledgeGraphIngestMixin:
|
|
|
272
290
|
# ── Chat 노드와 연결 ──────────────────────────────────────────────
|
|
273
291
|
if conversation_id:
|
|
274
292
|
conv_id = f"conversation:{_slug(conversation_id)}"
|
|
275
|
-
self._upsert_node(
|
|
293
|
+
self._upsert_node(
|
|
294
|
+
conn,
|
|
295
|
+
conv_id,
|
|
296
|
+
"Chat",
|
|
297
|
+
conversation_id,
|
|
298
|
+
metadata={"conversation_id": conversation_id, "workspace_id": workspace_id},
|
|
299
|
+
owner=owner or uploader,
|
|
300
|
+
workspace_id=workspace_id,
|
|
301
|
+
)
|
|
276
302
|
# 선: 동사 — Chat이 Document를 "언급함"
|
|
277
303
|
self._upsert_edge(conn, conv_id, file_id, "언급함", weight=0.8)
|
|
278
304
|
|
|
@@ -286,7 +312,9 @@ class KnowledgeGraphIngestMixin:
|
|
|
286
312
|
"Chunk",
|
|
287
313
|
f"{filename} chunk {index + 1}",
|
|
288
314
|
summary=chunk[:500],
|
|
289
|
-
metadata={"index": index, "source_node": file_id},
|
|
315
|
+
metadata={"index": index, "source_node": file_id, "workspace_id": workspace_id},
|
|
316
|
+
owner=owner or uploader,
|
|
317
|
+
workspace_id=workspace_id,
|
|
290
318
|
)
|
|
291
319
|
self._upsert_chunk(
|
|
292
320
|
conn,
|
|
@@ -308,7 +336,9 @@ class KnowledgeGraphIngestMixin:
|
|
|
308
336
|
cid,
|
|
309
337
|
node_t,
|
|
310
338
|
concept,
|
|
311
|
-
metadata={"auto_extracted": True, "source_file": filename},
|
|
339
|
+
metadata={"auto_extracted": True, "source_file": filename, "workspace_id": workspace_id},
|
|
340
|
+
owner=owner or uploader,
|
|
341
|
+
workspace_id=workspace_id,
|
|
312
342
|
)
|
|
313
343
|
# 선: 동사 — Document가 Concept을 "포함함"
|
|
314
344
|
self._upsert_edge(conn, file_id, cid, "포함함", weight=0.8)
|
|
@@ -342,8 +372,11 @@ class KnowledgeGraphIngestMixin:
|
|
|
342
372
|
"auto_extracted": True,
|
|
343
373
|
"source_node": file_id,
|
|
344
374
|
"filename": filename,
|
|
375
|
+
"workspace_id": workspace_id,
|
|
345
376
|
},
|
|
346
377
|
raw=item,
|
|
378
|
+
owner=owner or uploader,
|
|
379
|
+
workspace_id=workspace_id,
|
|
347
380
|
)
|
|
348
381
|
# 선: Document가 Task/Decision을 "포함함"
|
|
349
382
|
self._upsert_edge(conn, file_id, sem_id, "포함함", weight=0.9)
|
|
@@ -474,6 +507,8 @@ class KnowledgeGraphIngestMixin:
|
|
|
474
507
|
label,
|
|
475
508
|
summary=str(source_uri or title or source_type)[:400],
|
|
476
509
|
metadata=meta,
|
|
510
|
+
owner=meta.get("owner"),
|
|
511
|
+
workspace_id=meta.get("workspace_id"),
|
|
477
512
|
)
|
|
478
513
|
# 선: 콘텐츠 노드가 "이 출처에서 색인됨" (indexed_from → SOURCE)
|
|
479
514
|
self._upsert_edge(
|
|
@@ -267,6 +267,7 @@ class IngestionPipeline:
|
|
|
267
267
|
user_nickname=meta.get("user_nickname"),
|
|
268
268
|
source=meta.get("source") or source_type,
|
|
269
269
|
conversation_id=item.conversation_id,
|
|
270
|
+
workspace_id=item.workspace_id,
|
|
270
271
|
raw=meta.get("raw"),
|
|
271
272
|
)
|
|
272
273
|
# ingest_message reports message/response node ids; normalize the keys
|
|
@@ -19,7 +19,7 @@ from datetime import datetime
|
|
|
19
19
|
from typing import Any, Callable, Dict, List, Optional
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
MULTI_AGENT_VERSION = "6.
|
|
22
|
+
MULTI_AGENT_VERSION = "6.7.0"
|
|
23
23
|
|
|
24
24
|
AGENT_ROLES = ("researcher", "planner", "executor", "reviewer", "release")
|
|
25
25
|
CORE_PIPELINE = ("planner", "executor", "reviewer")
|
package/latticeai/__init__.py
CHANGED
|
@@ -27,6 +27,14 @@ class KnowledgeGraphIngestRequest(BaseModel):
|
|
|
27
27
|
metadata: Optional[Dict[str, Any]] = None
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
def _workspace_scope_from_request(request: Request) -> Optional[str]:
|
|
31
|
+
header = request.headers.get("X-Workspace-Id")
|
|
32
|
+
if header and header.strip():
|
|
33
|
+
return header.strip()
|
|
34
|
+
query = request.query_params.get("workspace_id")
|
|
35
|
+
return query.strip() if query and query.strip() else None
|
|
36
|
+
|
|
37
|
+
|
|
30
38
|
def _format_context(matches: list, limit: int) -> str:
|
|
31
39
|
"""Mirror ``KnowledgeGraphRetrievalMixin.context_for_query`` formatting for a
|
|
32
40
|
pre-filtered match list, so scoped callers get identical context lines minus
|
|
@@ -178,6 +186,7 @@ def create_knowledge_graph_router(
|
|
|
178
186
|
async def knowledge_graph_ingest(req: KnowledgeGraphIngestRequest, request: Request):
|
|
179
187
|
current_user = require_user(request)
|
|
180
188
|
kg = graph()
|
|
189
|
+
workspace_id = _workspace_scope_from_request(request)
|
|
181
190
|
event_type = (req.type or "").strip().lower()
|
|
182
191
|
if event_type not in {"message", "ai_response", "note"}:
|
|
183
192
|
raise HTTPException(status_code=400, detail="지원하는 type: message, ai_response, note")
|
|
@@ -189,10 +198,12 @@ def create_knowledge_graph_router(
|
|
|
189
198
|
user_nickname=req.user_nickname,
|
|
190
199
|
source=req.source or "mcp",
|
|
191
200
|
conversation_id=req.conversation_id,
|
|
201
|
+
workspace_id=workspace_id,
|
|
192
202
|
raw={
|
|
193
203
|
"type": req.type,
|
|
194
204
|
"title": req.title,
|
|
195
205
|
"content": req.content,
|
|
206
|
+
"workspace_id": workspace_id,
|
|
196
207
|
"metadata": req.metadata or {},
|
|
197
208
|
},
|
|
198
209
|
)
|
package/latticeai/api/memory.py
CHANGED
|
@@ -42,6 +42,7 @@ def create_memory_router(
|
|
|
42
42
|
gate_read: Callable[[Request], Optional[str]],
|
|
43
43
|
gate_write: Callable[[Request], Optional[str]],
|
|
44
44
|
append_audit_event: Callable[..., None],
|
|
45
|
+
active_model_getter: Callable[[], str] | None = None,
|
|
45
46
|
) -> APIRouter:
|
|
46
47
|
router = APIRouter()
|
|
47
48
|
|
|
@@ -57,6 +58,19 @@ def create_memory_router(
|
|
|
57
58
|
scope = gate_read(request)
|
|
58
59
|
return service.brain_quality_summary(user_email=user, workspace_id=scope)
|
|
59
60
|
|
|
61
|
+
@router.get("/api/memory/brain-proof")
|
|
62
|
+
async def brain_proof(request: Request, q: str = "", limit: int = 3):
|
|
63
|
+
user = require_user(request)
|
|
64
|
+
scope = gate_read(request)
|
|
65
|
+
active_model = active_model_getter() if active_model_getter else ""
|
|
66
|
+
return service.brain_proof(
|
|
67
|
+
user_email=user,
|
|
68
|
+
workspace_id=scope,
|
|
69
|
+
active_model=active_model,
|
|
70
|
+
recall_query=q,
|
|
71
|
+
limit=limit,
|
|
72
|
+
)
|
|
73
|
+
|
|
60
74
|
@router.get("/api/memory/tiers")
|
|
61
75
|
async def memory_tiers(request: Request):
|
|
62
76
|
require_user(request)
|
package/latticeai/app_factory.py
CHANGED
|
@@ -736,6 +736,7 @@ def _build(config: "Optional[Config]" = None) -> Dict[str, Any]:
|
|
|
736
736
|
source_type="chat_message",
|
|
737
737
|
text=message,
|
|
738
738
|
owner=user_email,
|
|
739
|
+
workspace_id=workspace_id,
|
|
739
740
|
conversation_id=conversation_id,
|
|
740
741
|
metadata={
|
|
741
742
|
"role": role,
|
|
@@ -1447,6 +1448,7 @@ def _build(config: "Optional[Config]" = None) -> Dict[str, Any]:
|
|
|
1447
1448
|
agent_registry=AGENT_REGISTRY,
|
|
1448
1449
|
memory_service=MEMORY_SERVICE,
|
|
1449
1450
|
platform=PLATFORM,
|
|
1451
|
+
active_model_getter=lambda: router.current_model_id or "",
|
|
1450
1452
|
)
|
|
1451
1453
|
register_interaction_routers(
|
|
1452
1454
|
app,
|
|
@@ -19,7 +19,7 @@ from pathlib import Path
|
|
|
19
19
|
from typing import Any, Callable, Dict, Iterable, List, Optional
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
WORKSPACE_OS_VERSION = "6.
|
|
22
|
+
WORKSPACE_OS_VERSION = "6.7.0"
|
|
23
23
|
|
|
24
24
|
# Workspace types separate single-user Personal workspaces from shared
|
|
25
25
|
# Organization workspaces. Both keep the same local-first JSON store; the type
|
|
@@ -63,6 +63,7 @@ def build_interaction_contexts(
|
|
|
63
63
|
agent_registry: Any,
|
|
64
64
|
memory_service: Any,
|
|
65
65
|
platform: Any,
|
|
66
|
+
active_model_getter: Any = None,
|
|
66
67
|
) -> tuple[ToolRouterContext, InteractionRouterContext]:
|
|
67
68
|
tool_router_context = ToolRouterContext(
|
|
68
69
|
config=config,
|
|
@@ -101,6 +102,7 @@ def build_interaction_contexts(
|
|
|
101
102
|
agent_registry=agent_registry,
|
|
102
103
|
memory_service=memory_service,
|
|
103
104
|
platform=platform,
|
|
105
|
+
active_model_getter=active_model_getter,
|
|
104
106
|
)
|
|
105
107
|
return tool_router_context, interaction_router_context
|
|
106
108
|
|
|
@@ -451,6 +451,7 @@ def register_interaction_routers(
|
|
|
451
451
|
create_memory_router: Any,
|
|
452
452
|
memory_service: Any = None,
|
|
453
453
|
platform: Any = None,
|
|
454
|
+
active_model_getter: Any = None,
|
|
454
455
|
) -> tuple[Any, ...]:
|
|
455
456
|
"""Register chat/search/tools/hooks/registry/memory routes in order."""
|
|
456
457
|
|
|
@@ -468,6 +469,7 @@ def register_interaction_routers(
|
|
|
468
469
|
agent_registry = interaction_context.agent_registry
|
|
469
470
|
memory_service = interaction_context.memory_service
|
|
470
471
|
platform = interaction_context.platform
|
|
472
|
+
active_model_getter = interaction_context.active_model_getter
|
|
471
473
|
|
|
472
474
|
return register_routers(
|
|
473
475
|
app,
|
|
@@ -521,6 +523,7 @@ def register_interaction_routers(
|
|
|
521
523
|
gate_read=platform.gate_read,
|
|
522
524
|
gate_write=platform.gate_write,
|
|
523
525
|
append_audit_event=append_audit_event,
|
|
526
|
+
active_model_getter=active_model_getter,
|
|
524
527
|
),
|
|
525
528
|
)
|
|
526
529
|
|