feat: 记录任务的所有问答

This commit is contained in:
yokowu
2025-07-03 10:15:35 +08:00
parent 9fdcfe89b4
commit 7426de7ba6
34 changed files with 1095 additions and 372 deletions

View File

@@ -16,6 +16,10 @@ const (
FieldID = "id"
// FieldTaskID holds the string denoting the task_id field in the database.
FieldTaskID = "task_id"
// FieldPrompt holds the string denoting the prompt field in the database.
FieldPrompt = "prompt"
// FieldRole holds the string denoting the role field in the database.
FieldRole = "role"
// FieldCompletion holds the string denoting the completion field in the database.
FieldCompletion = "completion"
// FieldOutputTokens holds the string denoting the output_tokens field in the database.
@@ -41,6 +45,8 @@ const (
var Columns = []string{
FieldID,
FieldTaskID,
FieldPrompt,
FieldRole,
FieldCompletion,
FieldOutputTokens,
FieldCreatedAt,
@@ -79,6 +85,16 @@ func ByTaskID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTaskID, opts...).ToFunc()
}
// ByPrompt orders the results by the prompt field.
func ByPrompt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPrompt, opts...).ToFunc()
}
// ByRole orders the results by the role field.
func ByRole(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRole, opts...).ToFunc()
}
// ByCompletion orders the results by the completion field.
func ByCompletion(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCompletion, opts...).ToFunc()