Documentation
¶
Overview ¶
Package api provides HTTP handlers and the main API server logic for PromptPipe.
It exposes RESTful endpoints for scheduling, sending, and tracking WhatsApp prompts. The API integrates with the WhatsApp, timer, and store modules.
Package api provides conversation participant management handlers for PromptPipe endpoints.
Package api provides HTTP handlers for PromptPipe endpoints.
Package api provides HTTP response utilities for PromptPipe.
Index ¶
- Constants
- func Run(waOpts []whatsapp.Option, storeOpts []store.Option, genaiOpts []genai.Option, ...) error
- type ContextKey
- type Option
- func WithAddr(addr string) Option
- func WithAutoFeedbackAfterPromptEnabled(enabled bool) Option
- func WithChatHistoryLimit(limit int) Option
- func WithDebugMode(enabled bool) Option
- func WithDefaultCron(cron string) Option
- func WithDefaultSchedule(schedule *models.Schedule) Option
- func WithFeedbackFollowupDelay(delay string) Option
- func WithFeedbackInitialTimeout(timeout string) Option
- func WithFeedbackTrackerPromptFile(filePath string) Option
- func WithIntakeBotPromptFile(filePath string) Option
- func WithPromptGeneratorPromptFile(filePath string) Option
- func WithSchedulerPrepTimeMinutes(minutes int) Option
- type Opts
- type Server
Constants ¶
const ( // DefaultServerAddress is the default HTTP server address DefaultServerAddress = ":8080" // DefaultShutdownTimeout is the default timeout for graceful server shutdown DefaultShutdownTimeout = 5 * time.Second // DefaultScheduledJobTimeout is the default timeout for scheduled job operations DefaultScheduledJobTimeout = 30 * time.Second )
Default configuration constants
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContextKey ¶
type ContextKey string
ContextKey is a custom type for context keys to avoid collisions
const ( // ContextKeyParticipantID is the context key for participant ID ContextKeyParticipantID ContextKey = "participantID" )
type Option ¶
type Option func(*Opts)
Option defines a configuration option for the API server.
func WithAutoFeedbackAfterPromptEnabled ¶
WithAutoFeedbackAfterPromptEnabled enables/disables auto feedback enforcement after scheduled prompts.
func WithChatHistoryLimit ¶
WithChatHistoryLimit sets the limit for number of history messages sent to bot tools. -1: no limit, 0: no history, positive: limit to last N messages
func WithDebugMode ¶
WithDebugMode enables debug mode for user-facing debug messages.
func WithDefaultCron ¶
WithDefaultCron overrides the default schedule for prompts using a cron-like format. This is a compatibility function that converts cron string to Schedule struct.
func WithDefaultSchedule ¶
WithDefaultSchedule overrides the default schedule for prompts.
func WithFeedbackFollowupDelay ¶
WithFeedbackFollowupDelay sets the delay before follow-up feedback session.
func WithFeedbackInitialTimeout ¶
WithFeedbackInitialTimeout sets the timeout for initial feedback response.
func WithFeedbackTrackerPromptFile ¶
WithFeedbackTrackerPromptFile sets the path to the feedback tracker system prompt file.
func WithIntakeBotPromptFile ¶
WithIntakeBotPromptFile sets the path to the intake bot system prompt file.
func WithPromptGeneratorPromptFile ¶
WithPromptGeneratorPromptFile sets the path to the prompt generator system prompt file.
func WithSchedulerPrepTimeMinutes ¶
WithSchedulerPrepTimeMinutes sets the preparation time in minutes before scheduled habit reminders.
type Opts ¶
type Opts struct { Addr string // overrides API_ADDR DefaultSchedule *models.Schedule // overrides DEFAULT_SCHEDULE IntakeBotPromptFile string // path to intake bot system prompt file PromptGeneratorPromptFile string // path to prompt generator system prompt file FeedbackTrackerPromptFile string // path to feedback tracker system prompt file ChatHistoryLimit int // limit for number of history messages sent to bot tools FeedbackInitialTimeout string // timeout for initial feedback response FeedbackFollowupDelay string // delay before follow-up feedback session DebugMode bool // enable debug mode for user-facing debug messages SchedulerPrepTimeMinutes int // preparation time in minutes before scheduled habit reminders AutoFeedbackAfterPromptEnabled bool // enable auto feedback session enforcement after scheduled prompt inactivity }
Opts holds configuration options for the API server, such as HTTP address and default schedule.