feat(chat): migration 0004 + errs codes for chat/llm/storage

This commit is contained in:
2026-05-04 00:15:13 +08:00
parent a79eb82ab5
commit eb73fbba46
4 changed files with 189 additions and 0 deletions
+19
View File
@@ -51,6 +51,25 @@ func TestHTTPStatus(t *testing.T) {
CodeWorktreePathInvalid: http.StatusBadRequest,
CodeGitCredentialInvalid: http.StatusBadRequest,
CodeWorktreeNotHeldByCaller: http.StatusForbidden,
// Chat codes
CodeChatConversationNotFound: http.StatusNotFound,
CodeChatMessageNotFound: http.StatusNotFound,
CodeChatMessageNotPending: http.StatusConflict,
CodeChatConcurrentMessage: http.StatusConflict,
CodeChatAttachmentTooLarge: http.StatusRequestEntityTooLarge,
CodeChatAttachmentUnsupportedMime: http.StatusUnsupportedMediaType,
CodeChatModelCapabilityMismatch: http.StatusConflict,
CodeChatTemplateNotFound: http.StatusNotFound,
CodeChatEndpointNotFound: http.StatusNotFound,
CodeChatModelNotFound: http.StatusNotFound,
// LLM codes
CodeLLMUpstream: http.StatusBadGateway,
CodeLLMTimeout: http.StatusGatewayTimeout,
CodeLLMRateLimited: http.StatusTooManyRequests,
CodeLLMContextTooLong: http.StatusBadRequest,
// Storage codes
CodeStoragePutFailed: http.StatusBadGateway,
CodeStorageGetFailed: http.StatusBadGateway,
}
for code, want := range cases {
require.Equal(t, want, HTTPStatus(code), "code=%s", code)