mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Fix: re sub error. (#9985)
### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -160,7 +160,7 @@ class LLM(ComponentBase):
|
|||||||
if not r:
|
if not r:
|
||||||
continue
|
continue
|
||||||
pts[tag.lower()] = r.group(1)
|
pts[tag.lower()] = r.group(1)
|
||||||
sys_prompt = re.sub(rf"<{tag}>(.*?)</{tag}>", sys_prompt, flags=re.DOTALL|re.IGNORECASE)
|
sys_prompt = re.sub(rf"<{tag}>(.*?)</{tag}>", "", sys_prompt, flags=re.DOTALL|re.IGNORECASE)
|
||||||
return pts, sys_prompt
|
return pts, sys_prompt
|
||||||
|
|
||||||
def _generate(self, msg:list[dict], **kwargs) -> str:
|
def _generate(self, msg:list[dict], **kwargs) -> str:
|
||||||
|
|||||||
@ -320,6 +320,8 @@ def construct_error_response(e):
|
|||||||
def token_required(func):
|
def token_required(func):
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
def decorated_function(*args, **kwargs):
|
def decorated_function(*args, **kwargs):
|
||||||
|
if os.environ.get("DISABLE_SDK"):
|
||||||
|
return get_json_result(data=False, message="`Authorization` can't be empty")
|
||||||
authorization_str = flask_request.headers.get("Authorization")
|
authorization_str = flask_request.headers.get("Authorization")
|
||||||
if not authorization_str:
|
if not authorization_str:
|
||||||
return get_json_result(data=False, message="`Authorization` can't be empty")
|
return get_json_result(data=False, message="`Authorization` can't be empty")
|
||||||
|
|||||||
Reference in New Issue
Block a user