feat(bat): 补全工作流命令与人工校对状态
bat-rust / Build and test Rust (push) Canceled after 0s
bat-rust / Build and test Go API (push) Canceled after 0s

Refs #43
This commit is contained in:
2026-08-19 21:33:33 +08:00
parent 550ee7fd9a
commit 72c1a879a3
21 changed files with 797 additions and 41 deletions
+25
View File
@@ -50,6 +50,7 @@ func (s *Server) handleAdminIndex(w http.ResponseWriter, r *http.Request) {
"/admin/control/schedule-remove",
"/admin/control/schedule-run",
"/admin/control/translation-task-update",
"/admin/control/translation-proofread",
},
}
if r.Method == http.MethodHead {
@@ -81,6 +82,10 @@ func (s *Server) handleAdminControl(w http.ResponseWriter, r *http.Request) {
s.handleAdminTranslationTaskUpdate(w, r)
return
}
if action == "translation-proofread" {
s.handleAdminTranslationProofread(w, r)
return
}
request, ok := decodeAdminControlRequest(w, r)
if !ok {
return
@@ -182,6 +187,26 @@ func (s *Server) handleAdminTranslationTaskUpdate(w http.ResponseWriter, r *http
})
}
func (s *Server) handleAdminTranslationProofread(w http.ResponseWriter, r *http.Request) {
backend, ok := s.backend.(TranslationBackend)
if !ok || backend == nil {
writeErrorJSON(w, http.StatusServiceUnavailable, "translation_backend_unavailable", "Rust bat translation backend is unavailable")
return
}
result, err := backend.TranslationProofread(r.Context())
if err != nil {
s.writeControlBackendError(w, "translation-proofread", err)
return
}
writeNoStoreJSON(w, http.StatusAccepted, AdminControlResponse{
Service: "bat-api",
Action: "translation-proofread",
RPCMethod: "translation.proofread",
Status: "accepted",
Result: result,
})
}
func (s *Server) handleAdminSchedules(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet && r.Method != http.MethodHead {
writeErrorJSON(w, http.StatusMethodNotAllowed, "method_not_allowed", "method not allowed")