feat: implement YAML-based configuration, .env support, and customizable prompt templates for AI analysis

This commit is contained in:
2026-08-22 10:17:38 -07:00
parent 7ec91f384f
commit 0de312edbd
30 changed files with 895 additions and 211 deletions
+37
View File
@@ -62,8 +62,10 @@ func (db *DB) migrate() error {
CREATE TABLE IF NOT EXISTS job_analyses (
id INTEGER PRIMARY KEY AUTOINCREMENT,
raw_job_id INTEGER UNIQUE NOT NULL REFERENCES raw_jobs(id) ON DELETE CASCADE,
filter_score REAL DEFAULT 0.0,
score REAL DEFAULT 0.0,
is_qualified BOOLEAN NOT NULL DEFAULT 0,
summary TEXT,
matched_highlights JSON,
missing_highlights JSON,
tailoring_suggestions JSON,
@@ -125,5 +127,40 @@ func (db *DB) migrate() error {
}
}
// Dynamic migration for job_analyses: check if filter_score and summary exist
var hasFilterScore, hasSummary bool
rowsA, err := db.Query(`PRAGMA table_info(job_analyses)`)
if err == nil {
for rowsA.Next() {
var cid int
var name, ctype string
var notnull, pk int
var dfltValue sql.NullString
if err := rowsA.Scan(&cid, &name, &ctype, &notnull, &dfltValue, &pk); err == nil {
if name == "filter_score" {
hasFilterScore = true
}
if name == "summary" {
hasSummary = true
}
}
}
_ = rowsA.Close()
}
if !hasFilterScore {
if _, err := db.Exec(`ALTER TABLE job_analyses ADD COLUMN filter_score REAL DEFAULT 0.0`); err != nil {
logger.Log.Warnw("Failed to add filter_score column", "component", "DB", "error", err)
} else {
_, _ = db.Exec(`UPDATE job_analyses SET filter_score = score WHERE filter_score IS NULL OR filter_score = 0.0`)
}
}
if !hasSummary {
if _, err := db.Exec(`ALTER TABLE job_analyses ADD COLUMN summary TEXT`); err != nil {
logger.Log.Warnw("Failed to add summary column", "component", "DB", "error", err)
}
}
return nil
}