feat: add DingTalk directory-backed session titles

This commit is contained in:
姚章浩
2026-07-23 10:55:25 +08:00
parent 39c5fbbaef
commit 5e0694835a
33 changed files with 1648 additions and 62 deletions
+10
View File
@@ -40,10 +40,13 @@ type QARequest struct {
TenantKey string
Channel string
ConversationType ConversationType
ConversationTitle string
ExternalChatID string
ExternalUserID string
ExternalMessageID string
SenderName string
Department string
Region string
Query string
Images []ImageInput
MessageType string
@@ -77,8 +80,11 @@ type SessionMapping struct {
ConversationType ConversationType
ExternalSubjectID string
WeKnoraSessionID string
DisplayTitle string
}
type SessionTitleUpdate func(ctx context.Context, sessionID, title string) error
type Turn struct {
ID string
TenantKey string
@@ -89,9 +95,12 @@ type Turn struct {
WeKnoraRequestID string
AgentID string
ConversationType ConversationType
ConversationTitle string
ExternalChatID string
ExternalUserID string
SenderName string
DepartmentSnapshot string
RegionSnapshot string
MessageType string
ActorID string
ConversationID string
@@ -143,6 +152,7 @@ var ErrDeliveryUpdateFailed = errors.New("delivery update failed: RowsAffected !
type Repository interface {
BeginTurn(ctx context.Context, turn Turn) (Turn, bool, error)
ResolveSession(ctx context.Context, mapping SessionMapping, create func(context.Context) (string, error)) (string, error)
SyncSessionTitle(ctx context.Context, mapping SessionMapping, title string, update SessionTitleUpdate) error
FinishTurn(ctx context.Context, turn Turn) error
RecordDelivery(ctx context.Context, du DeliveryUpdate) error
}