depricate v1

This commit is contained in:
Cyberes 2023-09-30 20:59:24 -06:00
parent 1151bb5475
commit 166b2316e8
1 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,17 @@
from flask import Blueprint, jsonify
from llm_server.custom_redis import redis
from llm_server.routes.helpers.client import format_sillytavern_err
bp = Blueprint('old_v1', __name__)
@bp.route('/<first>')
@bp.route('/<first>/<path:rest>')
def fallback(first=None, rest=None):
base_client_api = redis.get('base_client_api', dtype=str)
error_msg = f'The /v1/ endpoint has been depreciated. Please see [{base_client_api}]({base_client_api}) for the new endpoint.'
response_msg = format_sillytavern_err(error_msg, error_type='API')
return jsonify({
'results': [{'text': response_msg}]
}), 200 # return 200 so we don't trigger an error message in the client's ST