overalSummary nil response

This commit is contained in:
Mazyar
2026-05-12 12:25:09 +03:30
parent 7c42b343ce
commit 0a7fdd1328
3 changed files with 77 additions and 64 deletions
+50 -48
View File
@@ -66,30 +66,31 @@ type SearchResponse struct {
// TenderResponse represents a tender in API responses
type TenderResponse struct {
ID string `json:"id"`
NoticePublicationID string `json:"notice_publication_id"`
NoticeTypeCode string `json:"notice_type_code"`
Title string `json:"title"`
Description string `json:"description"`
ProcurementTypeCode string `json:"procurement_type_code"`
ProcedureCode string `json:"procedure_code"`
MainClassification string `json:"main_classification"`
EstimatedValue float64 `json:"estimated_value"`
Currency string `json:"currency"`
Duration string `json:"duration"`
DurationUnit string `json:"duration_unit"`
PublicationDate int64 `json:"publication_date"`
TenderDeadline int64 `json:"tender_deadline"`
SubmissionDeadline int64 `json:"submission_deadline"`
ApplicationDeadline int64 `json:"application_deadline"`
SubmissionURL string `json:"submission_url"`
CountryCode string `json:"country_code"`
BuyerOrganization *OrganizationResponse `json:"buyer_organization"`
Status TenderStatus `json:"status"`
TenderID string `json:"tender_id"`
CreatedAt int64 `json:"created_at"`
OverallSummary string `json:"overall_summary,omitempty"` // AI-generated summary from the pipeline
Language string `json:"language,omitempty"`
ID string `json:"id"`
NoticePublicationID string `json:"notice_publication_id"`
RelatedNoticePublicationIDs []string `json:"related_notice_publication_ids,omitempty"`
NoticeTypeCode string `json:"notice_type_code"`
Title string `json:"title"`
Description string `json:"description"`
ProcurementTypeCode string `json:"procurement_type_code"`
ProcedureCode string `json:"procedure_code"`
MainClassification string `json:"main_classification"`
EstimatedValue float64 `json:"estimated_value"`
Currency string `json:"currency"`
Duration string `json:"duration"`
DurationUnit string `json:"duration_unit"`
PublicationDate int64 `json:"publication_date"`
TenderDeadline int64 `json:"tender_deadline"`
SubmissionDeadline int64 `json:"submission_deadline"`
ApplicationDeadline int64 `json:"application_deadline"`
SubmissionURL string `json:"submission_url"`
CountryCode string `json:"country_code"`
BuyerOrganization *OrganizationResponse `json:"buyer_organization"`
Status TenderStatus `json:"status"`
TenderID string `json:"tender_id"`
CreatedAt int64 `json:"created_at"`
OverallSummary string `json:"overall_summary,omitempty"` // AI-generated summary from the pipeline
Language string `json:"language,omitempty"`
}
// TenderDocumentResponse represents a scraped tender document available for download.
@@ -135,29 +136,30 @@ func (t *Tender) ToResponseWithLanguage(language string) *TenderResponse {
}
response := &TenderResponse{
ID: t.ID.Hex(),
NoticePublicationID: t.NoticePublicationID,
NoticeTypeCode: t.NoticeTypeCode,
Title: title,
Description: description,
ProcurementTypeCode: t.ProcurementTypeCode,
ProcedureCode: t.ProcedureCode,
MainClassification: t.MainClassification,
EstimatedValue: t.EstimatedValue,
Currency: t.Currency,
Duration: t.Duration,
DurationUnit: t.DurationUnit,
PublicationDate: t.PublicationDate,
TenderDeadline: t.TenderDeadline,
SubmissionDeadline: t.SubmissionDeadline,
ApplicationDeadline: t.ApplicationDeadline,
CountryCode: t.CountryCode,
SubmissionURL: t.SubmissionURL,
BuyerOrganization: org,
Status: t.Status,
TenderID: t.TenderID,
CreatedAt: t.CreatedAt,
Language: usedLanguage,
ID: t.ID.Hex(),
NoticePublicationID: t.NoticePublicationID,
RelatedNoticePublicationIDs: t.RelatedNoticePublicationIDs,
NoticeTypeCode: t.NoticeTypeCode,
Title: title,
Description: description,
ProcurementTypeCode: t.ProcurementTypeCode,
ProcedureCode: t.ProcedureCode,
MainClassification: t.MainClassification,
EstimatedValue: t.EstimatedValue,
Currency: t.Currency,
Duration: t.Duration,
DurationUnit: t.DurationUnit,
PublicationDate: t.PublicationDate,
TenderDeadline: t.TenderDeadline,
SubmissionDeadline: t.SubmissionDeadline,
ApplicationDeadline: t.ApplicationDeadline,
CountryCode: t.CountryCode,
SubmissionURL: t.SubmissionURL,
BuyerOrganization: org,
Status: t.Status,
TenderID: t.TenderID,
CreatedAt: t.CreatedAt,
Language: usedLanguage,
}
return response
@@ -180,7 +182,7 @@ type AITranslateResponse struct {
type AISummaryResponse struct {
NoticeID string `json:"notice_id"`
OverallSummary string `json:"overall_summary"`
Source string `json:"source"` // "storage" or "on_demand"
Source string `json:"source"` // storage | pending | unavailable
}
// AISummarizeResponse represents the response for triggering on-demand AI summarization