Skip to content

Commit

Permalink
Merge pull request #31 from etalab-ia/feat/debug
Browse files Browse the repository at this point in the history
feat: add the mode command + read the groups_used from env
  • Loading branch information
bolinocroustibat authored May 23, 2024
2 parents 6a9f492 + b5ffbda commit 1a77764
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ jobs:
echo MATRIX_BOT_PASSWORD=${{ secrets.MATRIX_BOT_PASSWORD }} >> .env
echo ERRORS_ROOM_ID=${{ secrets.ERRORS_ROOM_ID }} >> .env
echo USER_ALLOWED_DOMAINS=${{ secrets.USER_ALLOWED_DOMAINS }} >> .env
echo JOIN_ON_INVITE=${{ secrets.JOIN_ON_INVITE }} >> .env
echo JOIN_ON_INVITE=${{ vars.JOIN_ON_INVITE }} >> .env
echo SALT=${{ secrets.SALT }} >> .env
echo ALBERT_API_URL=${{ secrets.ALBERT_API_URL }} >> .env
echo ALBERT_API_TOKEN=${{ secrets.ALBERT_API_TOKEN }} >> .env
echo ALBERT_API_MODEL_NAME=${{ secrets.ALBERT_API_MODEL_NAME }} >> .env
echo ALBERT_API_MODE=${{ secrets.ALBERT_API_MODE }} >> .env
echo ALBERT_API_MODEL_NAME=${{ vars.ALBERT_API_MODEL_NAME }} >> .env
echo ALBERT_API_MODE=${{ vars.ALBERT_API_MODE }} >> .env
echo GROUPS_USED=${{ vars.GROUPS_USED }} >> .env
cat .env
- name: Copy deployment files to remote server via SCP
Expand Down
19 changes: 19 additions & 0 deletions app/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,25 @@ async def albert_conversation(ep: EventParser, matrix_client: MatrixClient):
await matrix_client.send_text_message(ep.room.room_id, reset_message)


@register_feature(
group="albert_debug",
onEvent=RoomMessageText,
command="mode",
help=f"**{COMMAND_PREFIX}mode** MODE : Modifier le mode du modèle (c'est-à-dire le modèle de prompt utilisé).",
)
async def albert_mode(ep: EventParser, matrix_client: MatrixClient):
config = user_configs[ep.sender]
await matrix_client.room_typing(ep.room.room_id)
commands = ep.event.body.split()
if len(commands) <= 1:
reset_message = "La commande !mode nécessite un argument. Se référer à !help."
else:
mode = commands[1]
config.albert_api_mode = mode
reset_message = "Le mode a été modifié."
await matrix_client.send_text_message(ep.room.room_id, reset_message)


@register_feature(
group="albert",
onEvent=RoomMessageText,
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
- MATRIX_BOT_PASSWORD=${MATRIX_BOT_PASSWORD}
- ERRORS_ROOM_ID=${ERRORS_ROOM_ID}
- SESSION_PATH=/data/session.txt
- GROUPS_USED=["basic", "albert"]
- GROUPS_USED=${GROUPS_USED}
- USER_ALLOWED_DOMAINS=${USER_ALLOWED_DOMAINS}
- JOIN_ON_INVITE=${JOIN_ON_INVITE}
- SALT=${SALT}
Expand Down

0 comments on commit 1a77764

Please sign in to comment.