From f130e45dcf4bc32f314b2af869bafadc30410007 Mon Sep 17 00:00:00 2001 From: hsafaei Date: Thu, 1 Jan 2026 07:04:10 +0000 Subject: [PATCH] test1 --- core/core.py | 36 +----------------------------------- router/bale/bale.py | 5 +++++ router/bale/bale_handle.py | 16 +++++++++------- router/bale/base_model.py | 26 ++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 42 deletions(-) diff --git a/core/core.py b/core/core.py index 603154f..7196b36 100755 --- a/core/core.py +++ b/core/core.py @@ -34,36 +34,6 @@ if not os.path.exists(DATA_DIR): PERSIAN_BOUNDARIES = set(" \n،.؟!؛:") -# f"https://YOUR_DOMAIN.com - -from pydantic import BaseModel - -class DbRule(BaseModel): - rule_id: str - rule_content: str - rule_type: str - section_id: str - section_content: str - section_full_path :str - qanon_id: str - qanon_etebar: str - qanon_title: str - state_etebar: str - -class InputRule(BaseModel): - rule_id: str - rule_content: str - rule_type: str - section_id: str - section_content: str - -class SemanticSearchP2P(BaseModel): - in_rule: InputRule - db_rule: DbRule - score: float = 0 - metadata: Dict - - class Formatter: """ Formatting options @@ -598,11 +568,7 @@ class Formatter: -""" -deleteMessage -message_id -chat_id -""" + class RequestManager: def __init__(self, diff --git a/router/bale/bale.py b/router/bale/bale.py index 2f4a2cc..fe1a25a 100755 --- a/router/bale/bale.py +++ b/router/bale/bale.py @@ -9,6 +9,11 @@ from dependencies import _get_bale_token, _get_bale_bot router = APIRouter(tags=["bale-bot"]) ############## +""" +deleteMessage +message_id +chat_id +""" # @app.post(f"/webhook/{TOKEN}") @router.post("/webhook/{token}", description="ربات قانون یار") diff --git a/router/bale/bale_handle.py b/router/bale/bale_handle.py index 110017d..f34f89e 100755 --- a/router/bale/bale_handle.py +++ b/router/bale/bale_handle.py @@ -845,15 +845,17 @@ class BaleBot: result["answer"] # , llm_answer["source"] ) _buttons = [[HOME_BUTTON]] - _b = [] - if user.limit < self.max_limit: - _b += [MORE_LIMIT_BUTTON] + if result['answer_type'] == 'legal_question': + print(f'legal_question-----------------') + _b = [] + if user.limit < self.max_limit: + _b += [MORE_LIMIT_BUTTON] - if effort != "medium": - _b += [MORE_EFFORT_BUTTON] + if effort != "medium": + _b += [MORE_EFFORT_BUTTON] - if len(_b) > 0: - _buttons.insert(0, _b) + if len(_b) > 0: + _buttons.insert(0, _b) await self.send_message_helper( user=user, chunked_text=text_result, end_buttons=_buttons diff --git a/router/bale/base_model.py b/router/bale/base_model.py index a11a1b2..9a50e7f 100755 --- a/router/bale/base_model.py +++ b/router/bale/base_model.py @@ -6,6 +6,32 @@ from typing import Optional, Callable, List, Any from pydantic import BaseModel + +class DbRule(BaseModel): + rule_id: str + rule_content: str + rule_type: str + section_id: str + section_content: str + section_full_path :str + qanon_id: str + qanon_etebar: str + qanon_title: str + state_etebar: str + +class InputRule(BaseModel): + rule_id: str + rule_content: str + rule_type: str + section_id: str + section_content: str + +class SemanticSearchP2P(BaseModel): + in_rule: InputRule + db_rule: DbRule + score: float = 0 + metadata: Dict + class BaleStartMessageForm(BaseModel): id: int is_bot: bool = False