Refactor constants.go: improve organization and alignment

This commit is contained in:
Jeffrey Paul 2025-05-22 10:48:20 -07:00
parent 15d16938dc
commit 015ffef17c

View File

@ -4,18 +4,49 @@ import (
"time" "time"
) )
// Database constants // Application constants
const ( const (
// Database
dbPath = "articles.db" dbPath = "articles.db"
)
// LLM constants
const (
// LLM system prompt // LLM system prompt
SYSTEM_PROMPT = "You are a news analyst." SYSTEM_PROMPT = "You are a news analyst."
// LLM batch processing settings
BATCH_SIZE = 5
MAX_INDIVIDUAL_PROCESSING = 50
// Timing constants
RSS_CHECK_INTERVAL = 15 * time.Minute
SUMMARIZE_INTERVAL = 10 * time.Second
BROADCAST_INTERVAL = 1 * time.Hour
BROADCAST_CHECK_INTERVAL = 10 * time.Second // Interval to check if broadcasting is needed
DEVICE_REBOOT_INTERVAL = 6 * time.Hour // Interval to reboot Meshtastic device
STARTUP_DELAY = 60 * time.Second // Delay before first broadcast
BROADCAST_PREPARATION_DELAY = 30 * time.Second // Delay before executing broadcast command
ARTICLE_FRESHNESS_WINDOW = 24 * time.Hour // Time window for considering articles fresh
// Message limits
MAX_MESSAGE_LENGTH = 200 // Maximum length of broadcast messages in characters
MAX_LOG_ENTRIES = 1000 // Maximum number of log entries to keep in memory
)
// ANSI color codes for colorized logging
const (
colorReset = "\033[0m"
colorRed = "\033[31m"
colorGreen = "\033[32m"
colorYellow = "\033[33m"
colorBlue = "\033[34m"
colorPurple = "\033[35m"
colorCyan = "\033[36m"
colorGray = "\033[37m"
colorWhite = "\033[97m"
bold = "\033[1m"
)
// Main LLM prompt for article summarization // Main LLM prompt for article summarization
ARTICLES_PROMPT = `Summarize each of these news items in under 165 const ARTICLES_PROMPT = `Summarize each of these news items in under 165
characters, optimizing for information density (common news headline characters, optimizing for information density (common news headline
abbreviations OK) and rate their importance from 1 to 100. abbreviations OK) and rate their importance from 1 to 100.
@ -47,43 +78,6 @@ fields. Return your response as a JSON array of objects like: [{"id":
Here are the articles: Here are the articles:
` `
// LLM batch processing settings
BATCH_SIZE = 5
MAX_INDIVIDUAL_PROCESSING = 50
)
// Timing constants
const (
RSS_CHECK_INTERVAL = 15 * time.Minute
SUMMARIZE_INTERVAL = 10 * time.Second
BROADCAST_INTERVAL = 1 * time.Hour
BROADCAST_CHECK_INTERVAL = 10 * time.Second // Interval to check if broadcasting is needed
DEVICE_REBOOT_INTERVAL = 6 * time.Hour // Interval to reboot Meshtastic device
STARTUP_DELAY = 60 * time.Second // Delay before first broadcast
BROADCAST_PREPARATION_DELAY = 30 * time.Second // Delay before executing broadcast command
ARTICLE_FRESHNESS_WINDOW = 24 * time.Hour // Time window for considering articles fresh
)
// Message constants
const (
MAX_MESSAGE_LENGTH = 200 // Maximum length of broadcast messages in characters
MAX_LOG_ENTRIES = 1000 // Maximum number of log entries to keep in memory
)
// ANSI color codes for colorized logging
const (
colorReset = "\033[0m"
colorRed = "\033[31m"
colorGreen = "\033[32m"
colorYellow = "\033[33m"
colorBlue = "\033[34m"
colorPurple = "\033[35m"
colorCyan = "\033[36m"
colorGray = "\033[37m"
colorWhite = "\033[97m"
bold = "\033[1m"
)
// Map of source names to their abbreviations // Map of source names to their abbreviations
var sourceAbbreviations = map[string]string{ var sourceAbbreviations = map[string]string{
"BBC": "BBC", "BBC": "BBC",