feat: initialize external DobotAI agent gateway
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
)
|
||||
|
||||
type ConversationType string
|
||||
|
||||
const (
|
||||
ConversationDirect ConversationType = "direct"
|
||||
ConversationGroup ConversationType = "group"
|
||||
)
|
||||
|
||||
var ErrTurnInProgress = errors.New("turn is already processing")
|
||||
|
||||
type QARequest struct {
|
||||
TenantKey string
|
||||
Channel string
|
||||
ConversationType ConversationType
|
||||
ExternalChatID string
|
||||
ExternalUserID string
|
||||
ExternalMessageID string
|
||||
SenderName string
|
||||
Query string
|
||||
}
|
||||
|
||||
type Reference struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
KnowledgeID string `json:"knowledge_id,omitempty"`
|
||||
KnowledgeTitle string `json:"knowledge_title,omitempty"`
|
||||
Content string `json:"content,omitempty"`
|
||||
Score float64 `json:"score,omitempty"`
|
||||
Raw json.RawMessage `json:"-"`
|
||||
}
|
||||
|
||||
type QAResult struct {
|
||||
TurnID string `json:"turn_id"`
|
||||
WeKnoraSessionID string `json:"weknora_session_id"`
|
||||
WeKnoraRequestID string `json:"weknora_request_id,omitempty"`
|
||||
Answer string `json:"answer"`
|
||||
References []Reference `json:"references,omitempty"`
|
||||
Replayed bool `json:"replayed"`
|
||||
}
|
||||
|
||||
type SessionMapping struct {
|
||||
SessionKey string
|
||||
TenantKey string
|
||||
Channel string
|
||||
AgentID string
|
||||
ConversationType ConversationType
|
||||
ExternalSubjectID string
|
||||
WeKnoraSessionID string
|
||||
}
|
||||
|
||||
type Turn struct {
|
||||
ID string
|
||||
TenantKey string
|
||||
Channel string
|
||||
ExternalMessageID string
|
||||
SessionKey string
|
||||
WeKnoraSessionID string
|
||||
WeKnoraRequestID string
|
||||
Question string
|
||||
Answer string
|
||||
References []Reference
|
||||
Status string
|
||||
ErrorMessage string
|
||||
}
|
||||
|
||||
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)
|
||||
FinishTurn(ctx context.Context, turn Turn) error
|
||||
}
|
||||
Reference in New Issue
Block a user