translation body update
This commit is contained in:
@@ -88,6 +88,12 @@ func (w *TranslationWorker) translateTender(t *tender.Tender) {
|
|||||||
if t.NoticePublicationID == "" {
|
if t.NoticePublicationID == "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if strings.TrimSpace(t.ContractFolderID) == "" {
|
||||||
|
w.Logger.Debug("Skipping tender translation: missing contract_folder_id", map[string]interface{}{
|
||||||
|
"tender_id": t.ID.Hex(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
if existing, ok := t.Translations[w.TargetLanguage]; ok && strings.TrimSpace(existing.Title) != "" {
|
if existing, ok := t.Translations[w.TargetLanguage]; ok && strings.TrimSpace(existing.Title) != "" {
|
||||||
w.Logger.Debug("Skipping tender translation because target language already exists", map[string]interface{}{
|
w.Logger.Debug("Skipping tender translation because target language already exists", map[string]interface{}{
|
||||||
"tender_id": t.ID.Hex(),
|
"tender_id": t.ID.Hex(),
|
||||||
@@ -99,6 +105,8 @@ func (w *TranslationWorker) translateTender(t *tender.Tender) {
|
|||||||
|
|
||||||
resp, err := w.AIClient.FetchTranslationOnDemand(context.Background(), ai_summarizer.TranslateRequest{
|
resp, err := w.AIClient.FetchTranslationOnDemand(context.Background(), ai_summarizer.TranslateRequest{
|
||||||
NoticeID: t.NoticePublicationID,
|
NoticeID: t.NoticePublicationID,
|
||||||
|
ContractFolderID: t.ContractFolderID,
|
||||||
|
NoticePublicationID: t.NoticePublicationID,
|
||||||
Title: t.Title,
|
Title: t.Title,
|
||||||
Description: t.Description,
|
Description: t.Description,
|
||||||
Language: w.TargetLanguage,
|
Language: w.TargetLanguage,
|
||||||
|
|||||||
@@ -1047,6 +1047,9 @@ func (s *tenderService) TriggerAITranslate(ctx context.Context, id, language str
|
|||||||
if t.NoticePublicationID == "" {
|
if t.NoticePublicationID == "" {
|
||||||
return nil, fmt.Errorf("tender has no notice publication ID")
|
return nil, fmt.Errorf("tender has no notice publication ID")
|
||||||
}
|
}
|
||||||
|
if strings.TrimSpace(t.ContractFolderID) == "" {
|
||||||
|
return nil, fmt.Errorf("tender has no contract folder ID")
|
||||||
|
}
|
||||||
|
|
||||||
if tr, ok := t.Translations[targetLanguage]; ok {
|
if tr, ok := t.Translations[targetLanguage]; ok {
|
||||||
return &AITranslateResponse{
|
return &AITranslateResponse{
|
||||||
@@ -1059,6 +1062,8 @@ func (s *tenderService) TriggerAITranslate(ctx context.Context, id, language str
|
|||||||
|
|
||||||
resp, err := s.aiSummarizerClient.FetchTranslationOnDemand(ctx, ai_summarizer.TranslateRequest{
|
resp, err := s.aiSummarizerClient.FetchTranslationOnDemand(ctx, ai_summarizer.TranslateRequest{
|
||||||
NoticeID: t.NoticePublicationID,
|
NoticeID: t.NoticePublicationID,
|
||||||
|
ContractFolderID: t.ContractFolderID,
|
||||||
|
NoticePublicationID: t.NoticePublicationID,
|
||||||
Title: t.Title,
|
Title: t.Title,
|
||||||
Description: t.Description,
|
Description: t.Description,
|
||||||
Language: targetLanguage,
|
Language: targetLanguage,
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ type StoredDocument struct {
|
|||||||
// TranslateRequest represents the request payload sent to the AI service
|
// TranslateRequest represents the request payload sent to the AI service
|
||||||
// POST /ai/translate endpoint.
|
// POST /ai/translate endpoint.
|
||||||
type TranslateRequest struct {
|
type TranslateRequest struct {
|
||||||
NoticeID string `json:"notice_id"` // required
|
NoticeID string `json:"notice_id"` // required (TED-style notice key)
|
||||||
|
ContractFolderID string `json:"contract_folder_id"` // required by AI service (procedure / MinIO prefix)
|
||||||
|
NoticePublicationID string `json:"notice_publication_id"` // required by AI service
|
||||||
Title string `json:"title"` // required
|
Title string `json:"title"` // required
|
||||||
Description string `json:"description"` // required
|
Description string `json:"description"` // required
|
||||||
Language string `json:"language,omitempty"` // optional target language override
|
Language string `json:"language,omitempty"` // optional target language override
|
||||||
|
|||||||
Reference in New Issue
Block a user