File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed
Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 88# - "main" (branch)
99# - "v1.2.3" (tag)
1010# - "abc123def456" (commit hash)
11- private_chat_frontend_version = " c585b0dfd83a7e5bb6974534f0bb91b694c96e31 " # v0.1.8
11+ private_chat_frontend_version = " 36f18d6ef6b326147e68990a7718b1a2397be9bf " # v0.1.8-p1
1212
1313# PostHog key and host for the private-chat frontend
1414posthog_key = " phc_glaMeuuO1gLFSB2U9y27MchidXEmSnFOQLB8cceyVSb"
Original file line number Diff line number Diff line change 1- /// Error message when a user is banned from using /v1/responses
2- const NEAR_BAN_ERROR_MESSAGE : & str =
3- "User is temporarily banned from using this feature; please try again later" ;
41use crate :: consts:: LIST_FILES_LIMIT_MAX ;
52use crate :: middleware:: auth:: AuthenticatedUser ;
63use axum:: {
@@ -37,6 +34,10 @@ const NEAR_BALANCE_BAN_DURATION_SECS: i64 = 60 * 60;
3734/// Duration to cache NEAR balance checks in memory (in seconds)
3835const NEAR_BALANCE_CACHE_TTL_SECS : i64 = 5 * 60 ;
3936
37+ /// Error message when a user is banned
38+ pub const USER_BANNED_ERROR_MESSAGE : & str =
39+ "Access temporarily restricted. Please try again later." ;
40+
4041/// Create the OpenAI API proxy router
4142pub fn create_api_router (
4243 rate_limit_state : crate :: middleware:: RateLimitState ,
@@ -1307,7 +1308,7 @@ async fn ensure_near_balance_for_near_user(
13071308 Err ( (
13081309 StatusCode :: FORBIDDEN ,
13091310 Json ( ErrorResponse {
1310- error : NEAR_BAN_ERROR_MESSAGE . to_string ( ) ,
1311+ error : USER_BANNED_ERROR_MESSAGE . to_string ( ) ,
13111312 } ) ,
13121313 )
13131314 . into_response ( ) )
@@ -1353,7 +1354,7 @@ async fn ensure_user_not_banned(
13531354 return Err ( (
13541355 StatusCode :: FORBIDDEN ,
13551356 Json ( ErrorResponse {
1356- error : NEAR_BAN_ERROR_MESSAGE . to_string ( ) ,
1357+ error : USER_BANNED_ERROR_MESSAGE . to_string ( ) ,
13571358 } ) ,
13581359 )
13591360 . into_response ( ) ) ;
Original file line number Diff line number Diff line change 11mod common;
22
3+ use api:: routes:: api:: USER_BANNED_ERROR_MESSAGE ;
34use common:: create_test_server;
45use serde_json:: json;
56use tokio:: time:: sleep;
@@ -158,7 +159,7 @@ async fn test_near_balance_blocks_poor_account() {
158159 let error = body. get ( "error" ) . and_then ( |v| v. as_str ( ) ) ;
159160 assert_eq ! (
160161 error,
161- Some ( "User is temporarily banned from using this feature; please try again later" ) ,
162+ Some ( USER_BANNED_ERROR_MESSAGE ) ,
162163 "Ban error message should indicate a temporary ban without exposing NEAR balance details"
163164 ) ;
164165}
You can’t perform that action at this time.
0 commit comments