Minio document json

This commit is contained in:
Mazyar
2026-05-13 18:24:45 +03:30
parent 5ab6b2714e
commit eaa681814d
2 changed files with 50 additions and 17 deletions
+24 -3
View File
@@ -1,5 +1,7 @@
package ai_summarizer
import "strings"
// SummarizeRequest represents the request payload sent to the AI service
// POST /ai/summarize endpoint for on-demand summarization.
type SummarizeRequest struct {
@@ -61,11 +63,30 @@ type TranslateResponse struct {
// TenderJSON represents the structure of the <notice_id>/tender.json file
// stored in the AI service's MinIO bucket.
type TenderJSON struct {
OverallSummary *string `json:"overall_summary"` // nil if not yet generated
SummarizeStatus SummarizeStatus `json:"summarize_status"`
OverallSummary *string `json:"overall_summary"`
OverallSummaryCamel *string `json:"overallSummary"`
SummarizeStatus SummarizeStatus `json:"summarize_status"`
SummarizeStatusCamel SummarizeStatus `json:"summarizeStatus"`
}
// resolved returns whether summarization is marked done and the best-effort
// overall summary pointer (may be nil or empty when the pipeline finished
// without text yet).
func (t *TenderJSON) resolved() (done bool, overall *string) {
done = t.SummarizeStatus.isDone() || t.SummarizeStatusCamel.isDone()
overall = t.OverallSummary
if overall == nil || strings.TrimSpace(*overall) == "" {
overall = t.OverallSummaryCamel
}
return done, overall
}
// SummarizeStatus represents the summarization status inside tender.json.
type SummarizeStatus struct {
Done bool `json:"done"` // true when the pipeline has finished
Done bool `json:"done"` // true when the pipeline has finished
DoneUpper bool `json:"Done"` // some writers emit PascalCase
}
func (s SummarizeStatus) isDone() bool {
return s.Done || s.DoneUpper
}