feat(server): add brand kit management and project binding

Add a brand kit domain with memory and postgres stores, a BrandKitService
for CRUD and resolution, and REST endpoints to list, upsert, and delete
brand kits. Projects can bind a brand kit whose resolved context and
reference images feed into the agent's long-term memory and design prompts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-10 20:58:55 +08:00
parent 3653474355
commit 789f51b29e
38 changed files with 2165 additions and 135 deletions
+56 -15
View File
@@ -179,6 +179,27 @@ type AuthUser struct {
AvatarUrl string `json:"avatarUrl,optional"`
}
type BrandKit struct {
Id string `json:"id"`
Name string `json:"name"`
Document string `json:"document"`
IsDefault bool `json:"isDefault"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type BrandKitIdRequest struct {
Id string `path:"id"`
}
type BrandKitListResponse struct {
BrandKits []BrandKit `json:"brandKits"`
}
type BrandKitResponse struct {
BrandKit BrandKit `json:"brandKit"`
}
type CandaChatHistoryItem struct {
Id string `json:"id"`
Timestamp string `json:"timestamp"`
@@ -319,14 +340,15 @@ type CreateAssetUploadResponse struct {
}
type CreateProjectRequest struct {
Title string `json:"title,optional"`
Prompt string `json:"prompt,optional"`
ImageModel string `json:"imageModel,optional"`
ImageSize string `json:"imageSize,optional"`
ImageQuality string `json:"imageQuality,optional"`
ImageCount int64 `json:"imageCount,optional"`
EnableWebSearch bool `json:"enableWebSearch,optional"`
AllowEmptyPrompt bool `json:"allowEmptyPrompt,optional"`
Title string `json:"title,optional"`
Prompt string `json:"prompt,optional"`
BrandKitId *string `json:"brandKitId,optional"`
ImageModel string `json:"imageModel,optional"`
ImageSize string `json:"imageSize,optional"`
ImageQuality string `json:"imageQuality,optional"`
ImageCount int64 `json:"imageCount,optional"`
EnableWebSearch bool `json:"enableWebSearch,optional"`
AllowEmptyPrompt bool `json:"allowEmptyPrompt,optional"`
}
type DashboardResponse struct {
@@ -344,6 +366,11 @@ type DeleteAssetResponse struct {
Deleted bool `json:"deleted"`
}
type DeleteBrandKitResponse struct {
Id string `json:"id"`
Deleted bool `json:"deleted"`
}
type DeleteProjectResponse struct {
Id string `json:"id"`
Deleted bool `json:"deleted"`
@@ -686,6 +713,7 @@ type Project struct {
SnapshotId string `json:"snapshotId"`
Canvas string `json:"canvas"`
LastThreadId string `json:"lastThreadId"`
BrandKitId string `json:"brandKitId,optional"`
Viewport CanvasViewport `json:"viewport"`
Nodes []CanvasNode `json:"nodes"`
Connections []CanvasConnection `json:"connections"`
@@ -712,13 +740,14 @@ type ProjectResponse struct {
}
type ProjectSummary struct {
Id string `json:"id"`
UserId string `json:"userId"`
Title string `json:"title"`
Brief string `json:"brief"`
Status string `json:"status"`
Thumbnail string `json:"thumbnail"`
UpdatedAt string `json:"updatedAt"`
Id string `json:"id"`
UserId string `json:"userId"`
Title string `json:"title"`
Brief string `json:"brief"`
Status string `json:"status"`
Thumbnail string `json:"thumbnail"`
BrandKitId string `json:"brandKitId,optional"`
UpdatedAt string `json:"updatedAt"`
}
type QueryAgentLastThreadRequest struct {
@@ -760,6 +789,7 @@ type QueryProjectData struct {
Version string `json:"version"`
SnapshotId *string `json:"snapshotId"`
ItemId *string `json:"itemId"`
BrandKitId string `json:"brandKitId,optional"`
Permission string `json:"permission"`
}
@@ -930,6 +960,11 @@ type UpdateAccountProfileRequest struct {
AvatarUrl string `json:"avatarUrl,optional"`
}
type UpdateProjectBrandKitRequest struct {
Id string `path:"id"`
BrandKitId string `json:"brandKitId,optional"`
}
type UpdateProjectTitleRequest struct {
Id string `path:"id"`
Title string `json:"title"`
@@ -946,6 +981,12 @@ type UpdateShareMemberRequest struct {
Permission string `json:"permission"`
}
type UpsertBrandKitRequest struct {
Id string `path:"id"`
Document string `json:"document"`
IsDefault bool `json:"isDefault,optional"`
}
type WechatAuthURLResponse struct {
AuthUrl string `json:"authUrl"`
State string `json:"state"`