Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
text-generation-inference
Commits
91f5f862
Commit
91f5f862
authored
Nov 14, 2022
by
OlivierDehaene
Browse files
fix(router): Fix HTTP status codes
parent
6c781025
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
router/src/batcher.rs
router/src/batcher.rs
+1
-1
router/src/validation.rs
router/src/validation.rs
+2
-2
No files found.
router/src/batcher.rs
View file @
91f5f862
...
@@ -220,7 +220,7 @@ impl From<InferError> for (StatusCode, Json<ErrorResponse>) {
...
@@ -220,7 +220,7 @@ impl From<InferError> for (StatusCode, Json<ErrorResponse>) {
fn
from
(
err
:
InferError
)
->
Self
{
fn
from
(
err
:
InferError
)
->
Self
{
match
err
{
match
err
{
InferError
::
GenerationError
(
_
)
=>
(
InferError
::
GenerationError
(
_
)
=>
(
StatusCode
::
INTERNAL_SERVER_ERROR
,
StatusCode
::
FAILED_DEPENDENCY
,
Json
(
ErrorResponse
{
Json
(
ErrorResponse
{
error
:
err
.to_string
(),
error
:
err
.to_string
(),
}),
}),
...
...
router/src/validation.rs
View file @
91f5f862
...
@@ -101,7 +101,7 @@ fn validation_worker(
...
@@ -101,7 +101,7 @@ fn validation_worker(
)
{
)
{
// Loop over requests
// Loop over requests
while
let
Some
((
request
,
response_tx
))
=
receiver
.blocking_recv
()
{
while
let
Some
((
request
,
response_tx
))
=
receiver
.blocking_recv
()
{
if
request
.parameters.temperature
<
0.0
{
if
request
.parameters.temperature
<
=
0.0
{
response_tx
response_tx
.send
(
Err
(
ValidationError
::
Temperature
))
.send
(
Err
(
ValidationError
::
Temperature
))
.unwrap_or
(());
.unwrap_or
(());
...
@@ -162,7 +162,7 @@ pub enum ValidationError {
...
@@ -162,7 +162,7 @@ pub enum ValidationError {
impl
From
<
ValidationError
>
for
(
StatusCode
,
Json
<
ErrorResponse
>
)
{
impl
From
<
ValidationError
>
for
(
StatusCode
,
Json
<
ErrorResponse
>
)
{
fn
from
(
err
:
ValidationError
)
->
Self
{
fn
from
(
err
:
ValidationError
)
->
Self
{
(
(
StatusCode
::
BAD_REQUEST
,
StatusCode
::
UNPROCESSABLE_ENTITY
,
Json
(
ErrorResponse
{
Json
(
ErrorResponse
{
error
:
err
.to_string
(),
error
:
err
.to_string
(),
}),
}),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment