Commit Graph

76 Commits

Author SHA1 Message Date
root 4026aa7dad feat(kol-web): add i18n keys for KOL profile page 2026-04-18 14:08:22 +08:00
root ccf7f8080b feat(kol-web): add updateProfile and uploadAvatar to kolManageApi 2026-04-18 14:07:01 +08:00
root d2922478ed feat(kol): expose PUT /kol/manage/profile and POST /kol/manage/profile/avatar 2026-04-18 14:06:20 +08:00
root 1393b25419 feat(kol): add avatar upload to KolProfileService 2026-04-18 14:05:09 +08:00
root 0e3515530f feat(kol): add KolProfileService.UpdateProfile 2026-04-18 14:03:49 +08:00
root 4bfa4242ef feat(kol): add KOL profile field validators 2026-04-18 14:03:07 +08:00
root 8c531054b3 docs: add KOL profile page implementation plan
9 TDD tasks, each with bite-sized steps and commit points:
validators → service → avatar upload → handlers/routes →
API client → i18n → persona card → view/route/nav → verify.
2026-04-18 14:01:54 +08:00
root 26dd75e548 docs: add KOL profile page design spec
- KOL 工作台新增「个人主页」独立页,明确与租户/SaaS 账号设置区分
- 定位为精调模版展示页 + KOL 人设自助编辑
- 页面内联编辑、头像复用 image_service、仅展示已发布模版
2026-04-18 13:55:20 +08:00
root b2605abd6a feat: Enhance Kol Generation Service with web search and knowledge group support
- Added `EnableWebSearch` and `KnowledgeGroupIDs` fields to `KolGenerationSubmitRequest`.
- Updated `Submit` method in `KolGenerationService` to handle new request fields.
- Integrated web search and knowledge group validation based on card configuration.
- Introduced caching mechanisms in `KolPackageService`, `KolPromptService`, and `KolSubscriptionAdminService` to improve performance.
- Implemented knowledge context resolution in `KolGenerationWorker` to enrich prompts with relevant knowledge snippets.
- Added utility functions for handling card configuration in both backend and frontend.
- Created tests for knowledge extraction and rendering to ensure accuracy and reliability.
2026-04-18 13:47:32 +08:00
root 3ef0807456 fix: Enhance Kol Variable Rendering and Management
- Updated the regex for placeholder matching to support more flexible key formats.
- Refactored variable storage to allow both ID and key lookups in rendering.
- Improved schema validation to check for duplicate keys and enforce non-empty keys.
- Added new utility functions for variable value lookup and display name generation.
- Enhanced tests to cover new key-based variable scenarios.
- Refactored KolPrompt repository to simplify prompt storage and management, including the removal of obsolete revision handling.
- Introduced new API endpoints for saving, activating, and archiving prompts.
- Added new utility functions for handling Kol placeholders and platform options in the admin web.
- Implemented database migrations to simplify prompt storage structure and ensure data integrity.
2026-04-18 00:47:57 +08:00
root 614ca4a2ea feat(kol): workspace KOL card area 2026-04-17 15:23:38 +08:00
root b6bd4f02fb feat(kol): workspace KOL cards + article source type 2026-04-17 15:19:11 +08:00
root 641383a585 feat(kol): dashboard view 2026-04-17 15:11:18 +08:00
root 6e95e00907 feat(kol): dashboard service + API 2026-04-17 15:05:09 +08:00
root 4b6d434556 feat(kol): dynamic-form generation view 2026-04-17 14:59:52 +08:00
root 97c18cdbef feat(kol): generation + schema HTTP endpoints 2026-04-17 14:52:16 +08:00
root 019410fffe feat(kol): generation service + worker branch 2026-04-17 14:52:08 +08:00
root 26bc8a3749 feat(kol): repo support for cross-tenant revision lookup 2026-04-17 14:51:54 +08:00
root d0747825e6 feat(kol): marketplace + package detail views 2026-04-17 14:30:47 +08:00
root 2a2489ce5c feat(kol): marketplace + admin subscription HTTP endpoints 2026-04-17 14:23:39 +08:00
root 99fc6c1af4 feat(kol): marketplace + subscription admin services + publish fan-out 2026-04-17 14:23:32 +08:00
root df334c1e26 feat(kol): marketplace and admin subscription repo queries 2026-04-17 14:23:25 +08:00
root 6eb663bd6e feat(kol): three-pane prompt editor + KolManageView UI 2026-04-17 14:08:34 +08:00
root d5f7cdfc5f feat(kol): AI assist HTTP endpoints 2026-04-17 13:52:08 +08:00
root d55f1276f3 feat(kol): AI assist service + worker 2026-04-17 13:52:01 +08:00
root 9cf9fac109 feat(kol): admin-web API client + router entries for KOL 2026-04-17 13:51:39 +08:00
root a6ded27c1d feat(kol): KOL workspace HTTP handlers + route registration 2026-04-17 09:19:37 +08:00
root 6029b0b169 feat(kol): KOL workspace services (profile/package/prompt/asset/renderer) 2026-04-17 09:19:30 +08:00
root 76f5c73773 feat(kol): sidebar nav groups for marketplace + KOL workspace 2026-04-17 09:02:39 +08:00
root 40519545c6 feat(kol): expose kol_profile on /api/auth/me and add seed script 2026-04-17 09:02:33 +08:00
root 70725193eb fix(kol): Phase 1 review — ACL lineage, expiry filters, tighter tenant scope
Addresses findings from consolidated Phase 1 code review:

- Add composite unique indexes + composite FKs so subscription_prompts and
  packages cannot reference mismatched (tenant_id, package_id, prompt_id)
  tuples, enforcing ACL lineage at the schema level.
- Add status CHECK constraints on all KOL tables as defense-in-depth.
- ListActiveSubscribersForPackage: drop meaningless tenant_id IS NOT NULL,
  add end_at expiry filter so fan-out skips expired subscribers.
- ApproveKolSubscription: add status='pending' guard to prevent double-approval.
- ListSubscriptionPromptsByTenant: join subscription/prompt/package/profile
  lifecycle so hidden/archived content no longer leaks; surface
  kol_display_name for UI.
- ListPublishedKolPackages: exclude expired subscribers from marketplace count.
- KolDashboardTrend: rewrite as CTE with day-series, returning both daily
  usage and new subscription counts.
- Remove cosmetic tenant_id IS NOT NULL from dashboard overview queries
  (the column is NOT NULL by schema).
- check_tenant_scope.sh: require tenant_id = sqlc.(n?)arg filter, reject
  tenant_id IS NOT NULL as a fake scope, maintain explicit exemption list.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 08:34:12 +08:00
root 3d4842e983 feat(kol): repository layer for all KOL tables 2026-04-17 08:17:22 +08:00
root 2c58fc591e feat(kol): add KOL TypeScript shared types 2026-04-17 08:13:40 +08:00
root b78664c7d0 feat(kol): add sqlc queries for all KOL tables 2026-04-17 08:10:45 +08:00
root 5c8f2bffae feat(kol): add kol_prompt_id column to articles 2026-04-17 08:06:36 +08:00
root fd74ad703b feat(kol): enhance KOL constraints per review findings
- Add composite FK kol_usage_logs(prompt_id, prompt_revision_no) -> kol_prompt_revisions
  to enforce audit replay integrity
- Add CHECK constraint: active prompts must have a published revision
- Add tenant-leading index on kol_packages for list path performance

Addresses review feedback on commit 60fb8a4.
2026-04-17 08:04:56 +08:00
root 60fb8a4d7f feat(kol): add migration for KOL core tables 2026-04-17 07:53:56 +08:00
root 3e1b68f771 docs: add KOL feature implementation plan
8-phase plan covering data foundation, profile lifecycle, workspace
backend/frontend, marketplace+subscription, generation pipeline, dashboard,
and workspace integration. Each phase is a shippable milestone.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 07:46:29 +08:00
root 6b2810fc74 docs: revise KOL spec v2 — align with existing prompt sharing architecture
Addresses all critical findings from review:
- KOL identity via prompt_share_profiles, not platform_role
- Prompts stored as sealed article_templates, not parallel system
- Platform-level packages with proper API path separation
- Generation pipeline integrated with existing tx/quota/idempotency
- Variable model with immutable IDs and version snapshots
- Independent kol_assist_tasks table (decoupled from template_assist_tasks)
- Complete resource lifecycle and auth chain
- Consistent tenant-level subscription entity

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 22:24:11 +08:00
root 33f1121633 docs: add KOL feature design spec
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 22:08:50 +08:00
root ed10fd82e6 fix: add image asset ID extraction and filtering functions for markdown content 2026-04-16 21:12:35 +08:00
root 41f3060e00 feat: add brand library management features
- Introduced BrandLibrarySummary type to encapsulate brand library limits and usage.
- Updated Brand interface to include keyword_count and question_count fields.
- Implemented brand library limits in the backend, including max brands, keywords, and questions per keyword.
- Added API endpoint to retrieve brand library summary.
- Enhanced BrandsView.vue to display brand library usage and limits.
- Implemented computed properties to manage brand, keyword, and question limits in the UI.
- Updated mutation handlers to invalidate relevant queries upon creating/updating brands, keywords, and questions.
- Added visual indicators for brand, keyword, and question limits in the UI.
- Enhanced error handling for exceeding brand and keyword limits during creation.
2026-04-16 21:01:40 +08:00
root 27389164b0 feat: add image management functionality
- Implemented image folder repository with CRUD operations.
- Added image reference repository for managing image references to articles.
- Created image repository for handling image assets, including listing, inserting, updating, and deleting images.
- Introduced image usage repository to track storage usage and quotas for tenants.
- Added SQL queries for image assets, folders, references, and usage.
- Developed image handler for HTTP endpoints to manage images and folders.
- Created database migration scripts for image-related tables and structures.
2026-04-16 20:40:41 +08:00
root 0a3558fc51 feat(deploy): add containerized deployment configuration and scripts
- Add Dockerfile for frontend and server services
- Add Docker Compose configs (standard and offline mode)
- Add nginx.conf for admin-web service
- Add deploy scripts: package.sh (packaging) and load-and-start.sh (startup)
- Add deploy/config.yaml, .env.example, and prompts.yml configurations
- Add image management design specification doc
2026-04-15 21:27:15 +08:00
root 1538a12042 feat(cache): add read-through cache layer across all app services
Introduce a generic read-through caching infrastructure and wire it into
all major tenant app services to reduce database load on hot read paths.

Key changes:
- Add `DeletePrefix` to Cache interface with memory (prefix scan) and
  Redis (SCAN + DEL) implementations
- New `readthrough.go`: generic `LoadJSON` / `LoadJSONWithEmpty` helpers
  backed by singleflight to prevent cache stampedes; supports jittered TTL
- New `cache_support.go`: centralized cache key builders and invalidation
  helpers for all entities (workspace, brand, prompt rules, schedule tasks,
  articles)
- Wire optional cache into ArticleService, BrandService, WorkspaceService,
  PromptRuleService, ScheduleTaskService, TemplateService, MediaService,
  PromptGenerateService via `WithCache()` builder pattern
- ScheduleDispatchWorker invalidates schedule task cache after dispatching
- ArticleService gains a new `Detail` endpoint with empty-result caching
- Update cmd entrypoints and transport handlers to propagate cache
2026-04-15 16:11:05 +08:00
root 4d06938565 feat: update frontend schedule task fields, zhihu table format, and shared types
Persist enable_web_search and generate_count in GenerateTaskDrawer.
Display generate_count in ScheduleTaskTab. Add Zhihu table format
conversion for compatibility. Extend shared types with batch generation
response fields. Strengthen outline adherence rule in prompts config.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 14:21:19 +08:00
root 6869dc2fa6 feat(schedule): enhance schedule tasks with web search and batch generation support
Add enable_web_search and generate_count columns to schedule_tasks table.
Refactor schedule task service to publish generation jobs to RabbitMQ
instead of inline execution, supporting batch dispatch and backpressure
awareness via scheduler process.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 14:20:54 +08:00
root ce13331e26 feat(generation): migrate article generation and template-assist to RabbitMQ queues
Replace in-process generation with queue-based async execution via
RabbitMQ. Add generation task runtime for lifecycle management, article
generation payload/queue abstractions, and template-assist queue publisher.
Refactor prompt generation service to support batch generation with
per-item error tracking. Update stream hub to bridge queue events to SSE.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 14:20:26 +08:00
root e8f48c6d37 refactor(monitoring): consolidate workers and extract to scheduler process
Remove standalone lease-recovery, received-inspection, and result-recovery
workers from tenant-api (now handled by scheduler process). Add configurable
concurrency to ingest and projection-rebuild workers via MonitoringWorkers
runtime config. Extract shared runtime types for worker configuration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 14:19:57 +08:00
root 3f5b5c1e01 feat(infra): add scheduler and worker-generate standalone processes
Extract monitoring recovery/inspection workers and schedule dispatch
into a dedicated scheduler process. Add worker-generate process for
article generation and template-assist queue consumption. Introduce
shared/schedule runtime for cron-based worker lifecycle management.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 14:19:21 +08:00