|
|
|
@@ -4816,7 +4816,7 @@ WHERE
|
|
|
|
|
$3::int
|
|
|
|
|
)
|
|
|
|
|
RETURNING
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type AcquireChatsParams struct {
|
|
|
|
@@ -4863,6 +4863,7 @@ func (q *sqlQuerier) AcquireChats(ctx context.Context, arg AcquireChatsParams) (
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@@ -5001,9 +5002,9 @@ WITH chats AS (
|
|
|
|
|
UPDATE chats
|
|
|
|
|
SET archived = true, pin_order = 0, updated_at = NOW()
|
|
|
|
|
WHERE id = $1::uuid OR root_chat_id = $1::uuid
|
|
|
|
|
RETURNING id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
RETURNING id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
)
|
|
|
|
|
SELECT id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
SELECT id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
FROM chats
|
|
|
|
|
ORDER BY (id = $1::uuid) DESC, created_at ASC, id ASC
|
|
|
|
|
`
|
|
|
|
@@ -5044,6 +5045,7 @@ func (q *sqlQuerier) ArchiveChatByID(ctx context.Context, id uuid.UUID) ([]Chat,
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@@ -5193,7 +5195,7 @@ func (q *sqlQuerier) DeleteOldChats(ctx context.Context, arg DeleteOldChatsParam
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getActiveChatsByAgentID = `-- name: GetActiveChatsByAgentID :many
|
|
|
|
|
SELECT id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
SELECT id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
FROM chats
|
|
|
|
|
WHERE agent_id = $1::uuid
|
|
|
|
|
AND archived = false
|
|
|
|
@@ -5240,6 +5242,7 @@ func (q *sqlQuerier) GetActiveChatsByAgentID(ctx context.Context, agentID uuid.U
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@@ -5256,7 +5259,7 @@ func (q *sqlQuerier) GetActiveChatsByAgentID(ctx context.Context, agentID uuid.U
|
|
|
|
|
|
|
|
|
|
const getChatByID = `-- name: GetChatByID :one
|
|
|
|
|
SELECT
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
FROM
|
|
|
|
|
chats
|
|
|
|
|
WHERE
|
|
|
|
@@ -5293,12 +5296,13 @@ func (q *sqlQuerier) GetChatByID(ctx context.Context, id uuid.UUID) (Chat, error
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getChatByIDForUpdate = `-- name: GetChatByIDForUpdate :one
|
|
|
|
|
SELECT id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode FROM chats WHERE id = $1::uuid FOR UPDATE
|
|
|
|
|
SELECT id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type FROM chats WHERE id = $1::uuid FOR UPDATE
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
func (q *sqlQuerier) GetChatByIDForUpdate(ctx context.Context, id uuid.UUID) (Chat, error) {
|
|
|
|
@@ -5331,6 +5335,7 @@ func (q *sqlQuerier) GetChatByIDForUpdate(ctx context.Context, id uuid.UUID) (Ch
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@@ -6385,7 +6390,7 @@ func (q *sqlQuerier) GetChatUsageLimitUserOverride(ctx context.Context, userID u
|
|
|
|
|
|
|
|
|
|
const getChats = `-- name: GetChats :many
|
|
|
|
|
SELECT
|
|
|
|
|
chats.id, chats.owner_id, chats.workspace_id, chats.title, chats.status, chats.worker_id, chats.started_at, chats.heartbeat_at, chats.created_at, chats.updated_at, chats.parent_chat_id, chats.root_chat_id, chats.last_model_config_id, chats.archived, chats.last_error, chats.mode, chats.mcp_server_ids, chats.labels, chats.build_id, chats.agent_id, chats.pin_order, chats.last_read_message_id, chats.last_injected_context, chats.dynamic_tools, chats.organization_id, chats.plan_mode,
|
|
|
|
|
chats.id, chats.owner_id, chats.workspace_id, chats.title, chats.status, chats.worker_id, chats.started_at, chats.heartbeat_at, chats.created_at, chats.updated_at, chats.parent_chat_id, chats.root_chat_id, chats.last_model_config_id, chats.archived, chats.last_error, chats.mode, chats.mcp_server_ids, chats.labels, chats.build_id, chats.agent_id, chats.pin_order, chats.last_read_message_id, chats.last_injected_context, chats.dynamic_tools, chats.organization_id, chats.plan_mode, chats.client_type,
|
|
|
|
|
EXISTS (
|
|
|
|
|
SELECT 1 FROM chat_messages cm
|
|
|
|
|
WHERE cm.chat_id = chats.id
|
|
|
|
@@ -6500,6 +6505,7 @@ func (q *sqlQuerier) GetChats(ctx context.Context, arg GetChatsParams) ([]GetCha
|
|
|
|
|
&i.Chat.DynamicTools,
|
|
|
|
|
&i.Chat.OrganizationID,
|
|
|
|
|
&i.Chat.PlanMode,
|
|
|
|
|
&i.Chat.ClientType,
|
|
|
|
|
&i.HasUnread,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
@@ -6516,7 +6522,7 @@ func (q *sqlQuerier) GetChats(ctx context.Context, arg GetChatsParams) ([]GetCha
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getChatsByWorkspaceIDs = `-- name: GetChatsByWorkspaceIDs :many
|
|
|
|
|
SELECT id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
SELECT id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
FROM chats
|
|
|
|
|
WHERE archived = false
|
|
|
|
|
AND workspace_id = ANY($1::uuid[])
|
|
|
|
@@ -6559,6 +6565,7 @@ func (q *sqlQuerier) GetChatsByWorkspaceIDs(ctx context.Context, ids []uuid.UUID
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@@ -6578,23 +6585,24 @@ SELECT
|
|
|
|
|
id, owner_id, created_at, updated_at, status,
|
|
|
|
|
(parent_chat_id IS NOT NULL)::bool AS has_parent,
|
|
|
|
|
root_chat_id, workspace_id,
|
|
|
|
|
mode, archived, last_model_config_id
|
|
|
|
|
mode, archived, last_model_config_id, client_type
|
|
|
|
|
FROM chats
|
|
|
|
|
WHERE updated_at > $1
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type GetChatsUpdatedAfterRow struct {
|
|
|
|
|
ID uuid.UUID `db:"id" json:"id"`
|
|
|
|
|
OwnerID uuid.UUID `db:"owner_id" json:"owner_id"`
|
|
|
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
|
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
|
|
|
Status ChatStatus `db:"status" json:"status"`
|
|
|
|
|
HasParent bool `db:"has_parent" json:"has_parent"`
|
|
|
|
|
RootChatID uuid.NullUUID `db:"root_chat_id" json:"root_chat_id"`
|
|
|
|
|
WorkspaceID uuid.NullUUID `db:"workspace_id" json:"workspace_id"`
|
|
|
|
|
Mode NullChatMode `db:"mode" json:"mode"`
|
|
|
|
|
Archived bool `db:"archived" json:"archived"`
|
|
|
|
|
LastModelConfigID uuid.UUID `db:"last_model_config_id" json:"last_model_config_id"`
|
|
|
|
|
ID uuid.UUID `db:"id" json:"id"`
|
|
|
|
|
OwnerID uuid.UUID `db:"owner_id" json:"owner_id"`
|
|
|
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
|
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
|
|
|
Status ChatStatus `db:"status" json:"status"`
|
|
|
|
|
HasParent bool `db:"has_parent" json:"has_parent"`
|
|
|
|
|
RootChatID uuid.NullUUID `db:"root_chat_id" json:"root_chat_id"`
|
|
|
|
|
WorkspaceID uuid.NullUUID `db:"workspace_id" json:"workspace_id"`
|
|
|
|
|
Mode NullChatMode `db:"mode" json:"mode"`
|
|
|
|
|
Archived bool `db:"archived" json:"archived"`
|
|
|
|
|
LastModelConfigID uuid.UUID `db:"last_model_config_id" json:"last_model_config_id"`
|
|
|
|
|
ClientType ChatClientType `db:"client_type" json:"client_type"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Retrieves chats updated after the given timestamp for telemetry
|
|
|
|
@@ -6621,6 +6629,7 @@ func (q *sqlQuerier) GetChatsUpdatedAfter(ctx context.Context, updatedAfter time
|
|
|
|
|
&i.Mode,
|
|
|
|
|
&i.Archived,
|
|
|
|
|
&i.LastModelConfigID,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@@ -6686,7 +6695,7 @@ func (q *sqlQuerier) GetLastChatMessageByRole(ctx context.Context, arg GetLastCh
|
|
|
|
|
|
|
|
|
|
const getStaleChats = `-- name: GetStaleChats :many
|
|
|
|
|
SELECT
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
FROM
|
|
|
|
|
chats
|
|
|
|
|
WHERE
|
|
|
|
@@ -6736,6 +6745,7 @@ func (q *sqlQuerier) GetStaleChats(ctx context.Context, staleThreshold time.Time
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@@ -6828,7 +6838,8 @@ INSERT INTO chats (
|
|
|
|
|
status,
|
|
|
|
|
mcp_server_ids,
|
|
|
|
|
labels,
|
|
|
|
|
dynamic_tools
|
|
|
|
|
dynamic_tools,
|
|
|
|
|
client_type
|
|
|
|
|
) VALUES (
|
|
|
|
|
$1::uuid,
|
|
|
|
|
$2::uuid,
|
|
|
|
@@ -6844,10 +6855,11 @@ INSERT INTO chats (
|
|
|
|
|
$12::chat_status,
|
|
|
|
|
COALESCE($13::uuid[], '{}'::uuid[]),
|
|
|
|
|
COALESCE($14::jsonb, '{}'::jsonb),
|
|
|
|
|
$15::jsonb
|
|
|
|
|
$15::jsonb,
|
|
|
|
|
$16::chat_client_type
|
|
|
|
|
)
|
|
|
|
|
RETURNING
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type InsertChatParams struct {
|
|
|
|
@@ -6866,6 +6878,7 @@ type InsertChatParams struct {
|
|
|
|
|
MCPServerIDs []uuid.UUID `db:"mcp_server_ids" json:"mcp_server_ids"`
|
|
|
|
|
Labels pqtype.NullRawMessage `db:"labels" json:"labels"`
|
|
|
|
|
DynamicTools pqtype.NullRawMessage `db:"dynamic_tools" json:"dynamic_tools"`
|
|
|
|
|
ClientType ChatClientType `db:"client_type" json:"client_type"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (q *sqlQuerier) InsertChat(ctx context.Context, arg InsertChatParams) (Chat, error) {
|
|
|
|
@@ -6885,6 +6898,7 @@ func (q *sqlQuerier) InsertChat(ctx context.Context, arg InsertChatParams) (Chat
|
|
|
|
|
pq.Array(arg.MCPServerIDs),
|
|
|
|
|
arg.Labels,
|
|
|
|
|
arg.DynamicTools,
|
|
|
|
|
arg.ClientType,
|
|
|
|
|
)
|
|
|
|
|
var i Chat
|
|
|
|
|
err := row.Scan(
|
|
|
|
@@ -6914,6 +6928,7 @@ func (q *sqlQuerier) InsertChat(ctx context.Context, arg InsertChatParams) (Chat
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@@ -7442,9 +7457,9 @@ WITH chats AS (
|
|
|
|
|
archived = false,
|
|
|
|
|
updated_at = NOW()
|
|
|
|
|
WHERE id = $1::uuid OR root_chat_id = $1::uuid
|
|
|
|
|
RETURNING id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
RETURNING id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
)
|
|
|
|
|
SELECT id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
SELECT id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
FROM chats
|
|
|
|
|
ORDER BY (id = $1::uuid) DESC, created_at ASC, id ASC
|
|
|
|
|
`
|
|
|
|
@@ -7489,6 +7504,7 @@ func (q *sqlQuerier) UnarchiveChatByID(ctx context.Context, id uuid.UUID) ([]Cha
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@@ -7569,7 +7585,7 @@ UPDATE chats SET
|
|
|
|
|
updated_at = NOW()
|
|
|
|
|
WHERE
|
|
|
|
|
id = $3::uuid
|
|
|
|
|
RETURNING id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
RETURNING id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type UpdateChatBuildAgentBindingParams struct {
|
|
|
|
@@ -7608,6 +7624,7 @@ func (q *sqlQuerier) UpdateChatBuildAgentBinding(ctx context.Context, arg Update
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@@ -7621,7 +7638,7 @@ SET
|
|
|
|
|
WHERE
|
|
|
|
|
id = $2::uuid
|
|
|
|
|
RETURNING
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type UpdateChatByIDParams struct {
|
|
|
|
@@ -7659,6 +7676,7 @@ func (q *sqlQuerier) UpdateChatByID(ctx context.Context, arg UpdateChatByIDParam
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@@ -7717,7 +7735,7 @@ SET
|
|
|
|
|
WHERE
|
|
|
|
|
id = $2::uuid
|
|
|
|
|
RETURNING
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type UpdateChatLabelsByIDParams struct {
|
|
|
|
@@ -7755,6 +7773,7 @@ func (q *sqlQuerier) UpdateChatLabelsByID(ctx context.Context, arg UpdateChatLab
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@@ -7764,7 +7783,7 @@ UPDATE chats SET
|
|
|
|
|
last_injected_context = $1::jsonb
|
|
|
|
|
WHERE
|
|
|
|
|
id = $2::uuid
|
|
|
|
|
RETURNING id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
RETURNING id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type UpdateChatLastInjectedContextParams struct {
|
|
|
|
@@ -7806,6 +7825,7 @@ func (q *sqlQuerier) UpdateChatLastInjectedContext(ctx context.Context, arg Upda
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@@ -7819,7 +7839,7 @@ SET
|
|
|
|
|
WHERE
|
|
|
|
|
id = $2::uuid
|
|
|
|
|
RETURNING
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type UpdateChatLastModelConfigByIDParams struct {
|
|
|
|
@@ -7857,6 +7877,7 @@ func (q *sqlQuerier) UpdateChatLastModelConfigByID(ctx context.Context, arg Upda
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@@ -7888,7 +7909,7 @@ SET
|
|
|
|
|
WHERE
|
|
|
|
|
id = $2::uuid
|
|
|
|
|
RETURNING
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type UpdateChatMCPServerIDsParams struct {
|
|
|
|
@@ -7926,6 +7947,7 @@ func (q *sqlQuerier) UpdateChatMCPServerIDs(ctx context.Context, arg UpdateChatM
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@@ -8057,7 +8079,7 @@ SET
|
|
|
|
|
WHERE
|
|
|
|
|
id = $2::uuid
|
|
|
|
|
RETURNING
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type UpdateChatPlanModeByIDParams struct {
|
|
|
|
@@ -8095,6 +8117,7 @@ func (q *sqlQuerier) UpdateChatPlanModeByID(ctx context.Context, arg UpdateChatP
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@@ -8112,7 +8135,7 @@ SET
|
|
|
|
|
WHERE
|
|
|
|
|
id = $6::uuid
|
|
|
|
|
RETURNING
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type UpdateChatStatusParams struct {
|
|
|
|
@@ -8161,6 +8184,7 @@ func (q *sqlQuerier) UpdateChatStatus(ctx context.Context, arg UpdateChatStatusP
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@@ -8178,7 +8202,7 @@ SET
|
|
|
|
|
WHERE
|
|
|
|
|
id = $7::uuid
|
|
|
|
|
RETURNING
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type UpdateChatStatusPreserveUpdatedAtParams struct {
|
|
|
|
@@ -8229,6 +8253,7 @@ func (q *sqlQuerier) UpdateChatStatusPreserveUpdatedAt(ctx context.Context, arg
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@@ -8240,7 +8265,7 @@ UPDATE chats SET
|
|
|
|
|
agent_id = $3::uuid,
|
|
|
|
|
updated_at = NOW()
|
|
|
|
|
WHERE id = $4::uuid
|
|
|
|
|
RETURNING id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode
|
|
|
|
|
RETURNING id, owner_id, workspace_id, title, status, worker_id, started_at, heartbeat_at, created_at, updated_at, parent_chat_id, root_chat_id, last_model_config_id, archived, last_error, mode, mcp_server_ids, labels, build_id, agent_id, pin_order, last_read_message_id, last_injected_context, dynamic_tools, organization_id, plan_mode, client_type
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type UpdateChatWorkspaceBindingParams struct {
|
|
|
|
@@ -8285,6 +8310,7 @@ func (q *sqlQuerier) UpdateChatWorkspaceBinding(ctx context.Context, arg UpdateC
|
|
|
|
|
&i.DynamicTools,
|
|
|
|
|
&i.OrganizationID,
|
|
|
|
|
&i.PlanMode,
|
|
|
|
|
&i.ClientType,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
|