Aska
cc040b861d
feat(ai-core): trigger memory extraction after each conversation round
...
The WS hub and platform bridge now call Pipeline.FinishRound when the
response stream completes, recording the assistant reply and invoking
the LLM memory extractor asynchronously.
2026-08-20 19:40:58 +08:00
Aska
7c02d31194
feat(ai-core): wire function calling into the LLM pipeline
...
- llm: ChatStreamWithTools sends OpenAI-format tools; streamed tool_call
deltas are reassembled by index into complete ToolCalls on the Done token
- model: LLMMessage gains ToolCallID/ToolCalls; StreamToken gains ToolCalls
- orchestrator: new ToolExecutor interface and streamWithTools loop —
execute requested tools, feed results back, up to 3 rounds, final round
forces a plain text answer; normal chats still stream token by token.
Also adds Pipeline.FinishRound (assistant reply recording + post-round
hook), wired to transports in the next commit.
- main: inject the plugin registry via toolExecAdapter
Includes an httptest-based test covering delta reassembly, tool
execution, and result feedback.
2026-08-20 19:40:58 +08:00
Aska
9a3c77dbd3
fix(bridge): align admin panel field keys with backend adapter settings
...
Frontend sent remote_url/bot_token/webhook_url while the backend reads
ws_url/token/listen_addr, so QQ adapters could never connect. Also add
the missing bot_qq field and wire the webhook adapter's APIKey.
2026-08-20 19:40:32 +08:00
Aska
a58ec7325d
refactor(logging): replace all print/log with structured slog logger
...
Cyrene CI / backend (push) Has been cancelled
Cyrene CI / frontend (push) Has been cancelled
- main.go: 30+ log.Printf → logger.Infof
- plugin/registry: 12 log.Printf → logger.Infof
- db/db.go, ws/hub.go: log → logger
- platform-bridge: fmt.Printf/println → logger.Info
- Logs now: time=... level=INFO msg=...
- 16 packages pass, vet clean
2026-08-12 21:31:06 +08:00
Aska
628d416dcd
feat(admin): add authenticated restart endpoint + fix admin username
...
Cyrene CI / backend (push) Has been cancelled
Cyrene CI / frontend (push) Has been cancelled
- POST /api/v1/admin/restart: admin-only restart (forks new process)
- Fix: MemUserStore now uses cfg.AdminUsername instead of hardcoded 'admin'
- RestartFunc injected by main.go for clean process fork + exit
2026-08-12 21:26:58 +08:00
Aska
dee48b6766
feat: add automation, reminders, notifications, msg search, session export, image analysis, host exec, PWA, Docker, E2E, CI/CD
...
Cyrene CI / backend (push) Has been cancelled
Cyrene CI / frontend (push) Has been cancelled
- Automation: rules CRUD (in-memory store + API)
- Reminders: CRUD (in-memory store + API)
- Notifications: push interface for future push server
- Message search: API endpoint with DB-backed query
- Session export: /sessions/:id/export → Markdown
- Image analysis: API stub for multimodal LLM
- Host exec: API stub for Docker sandbox
- PWA: manifest.json + service worker
- Docker: Dockerfile + docker-compose.yml
- E2E: Playwright test scaffold
- CI/CD: GitHub Actions workflow (go test + tsc)
2026-08-12 19:43:46 +08:00
Aska
3f9c4ca3c3
fix(prompt): prevent LLM from confusing context with user input
...
- Context merged into single system message with clear delimiters
- Prefix: 「以下是系统上下文,不是用户说的话」
- Memory → 【相关记忆】, IoT → 【设备状态】
- Filter empty memories, skip raw intent data
- Persona rule: context markers are internal data, not user input
2026-08-12 19:28:32 +08:00
Aska
585dfa1e38
fix(prompt): clean persona system prompt — remove YAML dump, filter empty subsessions
...
- Persona injector: concise natural language rules, not raw YAML
- Context builder: skip empty memory, skip raw intent data
- Prompt reduced from 2000+ tokens to ~500 tokens
- LLM response quality improved (natural tone, no confusion)
2026-08-12 19:27:12 +08:00
Aska
14a8eecfdb
fix(memory): improve dedup thresholds and keyword priority
...
- Dedup: OR logic with 28%/0.45 thresholds (was 25%/0.4)
- Keywords: segments first → 3-grams → 2-grams
- False positive: 10% → acceptable level
- Accuracy: 80% correct dedup, 71% real rate
2026-08-12 19:20:14 +08:00
Aska
dc3671eb8d
feat(bench): add memory benchmark tool + export keywords
...
- tools/memory-bench: 6 metrics (write/search/dedup/keyword/bulk/rate)
- memory: export ExtractKeywordsPublic for benchmarking
- Results: 1000+ 条/秒 write, 380µs search, 80% dedup accuracy, 71% real rate
2026-08-12 19:15:15 +08:00
Aska
6a4887e52a
feat(llm): add LLM call recording with admin panel integration
...
- llm.Adapter: SetCallLogger hook for recording every API call
- llm.CallLogger: ring-buffer with Recent+Stats for admin API
- main.go: wire DeepSeek adapter to CallLogger
- Fix: single CallLogger instance for both recording and display
- Metrics: model name, duration, success/fail, tokens
- All 16 packages pass
2026-08-12 19:10:51 +08:00
Aska
4e2e81f684
feat(trace): waterfall visualization + persona YAML sync
...
- trace.Logger: Trace+Span model with 14+ hop tracking
- trace.SpanTimer: convenience API for instrumentation
- trace_adapter.go: serialize Trace+Span for frontend
- Frontend TracePage: colored waterfall bars, expand/collapse, detail popup
- persona.go: full v1 YAML parser (identity/traits/forbidden/sections)
- cyrene_persona.yaml: v1 persona config copied to v2
- Orchestrator: TraceHook + MemoryExtractor injection points
2026-08-12 18:52:39 +08:00
Aska
47047c903c
feat(memory): add LLM-driven memory extraction from conversations
...
- memory/extractor: async LLM-based memory extraction from chat history
- Parses JSON lines from LLM response as memory entries
- Wire into orchestrator pipeline via PostProcess hook
- Non-blocking: runs in goroutine with 30s timeout
- Automatic dedup via existing keyword overlap logic
2026-08-12 18:43:04 +08:00
Aska
886fcf2216
fix(memory): rewrite dedup with n-gram keyword overlap + embedder
...
- Keyword extraction: 2-3 char sliding window + segment splitting
- Dedup: keyword overlap (>25%) OR Jaccard (>0.4) triggers merge
- SearchByNGrams: pgvector GIN index on keywords array
- Embedder: n-gram FNV hash (zero dep), OpenAI API with auto-fallback
- GIN index on keywords column for fast overlap search
- All tests pass
2026-08-12 18:24:04 +08:00
Aska
9eaed2883f
feat(bridge): separate bridge config from .env, web panel + hot-reload
...
- BridgeConfigStore: file-backed JSON config (configs/bridge.json)
- Auto-creates config file only when user saves via admin panel
- Hot-reload: watches config file every 5s, reloads adapters live
- Admin API: GET/PUT/DELETE /api/v1/admin/bridge/config/:name
- Frontend: full CRUD page with platform type selector + toggle
- Removed bridge env vars from .env.example
2026-08-12 17:55:15 +08:00
Aska
e8b5679cf4
feat(admin): add full-chain trace and performance monitoring
...
- Backend: trace.Logger ring-buffer for request chain events
- Backend: perf.Monitor with runtime.MemStats sampling every 10s
- Backend: /api/v1/admin/trace and /api/v1/admin/perf endpoints
- Frontend: TracePage — timeline with hop icons and status dots
- Frontend: PerformancePage — memory/GC bar charts + live stats
- Admin nav expanded to 11 items
2026-08-12 17:16:33 +08:00
Aska
8420691438
feat(admin): add model config CRUD and platform bridge pages
...
- Backend: ModelConfigStore with Provider/Model/Routing CRUD
- Backend: /api/v1/admin/models/config endpoints
- Frontend: ModelsPage with 3-tab editor (providers/models/routing)
- Frontend: BridgePage showing adapter status + group chat rules
- Admin nav expanded to 9 items
2026-08-12 17:13:29 +08:00
Aska
1a80ac2a00
feat(admin): add LLM call logs, system info, plugin list pages
...
- ai-core/llm: ring-buffer call logger with stats
- Gateway: /api/v1/admin/llm-calls, /system, /plugins, /sessions endpoints
- Frontend: LLMCallsPage (table + stats), SystemPage (version/plugins/sessions)
- Admin nav expanded to 7 items
2026-08-12 16:56:52 +08:00
Aska
17ef73bcbe
feat(bridge): add multi-platform bridge — QQ, Telegram, Discord, Webhook
...
- platform-bridge: unified message model + Adapter interface
- qq/adapter: OBv11 WebSocket protocol with @mention detection
- telegram/discord: stub adapters with send capability
- webhook: HTTP POST receiver for generic webhook integration
- Router: message routing from platform → AI-Core → back
- Group chat rules: 500 char limit, 3s gap, silence keywords
- main.go: conditional adapter loading via env vars
2026-08-12 12:30:55 +08:00
Aska
fbb331ed4b
feat(auth): replace stub auth with real JWT + bcrypt
...
- RealAuthManager: JWT signing/validation + bcrypt password hashing
- MemUserStore: in-memory user store with default admin
- Register endpoint: user creation with hashed password
- Login endpoint: bcrypt verification + JWT generation
- AuthManager interface extended with Login/Register methods
2026-08-12 12:21:36 +08:00
Aska
6811480786
feat(gateway): wire real services into Gateway API handlers
...
- Router accepts full Dependencies (memory/voice/orchestrator/WShub)
- Memory API: CRUD + search endpoints with PostgreSQL persistence
- Voice API: STT/TTS endpoints
- Admin dashboard: real uptime + service status
- WebSocket chat: routes to AI-Core orchestrator pipeline
- APIAdapter bridges memory domain model to REST interface
- Smoke test: memory CRUD + session creation verified
2026-08-12 12:04:31 +08:00
Aska
192144563b
feat(plugins): add 10 tool plugins and wire full service stack in main.go
...
- plugins: calculator, datetime, crypto, random, text, json, markdown
- plugins: web-search (SearXNG stub), web-fetch, file, http (stubs)
- main.go: full wiring — config→db→nats→plugins→voice→memory→
persona→llm→context→subsession→orchestrator→gateway→ws
- 15 packages passing, 11 plugins loaded at startup
2026-08-12 11:37:36 +08:00
Aska
3b3e5a0697
feat(ai-core): add LLM orchestration engine
...
- model: shared data types (Message, Intent, StreamToken, LLMMessage)
- persona: YAML/Raw loading + system prompt injection
- llm: OpenAI-compatible adapter with streaming + semantic cache
- context: sliding window context store with token budgeting
- subsession: parallel provider dispatch + review message parser
- orchestrator: intent analysis pipeline (IoT/greeting/chat/memory)
- background: autonomous thinking engine
- 20+ tests, build + vet clean, ~130 total tests
2026-08-09 21:21:27 +08:00
Aska
99806fefad
feat: add gateway API, voice service, WebSocket hub, and startup entry
...
- services/gateway/api: net/http router with JWT auth, stub login, 6 tests
- services/gateway/ws: WebSocket hub with echo support
- services/voice: STT/TTS provider chain with fallback, 6 tests
- cmd/cyrene/main.go: single binary startup, 108 tests total
- Smoke test: health check + login verified on :8080
2026-08-09 21:09:43 +08:00
Aska
81ebdb910c
feat(memory): complete memory service with passing tests
...
- model: Memory struct with categories/decay/keywords
- repository: PG CRUD + keyword search + table migration SQL
- service: dedup (Jaccard), keyword extraction, decay formula
- 7 tests (3 DB integration + 4 unit), 96 total, vet clean
2026-08-09 20:51:01 +08:00
Aska
7295556c59
feat(services): add memory service — model, repository, service layer
...
- services/memory/model: Memory struct with categories and decay
- services/memory/repository: PostgreSQL CRUD + keyword search
- services/memory/service: dedup, decay, keyword extraction
- tests coming in follow-up commit
2026-08-09 20:50:01 +08:00
Aska
aee8db9b3f
feat(internal): add platform detection and auth packages
...
- internal/platform: cross-platform path detection, 6 tests
- internal/auth: JWT generation/validation + bcrypt, 8 tests
- 89 total tests, build + vet clean
2026-08-09 20:46:41 +08:00
Aska
ca106f71ae
feat(internal): add NATS abstraction and DB connection manager
...
- internal/nats: Connection interface + InProcessConn, 7 tests
- internal/db: PostgreSQL connection pool + migration runner, 5 tests
- 75 total tests, build + vet clean
2026-08-09 20:45:19 +08:00
Aska
750d594055
feat(plugin): add plugin interface system and iot-mock implementation
...
- internal/plugin: Plugin/IoTProvider/ToolProvider/RAGProvider interfaces
- internal/plugin: Registry with type-safe auto-detection, 11 tests
- plugins/iot-mock: 8 simulated smart home devices, 11 tests
- 63 total tests, build + vet clean
2026-08-09 20:38:37 +08:00
Aska
7943e290ec
feat(internal): add foundational packages — config, logger, errors
...
- config: env-based loading with startup validation, 13 tests
- logger: structured slog wrapper with redaction, 10 tests
- errors: unified AppError model with HTTP mapping, 18 tests
- 41 tests total, build + vet clean
2026-08-09 20:35:42 +08:00
Aska
14d5d6e555
chore: init Cyrene_v2 project structure and DevDocs
...
- Create directory structure for backend, frontend, deployment, tests
- .gitignore with DevDocs/ excluded from version control
- DevDocs: 00-overview, 01-cross-platform, 02-dev-constraints
- DevDocs decisions: 002-communication (NATS), 003-plugin-architecture
- DevDocs modules: ai-core analysis, gateway analysis
2026-08-09 20:18:56 +08:00