Documentation
¶
Index ¶
- Constants
- Variables
- func DefineConversationComponent(ctx context.Context, srv *datly.Service) error
- func DefineConversationsComponent(ctx context.Context, srv *datly.Service) error
- type AttachmentView
- type ConversationInput
- type ConversationInputHas
- type ConversationOutput
- type ConversationView
- type Filter
- type LinkedConversationView
- type MessageView
- type ModelCallView
- type ModelView
- type ResponsePayloadView
- type ToolCallView
- type TranscriptView
- type UsageView
- type UserElicitationDataView
Constants ¶
View Source
const ( StageWaiting = "waiting" StageThinking = "thinking" StageExecuting = "executing" StageEliciting = "elicitation" StageDone = "done" StageError = "error" )
Variables ¶
View Source
var ConversationFS embed.FS
View Source
var ConversationPathURI = "/v1/api/agently/conversation/{id}"
View Source
var ConversationsPathURI = "/v1/api/agently/conversation/"
Functions ¶
Types ¶
type AttachmentView ¶
type ConversationInput ¶
type ConversationInput struct {
Id string `parameter:",kind=path,in=id" predicate:"equal,group=0,t,id"`
Since string `parameter:",kind=query,in=since" predicate:"expr,group=1,created_at >= (SELECT created_at FROM turn WHERE id = ?)"`
IncludeTranscript bool `parameter:",kind=query,in=includeTranscript" predicate:"expr,group=1,?" value:"true"`
IncludeModelCal bool `parameter:",kind=query,in=includeModelCall" predicate:"expr,group=2,?" value:"false"`
IncludeToolCall bool `parameter:",kind=query,in=includeToolCall" predicate:"expr,group=3,?" value:"false"`
AgentId string `parameter:",kind=query,in=agentId" predicate:"expr,group=0,t.agent_id = ?"`
ParentId string `parameter:",kind=query,in=parentId" predicate:"expr,group=0,t.conversation_parent_id = ?"`
ParentTurnId string `parameter:",kind=query,in=parentTurnId" predicate:"expr,group=0,t.conversation_parent_turn_id = ?"`
ScheduleId string `parameter:",kind=query,in=scheduleId" predicate:"expr,group=0,t.schedule_id = ?"`
ScheduleRunId string `parameter:",kind=query,in=scheduleRunId" predicate:"expr,group=0,t.schedule_run_id = ?"`
HasScheduleId bool `parameter:",kind=query,in=hasScheduleId" predicate:"expr,group=0,t.schedule_id IS NOT NULL"`
DefaultPredicate string `parameter:",kind=const,in=value" predicate:"handler,group=0,*conversation.Filter" value:"0"`
FeedSpec []*tool.FeedSpec `parameter:",kind=transient,in=extension"`
Has *ConversationInputHas `setMarker:"true" format:"-" sqlx:"-" diff:"-" json:"-"`
}
func InputFromContext ¶ added in v0.2.1
func InputFromContext(ctx context.Context) *ConversationInput
func (*ConversationInput) EmbedFS ¶
func (i *ConversationInput) EmbedFS() *embed.FS
type ConversationInputHas ¶
type ConversationOutput ¶
type ConversationOutput struct {
response.Status `parameter:",kind=output,in=status" json:",omitempty"`
Data []*ConversationView `` /* 128-byte string literal not displayed */
Metrics response.Metrics `parameter:",kind=output,in=metrics"`
}
type ConversationView ¶
type ConversationView struct {
LastTurnId *string `sqlx:"last_turn_id"`
Stage string `sqlx:"stage"`
Id string `sqlx:"id"`
Summary *string `sqlx:"summary"`
LastActivity *time.Time `sqlx:"last_activity"`
UsageInputTokens *int `sqlx:"usage_input_tokens"`
UsageOutputTokens *int `sqlx:"usage_output_tokens"`
UsageEmbeddingTokens *int `sqlx:"usage_embedding_tokens"`
CreatedAt time.Time `sqlx:"created_at"`
UpdatedAt *time.Time `sqlx:"updated_at"`
CreatedByUserId *string `sqlx:"created_by_user_id"`
AgentId *string `sqlx:"agent_id"`
DefaultModelProvider *string `sqlx:"default_model_provider"`
DefaultModel *string `sqlx:"default_model"`
DefaultModelParams *string `sqlx:"default_model_params"`
Title *string `sqlx:"title"`
ConversationParentId *string `sqlx:"conversation_parent_id"`
ConversationParentTurnId *string `sqlx:"conversation_parent_turn_id"`
Metadata *string `sqlx:"metadata"`
Visibility string `sqlx:"visibility"`
Status *string `sqlx:"status"`
Scheduled *int `sqlx:"scheduled"`
ScheduleId *string `sqlx:"schedule_id"`
ScheduleRunId *string `sqlx:"schedule_run_id"`
ScheduleKind *string `sqlx:"schedule_kind"`
ScheduleTimezone *string `sqlx:"schedule_timezone"`
ScheduleCronExpr *string `sqlx:"schedule_cron_expr"`
ExternalTaskRef *string `sqlx:"external_task_ref"`
Transcript []*TranscriptView `view:",table=turn" on:"Id:id=ConversationId:conversation_id" sql:"uri=conversation/transcript.sql"`
Usage *UsageView `view:",table=model_call" on:"Id:id=ConversationId:m.conversation_id" sql:"uri=conversation/usage.sql"`
}
func (*ConversationView) HasConversationParentId ¶ added in v0.2.2
func (c *ConversationView) HasConversationParentId() bool
func (*ConversationView) OnRelation ¶
func (c *ConversationView) OnRelation(ctx context.Context)
type LinkedConversationView ¶ added in v0.2.2
type MessageView ¶
type MessageView struct {
Id string `sqlx:"id"`
ConversationId string `sqlx:"conversation_id"`
TurnId *string `sqlx:"turn_id"`
Archived *int `sqlx:"archived"`
Sequence *int `sqlx:"sequence"`
CreatedAt time.Time `sqlx:"created_at"`
UpdatedAt *time.Time `sqlx:"updated_at"`
CreatedByUserId *string `sqlx:"created_by_user_id"`
Status *string `sqlx:"status"`
Mode *string `sqlx:"mode"`
Role string `sqlx:"role"`
Type string `sqlx:"type"`
Content *string `sqlx:"content"`
Summary *string `sqlx:"summary"`
ContextSummary *string `sqlx:"context_summary"`
Tags *string `sqlx:"tags"`
Interim int `sqlx:"interim"`
ElicitationId *string `sqlx:"elicitation_id"`
ParentMessageId *string `sqlx:"parent_message_id"`
SupersededBy *string `sqlx:"superseded_by"`
LinkedConversationId *string `sqlx:"linked_conversation_id"`
AttachmentPayloadId *string `sqlx:"attachment_payload_id"`
ElicitationPayloadId *string `sqlx:"elicitation_payload_id"`
ToolName *string `sqlx:"tool_name"`
EmbeddingIndex *string `sqlx:"embedding_index"`
UserElicitationData *UserElicitationDataView `view:",table=message" on:"Id:id=MessageId:m.id" sql:"uri=conversation/user_elicitation_data.sql"`
LinkedConversation *LinkedConversationView `` /* 128-byte string literal not displayed */
Attachment []*AttachmentView `view:",table=message" on:"Id:id=ParentMessageId:m.parent_message_id" sql:"uri=conversation/attachment.sql"`
ModelCall *ModelCallView `view:",table=model_call" on:"Id:id=MessageId:message_id" sql:"uri=conversation/model_call.sql"`
ToolCall *ToolCallView `view:",table=tool_call" on:"Id:id=MessageId:message_id" sql:"uri=conversation/tool_call.sql"`
}
type ModelCallView ¶
type ModelCallView struct {
MessageId string `sqlx:"message_id"`
TurnId *string `sqlx:"turn_id"`
Provider string `sqlx:"provider"`
Model string `sqlx:"model"`
ModelKind string `sqlx:"model_kind"`
ErrorCode *string `sqlx:"error_code"`
ErrorMessage *string `sqlx:"error_message"`
FinishReason *string `sqlx:"finish_reason"`
PromptTokens *int `sqlx:"prompt_tokens"`
PromptCachedTokens *int `sqlx:"prompt_cached_tokens"`
CompletionTokens *int `sqlx:"completion_tokens"`
TotalTokens *int `sqlx:"total_tokens"`
PromptAudioTokens *int `sqlx:"prompt_audio_tokens"`
CompletionReasoningTokens *int `sqlx:"completion_reasoning_tokens"`
CompletionAudioTokens *int `sqlx:"completion_audio_tokens"`
CompletionAcceptedPredictionTokens *int `sqlx:"completion_accepted_prediction_tokens"`
CompletionRejectedPredictionTokens *int `sqlx:"completion_rejected_prediction_tokens"`
Status string `sqlx:"status"`
StartedAt *time.Time `sqlx:"started_at"`
CompletedAt *time.Time `sqlx:"completed_at"`
LatencyMs *int `sqlx:"latency_ms"`
Cost *float64 `sqlx:"cost"`
TraceId *string `sqlx:"trace_id"`
SpanId *string `sqlx:"span_id"`
RequestPayloadId *string `sqlx:"request_payload_id"`
ResponsePayloadId *string `sqlx:"response_payload_id"`
ProviderRequestPayloadId *string `sqlx:"provider_request_payload_id"`
ProviderResponsePayloadId *string `sqlx:"provider_response_payload_id"`
StreamPayloadId *string `sqlx:"stream_payload_id"`
ModelCallRequestPayload *ResponsePayloadView `` /* 127-byte string literal not displayed */
ModelCallProviderRequestPayload *ResponsePayloadView `` /* 153-byte string literal not displayed */
ModelCallResponsePayload *ResponsePayloadView `` /* 130-byte string literal not displayed */
ModelCallProviderResponsePayload *ResponsePayloadView `` /* 156-byte string literal not displayed */
ModelCallStreamPayload *ResponsePayloadView `view:",table=call_payload" on:"StreamPayloadId:stream_payload_id=Id:id" sql:"uri=conversation/model_call_stream_payload.sql"`
}
type ModelView ¶
type ModelView struct {
ConversationId string `sqlx:"conversation_id"`
Model string `sqlx:"model"`
PromptTokens *int `sqlx:"prompt_tokens"`
PromptCachedTokens *int `sqlx:"prompt_cached_tokens"`
PromptAudioTokens *int `sqlx:"prompt_audio_tokens"`
CompletionTokens *int `sqlx:"completion_tokens"`
CompletionReasoningTokens *int `sqlx:"completion_reasoning_tokens"`
CompletionAudioTokens *int `sqlx:"completion_audio_tokens"`
CompletionAcceptedPredictionTokens *int `sqlx:"completion_accepted_prediction_tokens"`
CompletionRejectedPredictionTokens *int `sqlx:"completion_rejected_prediction_tokens"`
TotalTokens *int `sqlx:"total_tokens"`
Cost *float64 `sqlx:"cost"`
}
type ResponsePayloadView ¶
type ToolCallView ¶
type ToolCallView struct {
MessageId string `sqlx:"message_id"`
TurnId *string `sqlx:"turn_id"`
OpId string `sqlx:"op_id"`
Attempt int `sqlx:"attempt"`
ToolName string `sqlx:"tool_name"`
ToolKind string `sqlx:"tool_kind"`
Status string `sqlx:"status"`
RequestHash *string `sqlx:"request_hash"`
ErrorCode *string `sqlx:"error_code"`
ErrorMessage *string `sqlx:"error_message"`
Retriable *int `sqlx:"retriable"`
StartedAt *time.Time `sqlx:"started_at"`
CompletedAt *time.Time `sqlx:"completed_at"`
LatencyMs *int `sqlx:"latency_ms"`
Cost *float64 `sqlx:"cost"`
TraceId *string `sqlx:"trace_id"`
SpanId *string `sqlx:"span_id"`
RequestPayloadId *string `sqlx:"request_payload_id"`
ResponsePayloadId *string `sqlx:"response_payload_id"`
RequestPayload *ResponsePayloadView `view:",table=call_payload" on:"RequestPayloadId:request_payload_id=Id:id" sql:"uri=conversation/request_payload.sql"`
ResponsePayload *ResponsePayloadView `view:",table=call_payload" on:"ResponsePayloadId:response_payload_id=Id:id" sql:"uri=conversation/response_payload.sql"`
}
type TranscriptView ¶
type TranscriptView struct {
ElapsedInSec int `sqlx:"elapsedInSec"`
Stage string `sqlx:"stage"`
ToolFeed []*tool.Feed `sqlx:"-"`
Id string `sqlx:"id"`
ConversationId string `sqlx:"conversation_id"`
CreatedAt time.Time `sqlx:"created_at"`
Status string `sqlx:"status"`
ErrorMessage *string `sqlx:"error_message"`
StartedByMessageId *string `sqlx:"started_by_message_id"`
RetryOf *string `sqlx:"retry_of"`
AgentIdUsed *string `sqlx:"agent_id_used"`
AgentConfigUsedId *string `sqlx:"agent_config_used_id"`
ModelOverrideProvider *string `sqlx:"model_override_provider"`
ModelOverride *string `sqlx:"model_override"`
ModelParamsOverride *string `sqlx:"model_params_override"`
Message []*MessageView `view:",table=message" on:"Id:id=TurnId:turn_id" sql:"uri=conversation/message.sql"`
}
func (*TranscriptView) OnRelation ¶
func (t *TranscriptView) OnRelation(ctx context.Context)
OnRelation is invoked after related records are loaded. Ensure messages are ordered by CreatedAt ascending (oldest first) and compute Turn stage.
type UsageView ¶
type UsageView struct {
ConversationId string `sqlx:"conversation_id"`
Cost *float64 `sqlx:"cost"`
PromptTokens *int `sqlx:"prompt_tokens"`
PromptCachedTokens *int `sqlx:"prompt_cached_tokens"`
PromptAudioTokens *int `sqlx:"prompt_audio_tokens"`
CompletionTokens *int `sqlx:"completion_tokens"`
CompletionReasoningTokens *int `sqlx:"completion_reasoning_tokens"`
CompletionAudioTokens *int `sqlx:"completion_audio_tokens"`
CompletionAcceptedPredictionTokens *int `sqlx:"completion_accepted_prediction_tokens"`
CompletionRejectedPredictionTokens *int `sqlx:"completion_rejected_prediction_tokens"`
TotalTokens *int `sqlx:"total_tokens"`
Model []*ModelView `` /* 128-byte string literal not displayed */
}
type UserElicitationDataView ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.