feat(kol): enrich assist generate with URL references and template prompt
- Add kolAssistURLResolver that fetches reference articles via the Ark
URL extractor when the user's description contains http(s) links, and
merges up to kolAssistReferenceContentMaxRunes of extracted content
into the generate description.
- Rewrite the generate user prompt into a strict template-authoring
brief: output only the final prompt template in Chinese, parameterize
variable info as {{placeholder}}, require at least 3 placeholders
when references exist, and cover goal/topic/title/structure/style/
interaction/constraints.
- Wire LLMConfig and logger through NewKolAssistService and the
handler.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,10 +8,12 @@ import (
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/geo-platform/tenant-api/internal/shared/auth"
|
||||
"github.com/geo-platform/tenant-api/internal/shared/config"
|
||||
"github.com/geo-platform/tenant-api/internal/shared/llm"
|
||||
"github.com/geo-platform/tenant-api/internal/shared/messaging/rabbitmq"
|
||||
"github.com/geo-platform/tenant-api/internal/shared/response"
|
||||
"github.com/geo-platform/tenant-api/internal/tenant/repository"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -46,10 +48,12 @@ type KolAssistTaskResponse struct {
|
||||
}
|
||||
|
||||
type KolAssistService struct {
|
||||
profileSvc *KolProfileService
|
||||
repo repository.KolAssistRepository
|
||||
llm llm.Client
|
||||
messaging *rabbitmq.Client
|
||||
profileSvc *KolProfileService
|
||||
repo repository.KolAssistRepository
|
||||
llm llm.Client
|
||||
messaging *rabbitmq.Client
|
||||
logger *zap.Logger
|
||||
urlResolver *kolAssistURLResolver
|
||||
}
|
||||
|
||||
func NewKolAssistService(
|
||||
@@ -57,12 +61,16 @@ func NewKolAssistService(
|
||||
repo repository.KolAssistRepository,
|
||||
llmClient llm.Client,
|
||||
messagingClient *rabbitmq.Client,
|
||||
llmCfg config.LLMConfig,
|
||||
logger *zap.Logger,
|
||||
) *KolAssistService {
|
||||
return &KolAssistService{
|
||||
profileSvc: profileSvc,
|
||||
repo: repo,
|
||||
llm: llmClient,
|
||||
messaging: messagingClient,
|
||||
profileSvc: profileSvc,
|
||||
repo: repo,
|
||||
llm: llmClient,
|
||||
messaging: messagingClient,
|
||||
logger: logger,
|
||||
urlResolver: newKolAssistURLResolver(llmCfg, logger),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user