feat: 支持 UserPromptSubmit 事件,将 prompt 存入 MySQL
- 新增 db.go:MySQL 连接管理、自动建表、兼容旧表 ALTER - handler.go:处理 UserPromptSubmit,从 cwd 提取项目名称 - main.go:可选初始化 MySQL,优雅关闭释放连接 - config.go:新增 MYSQL_DSN 配置项 - 表结构:session_id + project_name + prompt + created_at
This commit is contained in:
@@ -15,6 +15,7 @@ type Config struct {
|
||||
GotifyURL string
|
||||
GotifyToken string
|
||||
Port string
|
||||
MySQLDSN string // MySQL 连接串,留空则不启用数据库记录
|
||||
}
|
||||
|
||||
func LoadConfig() Config {
|
||||
@@ -22,6 +23,7 @@ func LoadConfig() Config {
|
||||
GotifyURL: getEnv("GOTIFY_URL", ""),
|
||||
GotifyToken: getEnv("GOTIFY_TOKEN", ""),
|
||||
Port: getEnv("PORT", ":8082"),
|
||||
MySQLDSN: getEnv("MYSQL_DSN", ""),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user