feat: implement YAML-based configuration, .env support, and customizable prompt templates for AI analysis
This commit is contained in:
+14
-3
@@ -137,7 +137,7 @@ func (s *Server) handleCreateTarget(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
logger.Log.Infow("Triggered /targets (Create)", "component", "API", "name", name, "platform", platform)
|
||||
|
||||
_, err := s.db.CreateTarget(name, targetURL, platform)
|
||||
_, err := s.db.CreateTarget(name, targetURL, platform, true)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
@@ -232,7 +232,18 @@ func (s *Server) handleAnalyzeJob(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
logger.Log.Infow("Triggered /jobs/{id}/analyze", "component", "API", "job_id", id)
|
||||
|
||||
// Enqueue analyze task instead of synchronous processing
|
||||
job, err := s.db.GetJobByID(id)
|
||||
if err == nil && job != nil {
|
||||
filterScore := 0.0
|
||||
score := 0.0
|
||||
if job.Analysis != nil {
|
||||
filterScore = job.Analysis.FilterScore
|
||||
score = job.Analysis.Score
|
||||
}
|
||||
_ = s.db.CreateJobAnalysis(id, filterScore, score, true, "PENDING")
|
||||
}
|
||||
|
||||
// Enqueue analyze task
|
||||
payload := worker.AnalyzePayload{RawJobID: int64(id)}
|
||||
err = s.db.EnqueueTask("ANALYZE", payload)
|
||||
if err != nil {
|
||||
@@ -241,7 +252,7 @@ func (s *Server) handleAnalyzeJob(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
_, _ = w.Write([]byte(`<span class="text-xs px-2 py-1 bg-yellow-100 text-yellow-800 rounded">Analysis Queued</span>`))
|
||||
_, _ = w.Write([]byte(`<span class="text-xs px-2.5 py-1 bg-amber-500/20 text-amber-300 border border-amber-500/30 rounded-lg font-semibold">🔄 AI Queued</span>`))
|
||||
}
|
||||
|
||||
func (s *Server) handleOptOut(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user