-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc39150
commit 9b96775
Showing
11 changed files
with
24 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]> | ||
# | ||
# SPDX-License-Identifier: CC0-1.0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<!-- | ||
SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]> | ||
SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]> | ||
SPDX-FileCopyrightText: 2024 Etalab <[email protected]> | ||
SPDX-License-Identifier: MIT | ||
--> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]> | ||
# | ||
# SPDX-License-Identifier: CC0-1.0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
|
@@ -34,8 +34,8 @@ def main(): | |
logger.info("loaded feature", feature=feature["name"]) | ||
|
||
# To send message if Albert is updated for example... | ||
#async def startup_action(room_id): | ||
# async def startup_action(room_id): | ||
# await tchap_bot.matrix_client.send_markdown_message(room_id, command_registry.get_help()) | ||
#tchap_bot.callbacks.register_on_startup(startup_action) | ||
# tchap_bot.callbacks.register_on_startup(startup_action) | ||
|
||
tchap_bot.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
|
@@ -40,8 +40,8 @@ class Config(BaseConfig): | |
|
||
# Conversational settings | ||
with_history: bool = Field(True, description="Conversational mode") | ||
chat_id: int|None = Field(None, description="Current chat id") | ||
stream_id: int|None = Field(None, description="Current stream id") | ||
chat_id: int | None = Field(None, description="Current chat id") | ||
stream_id: int | None = Field(None, description="Current stream id") | ||
|
||
|
||
env_config = Config() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# SPDX-FileCopyrightText: 2021 - 2022 Isaac Beverly <https://github.com/imbev> | ||
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
from dataclasses import dataclass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
|
@@ -106,7 +106,7 @@ def generate_sources(config: Config, stream_id: int) -> list[dict]: | |
# Fetch chunks sources | ||
if not stream.get("rag_sources"): | ||
return [] | ||
data = {"uids": stream['rag_sources']} | ||
data = {"uids": stream["rag_sources"]} | ||
response = requests.post(f"{url}/get_chunks", headers=headers, json=data) | ||
log_and_raise_for_status(response) | ||
sources = response.json() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]> | ||
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
|
@@ -33,7 +33,9 @@ def get_salon_users_str(salon: MatrixRoom): | |
return "\n".join(f" - **{key}** : {','.join(value) } " for key, value in user_to_print.items()) | ||
|
||
|
||
def get_salon_moderators(salon: MatrixRoom, *, fomo_user_name=None, kick_user_name=None) -> Optional[list[str]]: | ||
def get_salon_moderators( | ||
salon: MatrixRoom, *, fomo_user_name=None, kick_user_name=None | ||
) -> Optional[list[str]]: | ||
user_to_power_level = get_user_to_power_level(salon) | ||
if fomo_user_name and fomo_user_name in user_to_power_level.keys(): | ||
return None | ||
|
@@ -42,7 +44,11 @@ def get_salon_moderators(salon: MatrixRoom, *, fomo_user_name=None, kick_user_na | |
minimum_power_level = 50 | ||
if kick_user_name: | ||
minimum_power_level = user_to_power_level[kick_user_name] + 1 | ||
return [user_name for user_name, power_level in user_to_power_level.items() if power_level >= minimum_power_level] | ||
return [ | ||
user_name | ||
for user_name, power_level in user_to_power_level.items() | ||
if power_level >= minimum_power_level | ||
] | ||
|
||
|
||
def user_name_to_non_hl_user(complete_user_name: str) -> str: | ||
|