ltcai 0.3.0 → 0.3.1
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 +24 -0
- package/docs/CHANGELOG.md +82 -0
- package/knowledge_graph_api.py +10 -2
- package/latticeai/api/security_dashboard.py +580 -0
- package/latticeai/core/graph_curator.py +417 -0
- package/latticeai/core/model_compat.py +407 -0
- package/latticeai/core/model_resolution.py +227 -0
- package/package.json +1 -1
- package/server.py +254 -16
- package/static/account.html +2 -2
- package/static/admin.html +75 -1
- package/static/chat.html +2 -2
- package/static/graph.html +2 -2
- package/static/lattice-reference.css +82 -50
- package/static/scripts/account.js +10 -2
- package/static/scripts/admin.js +296 -0
- package/static/scripts/chat.js +82 -9
- package/static/scripts/graph.js +6 -2
- package/static/sw.js +1 -1
package/README.md
CHANGED
|
@@ -21,6 +21,30 @@
|
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
24
|
+
## What's new in 0.3.1
|
|
25
|
+
|
|
26
|
+
- **Reliable model selection** — `ModelResolution` unifies recommended card ID,
|
|
27
|
+
download ID, load ID, router cache key, and the front-end `current` so
|
|
28
|
+
"downloaded but not loaded" / "loaded but UI shows a different model"
|
|
29
|
+
classes of bugs are gone.
|
|
30
|
+
- **Smoke test on load** — every local model load runs a one-shot Korean
|
|
31
|
+
chat probe and surfaces `ready_to_chat` / `compatibility_status` to the UI.
|
|
32
|
+
- **Model Compatibility Layer** — per-family profiles (GPT-OSS, Gemma, Qwen,
|
|
33
|
+
Llama, Mistral, Phi, Deepseek …) with cached stop tokens, postprocess
|
|
34
|
+
rules, and Fast / Slow / Recovery paths so chat speed stays the same.
|
|
35
|
+
- **Auto graph curator** — topic extraction → alias clustering → promotion
|
|
36
|
+
with secret/PII firewall, so the graph builds itself without the user
|
|
37
|
+
managing nodes.
|
|
38
|
+
- **AI Security & Audit Command Center** — admin dashboard now shows
|
|
39
|
+
per-user risk matrix (compliant chats vs risky chats vs compliant files
|
|
40
|
+
vs risky files), sensitive-type donut, drill-down, raw explorer, and
|
|
41
|
+
JSON / CSV / XLSX / PDF exports — with hard-secret redaction
|
|
42
|
+
enforced on every response.
|
|
43
|
+
|
|
44
|
+
See [docs/CHANGELOG.md](./docs/CHANGELOG.md) for the full list.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
24
48
|
## Why Lattice AI?
|
|
25
49
|
|
|
26
50
|
Most AI tools forget everything after each conversation. Your files sit in folders, your chats vanish, and nothing connects.
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,87 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.1] - 2026-05-29
|
|
4
|
+
|
|
5
|
+
> Model loading reliability + auto-graph curation + AI Security & Audit Command Center.
|
|
6
|
+
>
|
|
7
|
+
> 외부 리뷰 5건(모델 추천/다운로드, 사용자 직접 모델 선택, 모델 호환성 계층,
|
|
8
|
+
> 자동 그래프 방향, 관리자 보안/감사 대시보드) 피드백을 모두 반영했다.
|
|
9
|
+
|
|
10
|
+
### Model loading & inference
|
|
11
|
+
|
|
12
|
+
- 새 모듈 `latticeai/core/model_resolution.py` — `ModelResolution`이
|
|
13
|
+
`input_id / engine / resolved_model / download_id / load_id / expected_current`을
|
|
14
|
+
하나로 묶어 추천 카드, 다운로드, 로드, router cache, 프론트 current 표시가
|
|
15
|
+
단계마다 어긋나는 문제를 제거.
|
|
16
|
+
- `prepare_and_load_model()` 와 `/engines/prepare-model/stream`이 동일한
|
|
17
|
+
`ModelResolution`을 공유하도록 통합. LM Studio처럼 `instance_id`가 부여되는
|
|
18
|
+
엔진은 `resolution.update_after_load()`로 후처리.
|
|
19
|
+
- 로드 직후 `_smoke_test_loaded_model()`가 한국어 짧은 채팅 테스트를 실행 →
|
|
20
|
+
응답에 `ready_to_chat`, `compatibility_status`, `smoke_test` 필드 추가.
|
|
21
|
+
Cloud 모델은 사용자 비용 발생을 피하기 위해 자동 skip.
|
|
22
|
+
- `/models` 응답에 `engine_options`(local_mlx / ollama / lmstudio / llamacpp /
|
|
23
|
+
vllm 별 실제 model_id)와 `compat_profiles` 추가.
|
|
24
|
+
- 새 엔드포인트 `GET /models/compat-profiles`.
|
|
25
|
+
|
|
26
|
+
### Model compatibility layer
|
|
27
|
+
|
|
28
|
+
- 새 모듈 `latticeai/core/model_compat.py` — Family detection
|
|
29
|
+
(gpt-oss / gemma / qwen / llama / mistral / phi / deepseek …),
|
|
30
|
+
family 프로파일(stop tokens, disable_draft, postprocess, generation params),
|
|
31
|
+
`fast_postprocess`, `validate_smoke_response`, `record_smoke_result`,
|
|
32
|
+
`compat_cache`. 무거운 검사는 모델 로드 시 1회(Slow Path), 채팅 중에는
|
|
33
|
+
캐시된 profile만 사용하는 Fast Path. 답변이 깨졌을 때만 1회 retry하는
|
|
34
|
+
Recovery Path 구조.
|
|
35
|
+
|
|
36
|
+
### Auto knowledge graph curation
|
|
37
|
+
|
|
38
|
+
- 새 모듈 `latticeai/core/graph_curator.py` — 대화/파일/작업 로그에서
|
|
39
|
+
Topic candidate 추출 → alias clustering(자동 병합) → promotion 결정
|
|
40
|
+
(secret 차단, 중복 차단, 출처 최소치) → 파생 이야기 엣지 → 행동 시그널
|
|
41
|
+
기반 큐레이션. Secret/API key/private key는 그래프 후보에서 자동 제거.
|
|
42
|
+
|
|
43
|
+
### Frontend — user-trusted current model
|
|
44
|
+
|
|
45
|
+
- `static/scripts/chat.js`의 `prepareAndLoadModel` 결과에서 백엔드
|
|
46
|
+
`response.current`를 신뢰하고, `ready_to_chat=false` 또는
|
|
47
|
+
`compatibility_status=degraded`일 때 사용자에게 호환성 경고 표시.
|
|
48
|
+
- 모델 카드를 직접 클릭할 때도 같은 표준 흐름을 타는
|
|
49
|
+
`window.selectModelByCard()` 헬퍼 추가.
|
|
50
|
+
|
|
51
|
+
### Admin — AI Security & Audit Command Center
|
|
52
|
+
|
|
53
|
+
- 새 라우터 `latticeai/api/security_dashboard.py`가 11개 엔드포인트 추가:
|
|
54
|
+
`/admin/security/{overview,users,events,events/{id},conversations/{id},`
|
|
55
|
+
`conversations/{id}/raw,files,files/{id},files/{id}/content,raw,export}`.
|
|
56
|
+
- 모든 응답에서 hard secret(`sk-…`, `ghp_…`, `xoxb-…`, `AKIA…`,
|
|
57
|
+
private key block 등)을 자동 redact. 원문/raw 조회는 별도
|
|
58
|
+
`admin_view_sensitive_raw` 감사 이벤트로 기록.
|
|
59
|
+
- 관리자 UI: Security Overview 카드(오늘 이벤트, High Risk, 위험 채팅/파일,
|
|
60
|
+
Secret/외부 전송 차단, 관리자 원문 조회 수, 검토 필요), User Risk Matrix
|
|
61
|
+
(stacked bar), 민감정보 유형 donut chart, 민감 채팅/위험 파일 모니터,
|
|
62
|
+
감사 타임라인, Raw Data Explorer.
|
|
63
|
+
- 사용자별 막대 클릭 → drill-down. JSON / CSV / XLSX / PDF / TXT
|
|
64
|
+
추출 지원.
|
|
65
|
+
|
|
66
|
+
### Tests / CI
|
|
67
|
+
|
|
68
|
+
- 새 단위 테스트 28개 — `tests/unit/test_model_compat.py`,
|
|
69
|
+
`tests/unit/test_model_resolution.py`, `tests/unit/test_graph_curator.py`,
|
|
70
|
+
`tests/unit/test_security_dashboard.py`.
|
|
71
|
+
- `.github/workflows/ci.yml` syntax-check 단계에 4개 새 모듈 추가.
|
|
72
|
+
- 새 `.github/workflows/release.yml` — tag `v*` 푸시 시 PyPI / npm /
|
|
73
|
+
VS Code Marketplace / Open VSX 자동 배포(필요 secrets: `PYPI_TOKEN`,
|
|
74
|
+
`NPM_TOKEN`, `VSCE_PAT`, `OVSX_TOKEN`). 해당 secret이 비어 있는 job은
|
|
75
|
+
자동 skip.
|
|
76
|
+
|
|
77
|
+
### Fixed
|
|
78
|
+
|
|
79
|
+
- FastAPI에서 `Request` 인자에 `= None` 디폴트 사용 시 발생하던 잠재 문제 수정
|
|
80
|
+
(`security_dashboard.py` `/admin/security/raw`).
|
|
81
|
+
- `gpt-oss` family postprocess 순서를
|
|
82
|
+
`trim_after_user_marker → strip_role_tokens`로 보정 — `<|user|>` 마커가
|
|
83
|
+
먼저 제거돼 trim이 동작하지 않던 버그.
|
|
84
|
+
|
|
3
85
|
## [0.3.0] - 2026-05-27
|
|
4
86
|
|
|
5
87
|
### Knowledge Graph — LLM Structured Output Extraction
|
package/knowledge_graph_api.py
CHANGED
|
@@ -38,14 +38,22 @@ def create_knowledge_graph_router(
|
|
|
38
38
|
"""Serve the interactive knowledge graph canvas UI."""
|
|
39
39
|
graph()
|
|
40
40
|
require_user(request)
|
|
41
|
-
|
|
41
|
+
response = FileResponse(static_dir / "graph.html")
|
|
42
|
+
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
|
|
43
|
+
response.headers["Pragma"] = "no-cache"
|
|
44
|
+
response.headers["Expires"] = "0"
|
|
45
|
+
return response
|
|
42
46
|
|
|
43
47
|
@router.get("/knowledge-graph")
|
|
44
48
|
async def knowledge_graph_legacy_page(request: Request):
|
|
45
49
|
"""Backward-compatible route for the graph page."""
|
|
46
50
|
graph()
|
|
47
51
|
require_user(request)
|
|
48
|
-
|
|
52
|
+
response = FileResponse(static_dir / "graph.html")
|
|
53
|
+
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
|
|
54
|
+
response.headers["Pragma"] = "no-cache"
|
|
55
|
+
response.headers["Expires"] = "0"
|
|
56
|
+
return response
|
|
49
57
|
|
|
50
58
|
@router.get("/knowledge-graph/stats")
|
|
51
59
|
async def knowledge_graph_stats(request: Request):
|