Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions crates/api/src/routes/api.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/// Error message when a user is banned from using /v1/responses
const NEAR_BAN_ERROR_MESSAGE: &str =
"User is temporarily banned from using this feature; please try again later";
use crate::consts::LIST_FILES_LIMIT_MAX;
use crate::middleware::auth::AuthenticatedUser;
use axum::{
Expand Down Expand Up @@ -35,8 +32,12 @@
const NEAR_BALANCE_BAN_DURATION_SECS: i64 = 60 * 60;

/// Duration to cache NEAR balance checks in memory (in seconds)
const NEAR_BALANCE_CACHE_TTL_SECS: i64 = 5 * 60;

Check warning on line 35 in crates/api/src/routes/api.rs

View workflow job for this annotation

GitHub Actions / Test Suite

Diff in /home/runner/work/chat-api/chat-api/crates/api/src/routes/api.rs

/// Error message when a user is banned
const USER_BANNED_ERROR_MESSAGE: &str =
"Access temporarily restricted. Please try again later.";

/// Create the OpenAI API proxy router
pub fn create_api_router(
rate_limit_state: crate::middleware::RateLimitState,
Expand Down Expand Up @@ -1307,7 +1308,7 @@
Err((
StatusCode::FORBIDDEN,
Json(ErrorResponse {
error: NEAR_BAN_ERROR_MESSAGE.to_string(),
error: USER_BANNED_ERROR_MESSAGE.to_string(),
}),
)
.into_response())
Expand Down Expand Up @@ -1353,7 +1354,7 @@
return Err((
StatusCode::FORBIDDEN,
Json(ErrorResponse {
error: NEAR_BAN_ERROR_MESSAGE.to_string(),
error: USER_BANNED_ERROR_MESSAGE.to_string(),
}),
)
.into_response());
Expand Down
Loading