blob: bdb11e673709c42a57a155b7f4baa8520608b10b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Data models for prompt storage (templates with arguments).
package promptstore
import "time"
// Prompt represents a reusable prompt template with arguments.
// Prompts are stored in JSONL format and can be rendered with user-provided arguments.
type Prompt struct {
Name string `json:"name"` // Unique identifier (alphanumeric + underscores)
Title string `json:"title"` // Display name
Description string `json:"description"` // Human-readable description
Arguments []PromptArgument `json:"arguments"` // Template variables
Messages []PromptMessage `json:"messages"` // Conversation messages
Tags []string `json:"tags"` // Categorization tags
Created time.Time `json:"created"` // Creation timestamp
Updated time.Time `json:"updated"` // Last update timestamp
}
// PromptArgument defines a template variable that can be substituted in messages.
// Used for parameterized prompts like "review {{code}}" where {{code}} is an argument.
type PromptArgument struct {
Name string `json:"name"` // Variable name (used in {{name}})
Description string `json:"description"` // Human-readable description
Required bool `json:"required"` // Whether argument is required
}
// PromptMessage represents a single message in a conversation.
// Messages can be from user or assistant roles and contain text content.
type PromptMessage struct {
Role string `json:"role"` // "user" or "assistant"
Content MessageContent `json:"content"` // Message content
}
// MessageContent contains the actual message data.
// Currently supports text content; extensible for images/resources in future.
type MessageContent struct {
Type string `json:"type"` // "text", "image", "resource"
Text string `json:"text,omitempty"`
}
|