mirror of
https://github.com/serty2005/rmser.git
synced 2026-02-04 19:02:33 -06:00
Добавил черновики накладных и OCR через Яндекс. LLM для расшифровки универсальный
This commit is contained in:
@@ -73,6 +73,25 @@ func (h *OCRHandler) SaveMatch(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{"status": "saved"})
|
||||
}
|
||||
|
||||
// DeleteMatch удаляет связь
|
||||
func (h *OCRHandler) DeleteMatch(c *gin.Context) {
|
||||
// Получаем raw_name из query параметров, так как в URL path могут быть спецсимволы
|
||||
// Пример: DELETE /api/ocr/match?raw_name=Хлеб%20Бородинский
|
||||
rawName := c.Query("raw_name")
|
||||
if rawName == "" {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "raw_name is required"})
|
||||
return
|
||||
}
|
||||
|
||||
if err := h.service.DeleteMatch(rawName); err != nil {
|
||||
logger.Log.Error("Ошибка удаления матча", zap.Error(err))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"status": "deleted"})
|
||||
}
|
||||
|
||||
// GetMatches возвращает список всех обученных связей
|
||||
func (h *OCRHandler) GetMatches(c *gin.Context) {
|
||||
matches, err := h.service.GetKnownMatches()
|
||||
|
||||
Reference in New Issue
Block a user