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
+7 -1
View File
@@ -80,7 +80,7 @@ type rpcRequest struct {
JSONRPC string `json:"jsonrpc"`
ID uint64 `json:"id"`
Method string `json:"method"`
Params any `json:"params,omitempty"`
Params any `json:"params"`
}
type rpcResponse struct {
@@ -273,6 +273,12 @@ type TranslationTaskUpdateParams struct {
ProviderRunID string `json:"provider_run_id,omitempty"`
}
// TranslationProofread marks the current localized workflow as manual
// proofreading. Rust owns the persisted localized state.
func (c *Client) TranslationProofread(ctx context.Context) (json.RawMessage, error) {
return c.rawData(ctx, "translation.proofread", nil)
}
// Ack is returned by accepted daemon control methods.
type Ack struct {
Command string `json:"command"`
+29
View File
@@ -375,6 +375,35 @@ func TestTranslationTaskUpdateSendsWorkerParams(t *testing.T) {
}
}
func TestTranslationProofreadUsesRustMethod(t *testing.T) {
client := newTestClient(t, func(t *testing.T, req testRequest) testResponse {
if req.Method != "translation.proofread" {
t.Fatalf("method = %s", req.Method)
}
if string(req.Params) != "null" {
t.Fatalf("params = %s, want null", req.Params)
}
return testResponse{
Result: testEnvelope{
OK: true,
Status: "ok",
RequestID: "req-test-translation-proofread",
Data: map[string]any{
"translation_workflow_status": "manual_proofreading",
},
},
}
})
raw, err := client.TranslationProofread(context.Background())
if err != nil {
t.Fatalf("TranslationProofread error: %v", err)
}
if !json.Valid(raw) {
t.Fatalf("invalid raw JSON: %s", string(raw))
}
}
func TestApplicationErrorReturnsAPIError(t *testing.T) {
client := newTestClient(t, func(t *testing.T, req testRequest) testResponse {
if req.Method != "task.status" {