Skip to content

Commit

Permalink
Merge pull request #37 from jupyter-naas/1455-credits-top-up-modal-to…
Browse files Browse the repository at this point in the history
…-display-when-credits-balance-is-negative-not-working

fix: Chat errors
  • Loading branch information
Dr0p42 authored Nov 13, 2024
2 parents 7481f97 + 0d04e3b commit 022beac
Show file tree
Hide file tree
Showing 9 changed files with 846 additions and 1,577 deletions.
1,620 changes: 604 additions & 1,016 deletions go/github.com/jupyter-naas/naas-models/go/chat/chat.pb.go

Large diffs are not rendered by default.

418 changes: 61 additions & 357 deletions go/github.com/jupyter-naas/naas-models/go/chat/chat.pb.validate.go

Large diffs are not rendered by default.

60 changes: 53 additions & 7 deletions go/github.com/jupyter-naas/naas-models/go/errors/errors.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 13 additions & 58 deletions protos/chat.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "google/protobuf/struct.proto";

import "common.proto";
import "validate.proto";
import "errors.proto";
// Message


Expand All @@ -19,30 +20,12 @@ enum MessageType {
HUMAN = 3;
}

enum MessageError {
MESSAGE_NO_ERROR = 0;
MESSAGE_ALREADY_EXISTS = 1;
MESSAGE_NOT_FOUND = 2;
MESSAGE_NOT_UPDATED = 3;
MESSAGE_NOT_AUTHORIZED = 4;

MESSAGE_INTERNAL_SERVER_ERROR = 1000;
}

enum CompletionStatus {
COMPLETED = 0;
FAILED = 1;
TIMEOUT = 2;
}

message MessageResponseError {
optional MessageError code = 1;
optional string status = 2;
optional string reason = 3;
optional string message = 4;
}


message Message {
optional int32 id = 1;
optional int32 version = 2;
Expand Down Expand Up @@ -81,19 +64,12 @@ message MessageDeletionRequest {
}

message MessageDeletionResponse {
optional MessageError error = 1;
optional errors.ErrorResponse error = 1;
}


// Message Rating

message MessageRatinResponseError {
optional MessageError code = 1;
optional string status = 2;
optional string reason = 3;
optional string message = 4;
}

message MessageRating {
optional int32 message_id = 1;
optional string user_id = 2;
Expand All @@ -116,7 +92,7 @@ message MessageRatingCreationRequest {
}

message MessageRatingCreationResponse {
optional MessageRatinResponseError error = 1;
optional errors.ErrorResponse error = 1;
optional MessageRating message_rating = 2;
}

Expand Down Expand Up @@ -149,27 +125,6 @@ message ChatMessages {
map<int32, Messages> messages = 1;
}

enum ChatError {
CHAT_NO_ERROR = 0;
CHAT_ALREADY_EXISTS = 1;
CHAT_NOT_FOUND = 2;
CHAT_NOT_UPDATED = 3;
CHAT_NOT_AUTHORIZED = 4;
CHAT_COMPLETION_ADAPTOR_DOES_NOT_EXISTS = 5;
CHAT_AIMODEL_NOT_FOUND = 6;
CHAT_OUT_OF_CREDIT = 7;
CHAT_CONTEXT_LENGTH_EXCEEDED = 8;

CHAT_INTERNAL_SERVER_ERROR = 1000;
}

message ChatResponseError {
optional ChatError code = 1;
optional string status = 2;
optional string reason = 3;
optional string message = 4;
}

// Create

message ChatCreationRequest {
Expand All @@ -179,7 +134,7 @@ message ChatCreationRequest {

message ChatCreationResponse {
optional Chat chat = 1;
optional ChatResponseError error = 2;
optional errors.ErrorResponse error = 2;
}

// Get
Expand All @@ -190,15 +145,15 @@ message ChatGetRequest {

message ChatGetResponse {
optional Chat chat = 1;
optional ChatResponseError error = 2;
optional errors.ErrorResponse error = 2;
}


message ChatMessageGetRequest {
optional int32 id = 1;
}
message ChatMessageGetResponse {
optional ChatResponseError error = 1;
optional errors.ErrorResponse error = 1;
optional ChatMessages messages = 2;
}

Expand All @@ -209,7 +164,7 @@ message ChatDeletionRequest {
}

message ChatDeletionResponse {
optional ChatResponseError error = 1;
optional errors.ErrorResponse error = 1;
}

// Update
Expand All @@ -221,7 +176,7 @@ message ChatUpdateRequest {

message ChatUpdateResponse {
optional Chat chat = 1;
optional ChatResponseError error = 2;
optional errors.ErrorResponse error = 2;
}

// List
Expand All @@ -233,7 +188,7 @@ message ChatListRequest {

message ChatListResponse {
repeated Chat chat = 1;
optional ChatResponseError error = 2;
optional errors.ErrorResponse error = 2;
}

// Star chat
Expand All @@ -245,7 +200,7 @@ message ChatStarRequest {

message ChatStarResponse {
optional Chat chat = 1;
optional ChatError code = 2;
optional errors.ErrorResponse error = 2;
}

// Archive chat messages
Expand All @@ -255,7 +210,7 @@ message ChatArchiveRequest {
}

message ChatArchiveResponse {
optional ChatResponseError error = 1;
optional errors.ErrorResponse error = 1;
}

// Completion
Expand Down Expand Up @@ -288,7 +243,7 @@ message ChatStopCompletionRequest {
}

message ChatStopCompletionResponse {
optional ChatResponseError error = 1;
optional errors.ErrorResponse error = 1;
}

/**
Expand Down Expand Up @@ -317,7 +272,7 @@ If not specified, it will take either the last SystemMessage information for it,

message ChatCompletionResponse {
optional CompletionResponse completion = 1;
optional ChatResponseError error = 2;
optional errors.ErrorResponse error = 2;
}


Expand Down
15 changes: 15 additions & 0 deletions protos/errors.proto
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,24 @@ enum Error {
// Credits errors 400 - 499

CREDITS_USER_HAS_NO_PARENT = 400;
CREDITS_OUT_OF_CREDITS = 401;

// Ontology errors 500 - 599
ONTOLOGY_NOT_FOUND = 500;

// Chat errors - 600 - 699
CHAT_NOT_FOUND = 600;
CHAT_NOT_AUTHORIZED = 601;
CHAT_COMPLETION_ADAPTOR_DOES_NOT_EXIST = 602;
CHAT_CONTEXT_LENGTH_EXCEEDED = 603;
CHAT_MESSAGE_ALREADY_EXISTS = 604;
CHAT_MESSAGE_NOT_FOUND = 605;

CHAT_INTERNAL_SERVER_ERROR = 699;

// AIModel errors - 700 - 799
AIMODEL_NOT_FOUND = 700;

}

message ErrorResponse {
Expand Down
Loading

0 comments on commit 022beac

Please sign in to comment.