You've already forked agentic-coding-workflow
主流程
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
const getConversation = `-- name: GetConversation :one
|
||||
SELECT id, user_id, project_id, workspace_id, issue_id, model_id, system_prompt, title, title_generated_at, created_at, updated_at, deleted_at FROM conversations WHERE id = $1 AND deleted_at IS NULL
|
||||
SELECT id, user_id, project_id, workspace_id, issue_id, model_id, system_prompt, title, title_generated_at, created_at, updated_at, deleted_at, requirement_id FROM conversations WHERE id = $1 AND deleted_at IS NULL
|
||||
`
|
||||
|
||||
func (q *Queries) GetConversation(ctx context.Context, id pgtype.UUID) (Conversation, error) {
|
||||
@@ -31,25 +31,27 @@ func (q *Queries) GetConversation(ctx context.Context, id pgtype.UUID) (Conversa
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.DeletedAt,
|
||||
&i.RequirementID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const insertConversation = `-- name: InsertConversation :one
|
||||
INSERT INTO conversations (id, user_id, project_id, workspace_id, issue_id, model_id, system_prompt, title)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
RETURNING id, user_id, project_id, workspace_id, issue_id, model_id, system_prompt, title, title_generated_at, created_at, updated_at, deleted_at
|
||||
INSERT INTO conversations (id, user_id, project_id, workspace_id, issue_id, model_id, system_prompt, title, requirement_id)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
||||
RETURNING id, user_id, project_id, workspace_id, issue_id, model_id, system_prompt, title, title_generated_at, created_at, updated_at, deleted_at, requirement_id
|
||||
`
|
||||
|
||||
type InsertConversationParams struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
UserID pgtype.UUID `json:"user_id"`
|
||||
ProjectID pgtype.UUID `json:"project_id"`
|
||||
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
||||
IssueID pgtype.UUID `json:"issue_id"`
|
||||
ModelID pgtype.UUID `json:"model_id"`
|
||||
SystemPrompt string `json:"system_prompt"`
|
||||
Title *string `json:"title"`
|
||||
ID pgtype.UUID `json:"id"`
|
||||
UserID pgtype.UUID `json:"user_id"`
|
||||
ProjectID pgtype.UUID `json:"project_id"`
|
||||
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
||||
IssueID pgtype.UUID `json:"issue_id"`
|
||||
ModelID pgtype.UUID `json:"model_id"`
|
||||
SystemPrompt string `json:"system_prompt"`
|
||||
Title *string `json:"title"`
|
||||
RequirementID pgtype.UUID `json:"requirement_id"`
|
||||
}
|
||||
|
||||
func (q *Queries) InsertConversation(ctx context.Context, arg InsertConversationParams) (Conversation, error) {
|
||||
@@ -62,6 +64,7 @@ func (q *Queries) InsertConversation(ctx context.Context, arg InsertConversation
|
||||
arg.ModelID,
|
||||
arg.SystemPrompt,
|
||||
arg.Title,
|
||||
arg.RequirementID,
|
||||
)
|
||||
var i Conversation
|
||||
err := row.Scan(
|
||||
@@ -77,19 +80,21 @@ func (q *Queries) InsertConversation(ctx context.Context, arg InsertConversation
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.DeletedAt,
|
||||
&i.RequirementID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const listConversationsByUser = `-- name: ListConversationsByUser :many
|
||||
SELECT id, user_id, project_id, workspace_id, issue_id, model_id, system_prompt, title, title_generated_at, created_at, updated_at, deleted_at FROM conversations
|
||||
SELECT id, user_id, project_id, workspace_id, issue_id, model_id, system_prompt, title, title_generated_at, created_at, updated_at, deleted_at, requirement_id FROM conversations
|
||||
WHERE user_id = $1 AND deleted_at IS NULL
|
||||
AND ($2::uuid IS NULL OR project_id = $2)
|
||||
AND ($3::uuid IS NULL OR workspace_id = $3)
|
||||
AND ($4::uuid IS NULL OR issue_id = $4)
|
||||
AND ($5::text = '' OR title ILIKE '%' || $5 || '%')
|
||||
AND ($5::uuid IS NULL OR requirement_id = $5)
|
||||
AND ($6::text = '' OR title ILIKE '%' || $6 || '%')
|
||||
ORDER BY updated_at DESC
|
||||
LIMIT $6
|
||||
LIMIT $7
|
||||
`
|
||||
|
||||
type ListConversationsByUserParams struct {
|
||||
@@ -97,7 +102,8 @@ type ListConversationsByUserParams struct {
|
||||
Column2 pgtype.UUID `json:"column_2"`
|
||||
Column3 pgtype.UUID `json:"column_3"`
|
||||
Column4 pgtype.UUID `json:"column_4"`
|
||||
Column5 string `json:"column_5"`
|
||||
Column5 pgtype.UUID `json:"column_5"`
|
||||
Column6 string `json:"column_6"`
|
||||
Limit int32 `json:"limit"`
|
||||
}
|
||||
|
||||
@@ -108,6 +114,7 @@ func (q *Queries) ListConversationsByUser(ctx context.Context, arg ListConversat
|
||||
arg.Column3,
|
||||
arg.Column4,
|
||||
arg.Column5,
|
||||
arg.Column6,
|
||||
arg.Limit,
|
||||
)
|
||||
if err != nil {
|
||||
@@ -130,6 +137,7 @@ func (q *Queries) ListConversationsByUser(ctx context.Context, arg ListConversat
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.DeletedAt,
|
||||
&i.RequirementID,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user