Files
tm_back/pkg/ai_summarizer/entities.go
T
2026-05-08 16:17:33 +03:30

61 lines
2.7 KiB
Go

package ai_summarizer
// SummarizeRequest represents the request payload sent to the AI service
// POST /ai/summarize endpoint for on-demand summarization.
type SummarizeRequest struct {
NoticeID string `json:"notice_id"` // required
DocumentURL string `json:"document_url"` // required
Title string `json:"title"` // required
Description string `json:"description"` // required
Country string `json:"country,omitempty"` // optional
EstimatedValue *float64 `json:"estimated_value,omitempty"` // optional (pointer to distinguish 0 from absent)
Currency string `json:"currency,omitempty"` // optional
SubmissionDeadline string `json:"submission_deadline,omitempty"` // optional
AuthorityName string `json:"authority_name,omitempty"` // optional
}
// SummarizeResponse represents the response from the AI summarization API.
type SummarizeResponse struct {
NoticeID string `json:"notice_id"`
Summaries []DocumentSummary `json:"summaries"`
OverallSummary *string `json:"overall_summary"` // nil when not available
}
// DocumentSummary represents a summary for a single document within the AI response.
type DocumentSummary struct {
DocumentName string `json:"document_name"`
DocumentType string `json:"document_type"`
Summary string `json:"summary"`
SummaryModel string `json:"summary_model"`
Error string `json:"error"` // empty string when no error
}
// TranslateRequest represents the request payload sent to the AI service
// POST /ai/translate endpoint.
type TranslateRequest struct {
NoticeID string `json:"notice_id"` // required
Title string `json:"title"` // required
Description string `json:"description"` // required
Language string `json:"language,omitempty"` // optional target language override
}
// TranslateResponse represents the response from the AI translation API.
type TranslateResponse struct {
NoticeID string `json:"notice_id"`
TranslatedTitle string `json:"translated_title"`
TranslatedDescription string `json:"translated_description"`
Language string `json:"language"`
}
// 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"`
}
// SummarizeStatus represents the summarization status inside tender.json.
type SummarizeStatus struct {
Done bool `json:"done"` // true when the pipeline has finished
}