feat: structure view in dashboard and settings persistence
- Add GET /api/claude/sessions/{session_id}/builder API for structure view
- Load builder session tags and snippets by Claude session ID
- Implement structure view in dashboard: shows tag selections and snippet details
- Add LoadSettings to persist LLM config changes across restarts
- Settings are now loaded from database on startup
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -109,6 +109,36 @@ func AutoMigrate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// LoadSettings loads persisted settings from the database into config
|
||||
func LoadSettings(cfg *config.Config) {
|
||||
// Create settings table if not exists
|
||||
DB.Exec(`CREATE TABLE IF NOT EXISTS settings (
|
||||
key_name varchar(64) NOT NULL PRIMARY KEY,
|
||||
value text NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`)
|
||||
|
||||
rows, err := DB.Query("SELECT key_name, value FROM settings")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
for rows.Next() {
|
||||
var key, value string
|
||||
if err := rows.Scan(&key, &value); err != nil {
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
case "llm_api_base_url":
|
||||
cfg.LLMAPIBaseURL = value
|
||||
case "llm_api_key":
|
||||
cfg.LLMAPIKey = value
|
||||
case "llm_model_name":
|
||||
cfg.LLMModelName = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EnsurePromptsTable creates the prompts table if it doesn't exist (for dev environments)
|
||||
func EnsurePromptsTable() {
|
||||
_, err := DB.Exec(`CREATE TABLE IF NOT EXISTS prompts (
|
||||
|
||||
Reference in New Issue
Block a user