From 6a1157fb7e78fc1c3ae8189d5d7c74496fe6774a Mon Sep 17 00:00:00 2001 From: Alex Ott <66271487+AlexanderHOtt@users.noreply.github.com> Date: Sat, 31 Dec 2022 14:36:06 -0800 Subject: [PATCH 01/56] merge upstream/main --- discord-bot/bot/extensions/guild_settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/discord-bot/bot/extensions/guild_settings.py b/discord-bot/bot/extensions/guild_settings.py index 1aba9f47..cb419874 100644 --- a/discord-bot/bot/extensions/guild_settings.py +++ b/discord-bot/bot/extensions/guild_settings.py @@ -64,6 +64,7 @@ async def log_channel(ctx: lightbulb.SlashContext) -> None: conn: Connection = ctx.bot.d.db assert ctx.guild_id is not None # `guild_only` check assert isinstance(channel, hikari.PermissibleGuildChannel) + type(channel).mro() # Check if the bot can send messages in that channel assert (me := ctx.bot.get_me()) is not None # non-None after `StartedEvent` From 24530a7cc82cb0661c19a12ba39bfd251fd31ce7 Mon Sep 17 00:00:00 2001 From: Alex Ott <66271487+AlexanderHOtt@users.noreply.github.com> Date: Sat, 31 Dec 2022 16:31:04 -0800 Subject: [PATCH 02/56] update permissions check for guild settings --- discord-bot/bot/extensions/guild_settings.py | 31 +++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/discord-bot/bot/extensions/guild_settings.py b/discord-bot/bot/extensions/guild_settings.py index cb419874..d09407da 100644 --- a/discord-bot/bot/extensions/guild_settings.py +++ b/discord-bot/bot/extensions/guild_settings.py @@ -5,7 +5,7 @@ import lightbulb from aiosqlite import Connection from bot.db.schemas import GuildSettings from bot.utils import mention -from lightbulb.utils.permissions import permissions_in +from lightbulb.utils import permissions_in from loguru import logger plugin = lightbulb.Plugin("GuildSettings") @@ -56,33 +56,42 @@ if guild_settings.log_channel_id else 'not set'} @settings.child @lightbulb.option("channel", "The channel to use.", hikari.TextableGuildChannel) -@lightbulb.command("log_channel", "Set the channel that the bot logs task and label completions in.") +@lightbulb.command("log_channel", "Set the channel that the bot logs task and label completions in.", ephemeral=True) @lightbulb.implements(lightbulb.SlashSubCommand) async def log_channel(ctx: lightbulb.SlashContext) -> None: """Set the channel that the bot logs task and label completions in.""" channel: hikari.TextableGuildChannel = ctx.options.channel conn: Connection = ctx.bot.d.db assert ctx.guild_id is not None # `guild_only` check - assert isinstance(channel, hikari.PermissibleGuildChannel) - type(channel).mro() # Check if the bot can send messages in that channel - assert (me := ctx.bot.get_me()) is not None # non-None after `StartedEvent` - if (own_member := ctx.bot.cache.get_member(ctx.guild_id, me.id)) is None: - own_member = await ctx.bot.rest.fetch_member(ctx.guild_id, me.id) - perms = permissions_in(channel, own_member) - if perms & ~hikari.Permissions.SEND_MESSAGES: - await ctx.respond("I don't have permission to send messages in that channel.") + assert isinstance(channel, hikari.InteractionChannel) # Slash commands are interactions + me = ctx.bot.cache.get_me() or await ctx.bot.rest.fetch_my_user() + own_member = ctx.bot.cache.get_member(ctx.guild_id, me.id) or await ctx.bot.rest.fetch_member(ctx.guild_id, me.id) + + # Get the channel from the cache if it is there, otherwise fetch it + if (ch := ctx.bot.cache.get_guild_channel(channel.id)) is None: + ch = {ch.id: ch for ch in await ctx.bot.rest.fetch_guild_channels(channel.id)}[channel.id] + + if not isinstance(ch, hikari.GuildTextChannel): + await ctx.respond(f"{ch.mention} is not a text channel.") + return + + # if the bot's permissions for this channel don't contain SEND_MESSAGE + # This will also filter out categories and voice channels + print(permissions_in(ch, own_member) & hikari.Permissions.SEND_MESSAGES) + if not permissions_in(ch, own_member) & hikari.Permissions.SEND_MESSAGES: + await ctx.respond(f"I don't have permission to send messages in {ch.mention}.") return await ctx.respond(f"Setting `log_channel` to {channel.mention}.") + # update the database async with conn.cursor() as cursor: await cursor.execute( "INSERT OR REPLACE INTO guild_settings (guild_id, log_channel_id) VALUES (?, ?)", (ctx.guild_id, channel.id), ) - await conn.commit() logger.info(f"Updated `log_channel` for {ctx.guild_id} to {channel.id}.") From 9dc8aafa406f327ad295c4d5a8f92b17008c177c Mon Sep 17 00:00:00 2001 From: AlexanderHOtt Date: Sun, 1 Jan 2023 03:02:37 -0800 Subject: [PATCH 03/56] add error handler for the bot --- discord-bot/bot/bot.py | 77 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/discord-bot/bot/bot.py b/discord-bot/bot/bot.py index a305946f..b2a2eb25 100644 --- a/discord-bot/bot/bot.py +++ b/discord-bot/bot/bot.py @@ -1,11 +1,14 @@ # -*- coding: utf-8 -*- """Bot logic.""" +from datetime import datetime + import aiosqlite import hikari import lightbulb import miru from bot.api_client import OasstApiClient from bot.settings import Settings +from bot.utils import EMPTY, mention settings = Settings() @@ -38,3 +41,77 @@ async def on_stopping(event: hikari.StoppingEvent): """Cleanup.""" await bot.d.db.close() await bot.d.oasst_api.close() + + +async def _send_error_embed( + content: str, exception: lightbulb.errors.LightbulbError | BaseException, ctx: lightbulb.Context +) -> None: + ctx.command + embed = hikari.Embed( + title=f"`{exception.__class__.__name__}` Error{f' in `{ctx.command.name}`' if ctx.command else '' }", + description=content, + color=0xFF0000, + timestamp=datetime.now().astimezone(), + ).set_author(name=ctx.author.username, url=str(ctx.author.avatar_url)) + + await ctx.respond(EMPTY, embed=embed) + + +@bot.listen(lightbulb.CommandErrorEvent) +async def on_error(event: lightbulb.CommandErrorEvent) -> None: + """Error handler for the bot.""" + # Unwrap the exception to get the original cause + exc = event.exception.__cause__ or event.exception + ctx = event.context + + if isinstance(event.exception, lightbulb.CommandInvocationError): + if not event.context.command: + await _send_error_embed("Something went wrong", exc, ctx) + else: + await _send_error_embed( + f"Something went wrong during invocation of command `{event.context.command.name}`.", exc, ctx + ) + + raise event.exception + + # Not an owner + if isinstance(exc, lightbulb.NotOwner): + await _send_error_embed("You are not the owner of this bot.", exc, ctx) + # Command is on cooldown + elif isinstance(exc, lightbulb.CommandIsOnCooldown): + await _send_error_embed(f"This command is on cooldown. Retry in `{exc.retry_after:.2f}` seconds.", exc, ctx) + # Missing permissions + elif isinstance(exc, lightbulb.errors.MissingRequiredPermission): + await _send_error_embed( + f"You do not have permission to use this command. Missing permissions: {exc.missing_perms}", exc, ctx + ) + # Missing roles + elif isinstance(exc, lightbulb.errors.MissingRequiredRole): + assert event.context.guild_id is not None # Roles only exist in guilds + await _send_error_embed( + f"You do not have the correct role to use this command. Missing role(s): {[mention(r, 'role') for r in exc.missing_roles]}", + exc, + ctx, + ) + # Only a guild command + elif isinstance(exc, lightbulb.errors.OnlyInGuild): + await _send_error_embed("This command can only be run in servers.", exc, ctx) + # Only a DM command + elif isinstance(exc, lightbulb.errors.OnlyInDM): + await _send_error_embed("This command can only be run in DMs.", exc, ctx) + # Not enough arguments + elif isinstance(exc, lightbulb.errors.NotEnoughArguments): + await _send_error_embed( + f"Not enough arguments were supplied to the command. {[opt.name for opt in exc.missing_options]}", exc, ctx + ) + # Bot missing permission + elif isinstance(exc, lightbulb.errors.BotMissingRequiredPermission): + await _send_error_embed( + f"The bot does not have the correct permission(s) to execute this command. Missing permissions: {exc.missing_perms}", + exc, + ctx, + ) + elif isinstance(exc, lightbulb.errors.MissingRequiredAttachment): + await _send_error_embed("Not enough attachemnts were supplied to this command.", exc, ctx) + else: + raise exc From 6e5dfa06659bdfa9cc505af805c4e8bd978616ba Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Sun, 1 Jan 2023 21:07:33 +0000 Subject: [PATCH 04/56] add minimal devcontainer.json --- .devcontainer/devcontainer.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..ceb31cd1 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,3 @@ +{ + "dockerComposeFile": "docker-compose.yml" +} \ No newline at end of file From 466a9ba1739d99a70ad5cab45b5191971c7e19f0 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Sun, 1 Jan 2023 21:13:32 +0000 Subject: [PATCH 05/56] try proper relative path --- .devcontainer/devcontainer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ceb31cd1..3d114a3e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,3 +1,4 @@ { - "dockerComposeFile": "docker-compose.yml" + "dockerComposeFile": "../docker-compose.yml", + "forwardPorts": [3000] } \ No newline at end of file From 13e5061b95c6e42aad7dde77b6d953bb4a275b20 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Sun, 1 Jan 2023 21:18:58 +0000 Subject: [PATCH 06/56] .yaml instead of .yml --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3d114a3e..203b6add 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,4 +1,4 @@ { - "dockerComposeFile": "../docker-compose.yml", + "dockerComposeFile": "../docker-compose.yaml", "forwardPorts": [3000] } \ No newline at end of file From 229e7c7b0ce5bcb2140f512b27e6c9f4ab3933ea Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Sun, 1 Jan 2023 22:23:38 +0000 Subject: [PATCH 07/56] try install docker-compose-plugin --- .devcontainer/devcontainer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 203b6add..22845363 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,4 +1,5 @@ { + "initializeCommand": "apt-get update -y && apt install docker-compose -y && apt install docker-compose-plugin -y", "dockerComposeFile": "../docker-compose.yaml", "forwardPorts": [3000] } \ No newline at end of file From c4b61bf84c838cf7ec8fe9da967375534c0ac6ff Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Sun, 1 Jan 2023 22:24:45 +0000 Subject: [PATCH 08/56] apt-get --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 22845363..84b2857c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "initializeCommand": "apt-get update -y && apt install docker-compose -y && apt install docker-compose-plugin -y", + "initializeCommand": "apt-get update -y && apt-get install docker-compose -y && apt-get install docker-compose-plugin -y", "dockerComposeFile": "../docker-compose.yaml", "forwardPorts": [3000] } \ No newline at end of file From 4f9834b5a6fccbf67f1b60516b84be242acc82b7 Mon Sep 17 00:00:00 2001 From: Gareth Davidson Date: Sun, 1 Jan 2023 22:48:18 +0000 Subject: [PATCH 09/56] add warning to .pre-commit-config.yaml As per discussion on #212 --- .pre-commit-config.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c32ca7c8..e41a8e00 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,31 @@ +# WARNING! +# +# When making changes to auto-formatters used in pre-commit hooks, you are +# likely to cause merge conflicts with main and/or other pull requests. +# Fixing them might revert other people's work. Expect pain! +# To avoid accidental reversions and keep it easy to review, please make sure +# that changes here are in a pull request by themselves, that it consists of +# two commits: +# +# 1. The changes to this file +# 2. Changes made by running `python3 -m pre_commit run --all-files`. +# +# Then each time your pull request is blocked by a merge conflict, do the +# following steps: +# +# git reset HEAD^1 && git checkout -f # discard the change commit +# git rebase main # re-apply other people's changes +# python3 -m pre_commit run --all-files # re-run the rules +# git add . # add the newly changed files +# git commit -m 'apply pre-commit' # commit it +# git push -f # force push back to your branch +# +# Keep in mind you may have to do this a few times, as changes here may impact +# other pull requests. Try to keep it up-to-date so they can go in when it'll +# cause least disruption. +# +# /WARNING! + exclude: "build|stubs|^bot/templates/|^notebooks/.*\\.ipynb$" default_language_version: From 0b1059f53e0c7e110f47a78c24ec77ce526d609c Mon Sep 17 00:00:00 2001 From: Gareth Davidson Date: Sun, 1 Jan 2023 23:03:07 +0000 Subject: [PATCH 10/56] fix compose file so it runs in both "docker-compose" and "docker compose" --- docker-compose.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yaml b/docker-compose.yaml index ed72c820..c8d1377e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -87,6 +87,7 @@ services: backend: build: dockerfile: docker/Dockerfile.backend + context: . image: oasst-backend environment: - POSTGRES_HOST=db @@ -103,6 +104,7 @@ services: web: build: dockerfile: docker/Dockerfile.website + context: . image: oasst-web environment: - DATABASE_URL=postgres://postgres:postgres@webdb/oasst_web From 1a370ae3208653678d247c05f2f0b530332177af Mon Sep 17 00:00:00 2001 From: Gareth Davidson Date: Sun, 1 Jan 2023 23:03:33 +0000 Subject: [PATCH 11/56] remove workaround instructions from README.md --- README.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/README.md b/README.md index 4ade8e13..61a00839 100644 --- a/README.md +++ b/README.md @@ -181,13 +181,3 @@ Upon making a release on GitHub, all docker images are automatically built and pushed to ghcr.io. The docker images are tagged with the release version, and the `latest` tag. Further, the ansible playbook in `ansible/dev.yaml` is run to automatically deploy the built release to the dev machine. - -### Problems and Solutions - -- **I am on Ubuntu and getting - `ERROR: The Compose file is invalid because:Service backend has neither an image nor a build context specified. At least one must be provided.`** - - Make sure you have an up-to-date version of docker installed, and also install - `docker-compose-plugin`. See - [here](https://github.com/LAION-AI/Open-Assistant/issues/208) for more - details. From 1b081b5641179cc43fbaaaed552172dc4fed4e53 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Sun, 1 Jan 2023 23:28:24 +0000 Subject: [PATCH 12/56] add context to docker compose and service --- .devcontainer/devcontainer.json | 2 +- docker-compose.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 84b2857c..31034fa6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "initializeCommand": "apt-get update -y && apt-get install docker-compose -y && apt-get install docker-compose-plugin -y", + "service": "web", "dockerComposeFile": "../docker-compose.yaml", "forwardPorts": [3000] } \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index ed72c820..c8d1377e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -87,6 +87,7 @@ services: backend: build: dockerfile: docker/Dockerfile.backend + context: . image: oasst-backend environment: - POSTGRES_HOST=db @@ -103,6 +104,7 @@ services: web: build: dockerfile: docker/Dockerfile.website + context: . image: oasst-web environment: - DATABASE_URL=postgres://postgres:postgres@webdb/oasst_web From 0009f5b5d82064c3e471e578a1c1ed51eadbd788 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Sun, 1 Jan 2023 23:30:48 +0000 Subject: [PATCH 13/56] use `frontend-dev` in devcontainer --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 31034fa6..80f5146c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "service": "web", + "service": "frontend-dev", "dockerComposeFile": "../docker-compose.yaml", "forwardPorts": [3000] } \ No newline at end of file From 30fe045de9e764ff1e35e5c28866e0c6ede6e761 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Sun, 1 Jan 2023 23:52:22 +0000 Subject: [PATCH 14/56] add newline --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 80f5146c..751e896d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,4 +2,4 @@ "service": "frontend-dev", "dockerComposeFile": "../docker-compose.yaml", "forwardPorts": [3000] -} \ No newline at end of file +} From 6ad8310332853a15ca6fc7d0d99a798fe672a336 Mon Sep 17 00:00:00 2001 From: Gareth Davidson Date: Sun, 1 Jan 2023 23:57:15 +0000 Subject: [PATCH 15/56] Remove encoding pragma, unnecessary in Python 3 Python 2 is dead so dunno why --remove is not the default --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c32ca7c8..a4497651 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,6 +19,7 @@ repos: - id: check-case-conflict - id: detect-private-key - id: fix-encoding-pragma + args: ["--remove"] - id: forbid-submodules - id: mixed-line-ending - id: requirements-txt-fixer From 7000e10bc0b90a95b2beba495c67ce842199dd27 Mon Sep 17 00:00:00 2001 From: Gareth Davidson Date: Mon, 2 Jan 2023 00:01:45 +0000 Subject: [PATCH 16/56] apply pre-commit rules --- backend/alembic/env.py | 1 - .../versions/2022_12_15_0000-23e5fea252dd_first_revision.py | 1 - .../versions/2022_12_16_0000-cd7de470586e_v1_db_structure.py | 1 - .../2022_12_17_2230-6368515778c5_add_auth_method_to_person.py | 1 - ...2_1835-0daec5f8135f_add_auth_method_to_ix_person_username.py | 1 - .../versions/2022_12_25_1705-067c4002f2d9_add_text_labels.py | 1 - .../versions/2022_12_27_1444-3358eb6834e6_add_journal_table.py | 1 - .../2022_12_28_1142-d24b37426857_post_ref_for_work_package.py | 1 - ...8_1824-ef0b52902560_added_lang_column_for_iso_639_1_codes.py | 1 - .../2022_12_29_2103-464ec4667aae_add_collective_flag_to_task.py | 1 - ...2022_12_30_0109-73ce3675c1f5_add_field_trusted_api_client.py | 1 - ..._2054-abb47e9d145a_name_changes_person_user_post_message_.py | 1 - .../2022_12_31_0438-8d269bc4fdbd_add_deleted_field_to_post.py | 1 - backend/main.py | 1 - backend/oasst_backend/api/deps.py | 1 - backend/oasst_backend/api/v1/api.py | 1 - backend/oasst_backend/api/v1/frontend_messages.py | 2 -- backend/oasst_backend/api/v1/frontend_users.py | 1 - backend/oasst_backend/api/v1/messages.py | 2 -- backend/oasst_backend/api/v1/stats.py | 1 - backend/oasst_backend/api/v1/tasks.py | 1 - backend/oasst_backend/api/v1/text_labels.py | 1 - backend/oasst_backend/api/v1/users.py | 1 - backend/oasst_backend/api/v1/utils.py | 2 -- backend/oasst_backend/config.py | 1 - backend/oasst_backend/crud/__init__.py | 1 - backend/oasst_backend/crud/base.py | 1 - backend/oasst_backend/database.py | 1 - backend/oasst_backend/exceptions.py | 1 - backend/oasst_backend/journal_writer.py | 1 - backend/oasst_backend/models/__init__.py | 1 - backend/oasst_backend/models/api_client.py | 1 - backend/oasst_backend/models/db_payload.py | 1 - backend/oasst_backend/models/journal.py | 1 - backend/oasst_backend/models/message.py | 1 - backend/oasst_backend/models/message_reaction.py | 1 - backend/oasst_backend/models/payload_column_type.py | 1 - backend/oasst_backend/models/task.py | 1 - backend/oasst_backend/models/text_labels.py | 1 - backend/oasst_backend/models/user.py | 1 - backend/oasst_backend/models/user_stats.py | 1 - backend/oasst_backend/prompt_repository.py | 1 - discord-bot/bot/__init__.py | 1 - discord-bot/bot/__main__.py | 1 - discord-bot/bot/api_client.py | 1 - discord-bot/bot/bot.py | 1 - discord-bot/bot/db/schemas.py | 1 - discord-bot/bot/extensions/__init__.py | 1 - discord-bot/bot/extensions/guild_settings.py | 1 - discord-bot/bot/extensions/hot_reload.py | 1 - discord-bot/bot/extensions/text_labels.py | 1 - discord-bot/bot/extensions/user_input_test.py | 1 - discord-bot/bot/extensions/work.py | 1 - discord-bot/bot/settings.py | 1 - discord-bot/bot/utils.py | 1 - discord-bot/message_templates.py | 1 - discord-bot/tests/test_oasst_api_client.py | 1 - model/reward/instructor/cls_dataset.py | 1 - model/reward/instructor/experimental_dataset.py | 1 - model/reward/instructor/rank_datasets.py | 1 - model/reward/instructor/summary_quality_trainer.py | 1 - model/reward/instructor/tests/test_dataset.py | 1 - model/reward/instructor/trainer.py | 1 - model/reward/instructor/utils.py | 1 - oasst-shared/oasst_shared/schemas/protocol.py | 1 - oasst-shared/oasst_shared/utils.py | 1 - oasst-shared/setup.py | 1 - scripts/postprocessing/infogain_selector.py | 1 - scripts/postprocessing/rankings.py | 1 - scripts/postprocessing/scoring.py | 1 - text-frontend/__main__.py | 1 - 71 files changed, 74 deletions(-) diff --git a/backend/alembic/env.py b/backend/alembic/env.py index 83de474c..511ed97f 100644 --- a/backend/alembic/env.py +++ b/backend/alembic/env.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from logging.config import fileConfig import sqlmodel diff --git a/backend/alembic/versions/2022_12_15_0000-23e5fea252dd_first_revision.py b/backend/alembic/versions/2022_12_15_0000-23e5fea252dd_first_revision.py index 87709d31..8e4292ce 100644 --- a/backend/alembic/versions/2022_12_15_0000-23e5fea252dd_first_revision.py +++ b/backend/alembic/versions/2022_12_15_0000-23e5fea252dd_first_revision.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """first revision Revision ID: 23e5fea252dd diff --git a/backend/alembic/versions/2022_12_16_0000-cd7de470586e_v1_db_structure.py b/backend/alembic/versions/2022_12_16_0000-cd7de470586e_v1_db_structure.py index 67488e4b..3ddbe558 100644 --- a/backend/alembic/versions/2022_12_16_0000-cd7de470586e_v1_db_structure.py +++ b/backend/alembic/versions/2022_12_16_0000-cd7de470586e_v1_db_structure.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """v1 db structure Revision ID: cd7de470586e diff --git a/backend/alembic/versions/2022_12_17_2230-6368515778c5_add_auth_method_to_person.py b/backend/alembic/versions/2022_12_17_2230-6368515778c5_add_auth_method_to_person.py index d93afeba..2d0f25f2 100644 --- a/backend/alembic/versions/2022_12_17_2230-6368515778c5_add_auth_method_to_person.py +++ b/backend/alembic/versions/2022_12_17_2230-6368515778c5_add_auth_method_to_person.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """add auth_method to person Revision ID: 6368515778c5 diff --git a/backend/alembic/versions/2022_12_22_1835-0daec5f8135f_add_auth_method_to_ix_person_username.py b/backend/alembic/versions/2022_12_22_1835-0daec5f8135f_add_auth_method_to_ix_person_username.py index c65b8319..08dec6a3 100644 --- a/backend/alembic/versions/2022_12_22_1835-0daec5f8135f_add_auth_method_to_ix_person_username.py +++ b/backend/alembic/versions/2022_12_22_1835-0daec5f8135f_add_auth_method_to_ix_person_username.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """add_auth_method_to_ix_person_username Revision ID: 0daec5f8135f diff --git a/backend/alembic/versions/2022_12_25_1705-067c4002f2d9_add_text_labels.py b/backend/alembic/versions/2022_12_25_1705-067c4002f2d9_add_text_labels.py index 94e1c514..447eb424 100644 --- a/backend/alembic/versions/2022_12_25_1705-067c4002f2d9_add_text_labels.py +++ b/backend/alembic/versions/2022_12_25_1705-067c4002f2d9_add_text_labels.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Adds text labels table. Revision ID: 067c4002f2d9 diff --git a/backend/alembic/versions/2022_12_27_1444-3358eb6834e6_add_journal_table.py b/backend/alembic/versions/2022_12_27_1444-3358eb6834e6_add_journal_table.py index 0dc937a0..3fe72fa5 100644 --- a/backend/alembic/versions/2022_12_27_1444-3358eb6834e6_add_journal_table.py +++ b/backend/alembic/versions/2022_12_27_1444-3358eb6834e6_add_journal_table.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """add_journal_table Revision ID: 3358eb6834e6 diff --git a/backend/alembic/versions/2022_12_28_1142-d24b37426857_post_ref_for_work_package.py b/backend/alembic/versions/2022_12_28_1142-d24b37426857_post_ref_for_work_package.py index 675e6898..b9102864 100644 --- a/backend/alembic/versions/2022_12_28_1142-d24b37426857_post_ref_for_work_package.py +++ b/backend/alembic/versions/2022_12_28_1142-d24b37426857_post_ref_for_work_package.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """post ref for work_package Revision ID: d24b37426857 diff --git a/backend/alembic/versions/2022_12_28_1824-ef0b52902560_added_lang_column_for_iso_639_1_codes.py b/backend/alembic/versions/2022_12_28_1824-ef0b52902560_added_lang_column_for_iso_639_1_codes.py index 66ff2692..eba2f6a6 100644 --- a/backend/alembic/versions/2022_12_28_1824-ef0b52902560_added_lang_column_for_iso_639_1_codes.py +++ b/backend/alembic/versions/2022_12_28_1824-ef0b52902560_added_lang_column_for_iso_639_1_codes.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Added lang column for ISO-639-1 codes Revision ID: ef0b52902560 diff --git a/backend/alembic/versions/2022_12_29_2103-464ec4667aae_add_collective_flag_to_task.py b/backend/alembic/versions/2022_12_29_2103-464ec4667aae_add_collective_flag_to_task.py index 42b8ccf8..2ac700ec 100644 --- a/backend/alembic/versions/2022_12_29_2103-464ec4667aae_add_collective_flag_to_task.py +++ b/backend/alembic/versions/2022_12_29_2103-464ec4667aae_add_collective_flag_to_task.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """add collective flag to task Revision ID: 464ec4667aae diff --git a/backend/alembic/versions/2022_12_30_0109-73ce3675c1f5_add_field_trusted_api_client.py b/backend/alembic/versions/2022_12_30_0109-73ce3675c1f5_add_field_trusted_api_client.py index 303ca3fc..4f04cb06 100644 --- a/backend/alembic/versions/2022_12_30_0109-73ce3675c1f5_add_field_trusted_api_client.py +++ b/backend/alembic/versions/2022_12_30_0109-73ce3675c1f5_add_field_trusted_api_client.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """add field trusted api client Revision ID: 73ce3675c1f5 diff --git a/backend/alembic/versions/2022_12_30_2054-abb47e9d145a_name_changes_person_user_post_message_.py b/backend/alembic/versions/2022_12_30_2054-abb47e9d145a_name_changes_person_user_post_message_.py index 3459cce8..7aa825ef 100644 --- a/backend/alembic/versions/2022_12_30_2054-abb47e9d145a_name_changes_person_user_post_message_.py +++ b/backend/alembic/versions/2022_12_30_2054-abb47e9d145a_name_changes_person_user_post_message_.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """name changes: person->user, post->message, work_package->task Revision ID: abb47e9d145a diff --git a/backend/alembic/versions/2022_12_31_0438-8d269bc4fdbd_add_deleted_field_to_post.py b/backend/alembic/versions/2022_12_31_0438-8d269bc4fdbd_add_deleted_field_to_post.py index 786471db..3331142c 100644 --- a/backend/alembic/versions/2022_12_31_0438-8d269bc4fdbd_add_deleted_field_to_post.py +++ b/backend/alembic/versions/2022_12_31_0438-8d269bc4fdbd_add_deleted_field_to_post.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """add deleted field to post Revision ID: 8d269bc4fdbd diff --git a/backend/main.py b/backend/main.py index 9cf43701..d9c35095 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from http import HTTPStatus from pathlib import Path from typing import Optional diff --git a/backend/oasst_backend/api/deps.py b/backend/oasst_backend/api/deps.py index e0286ba3..fe26f0a6 100644 --- a/backend/oasst_backend/api/deps.py +++ b/backend/oasst_backend/api/deps.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from http import HTTPStatus from secrets import token_hex from typing import Generator diff --git a/backend/oasst_backend/api/v1/api.py b/backend/oasst_backend/api/v1/api.py index 2286a1ac..94975909 100644 --- a/backend/oasst_backend/api/v1/api.py +++ b/backend/oasst_backend/api/v1/api.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from fastapi import APIRouter from oasst_backend.api.v1 import frontend_messages, frontend_users, messages, stats, tasks, text_labels, users diff --git a/backend/oasst_backend/api/v1/frontend_messages.py b/backend/oasst_backend/api/v1/frontend_messages.py index 6ee27aa1..0c8b81f6 100644 --- a/backend/oasst_backend/api/v1/frontend_messages.py +++ b/backend/oasst_backend/api/v1/frontend_messages.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from fastapi import APIRouter, Depends from oasst_backend.api import deps from oasst_backend.api.v1 import utils diff --git a/backend/oasst_backend/api/v1/frontend_users.py b/backend/oasst_backend/api/v1/frontend_users.py index 940c7bb3..738e3cb0 100644 --- a/backend/oasst_backend/api/v1/frontend_users.py +++ b/backend/oasst_backend/api/v1/frontend_users.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import datetime from uuid import UUID diff --git a/backend/oasst_backend/api/v1/messages.py b/backend/oasst_backend/api/v1/messages.py index 71e4e3eb..a70b935e 100644 --- a/backend/oasst_backend/api/v1/messages.py +++ b/backend/oasst_backend/api/v1/messages.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import datetime from uuid import UUID diff --git a/backend/oasst_backend/api/v1/stats.py b/backend/oasst_backend/api/v1/stats.py index 831d4df2..0f275b7d 100644 --- a/backend/oasst_backend/api/v1/stats.py +++ b/backend/oasst_backend/api/v1/stats.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from fastapi import APIRouter, Depends from oasst_backend.api import deps from oasst_backend.models import ApiClient diff --git a/backend/oasst_backend/api/v1/tasks.py b/backend/oasst_backend/api/v1/tasks.py index 636f0feb..aaa4a8c1 100644 --- a/backend/oasst_backend/api/v1/tasks.py +++ b/backend/oasst_backend/api/v1/tasks.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import random from typing import Any, Optional, Tuple from uuid import UUID diff --git a/backend/oasst_backend/api/v1/text_labels.py b/backend/oasst_backend/api/v1/text_labels.py index 09933304..856aeea5 100644 --- a/backend/oasst_backend/api/v1/text_labels.py +++ b/backend/oasst_backend/api/v1/text_labels.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import pydantic from fastapi import APIRouter, Depends, HTTPException from fastapi.security.api_key import APIKey diff --git a/backend/oasst_backend/api/v1/users.py b/backend/oasst_backend/api/v1/users.py index 0bac4d6a..16ab3133 100644 --- a/backend/oasst_backend/api/v1/users.py +++ b/backend/oasst_backend/api/v1/users.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import datetime from uuid import UUID diff --git a/backend/oasst_backend/api/v1/utils.py b/backend/oasst_backend/api/v1/utils.py index 0fa452bb..c321be59 100644 --- a/backend/oasst_backend/api/v1/utils.py +++ b/backend/oasst_backend/api/v1/utils.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from http import HTTPStatus from uuid import UUID diff --git a/backend/oasst_backend/config.py b/backend/oasst_backend/config.py index 602780be..c675c148 100644 --- a/backend/oasst_backend/config.py +++ b/backend/oasst_backend/config.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from typing import Any, Dict, List, Optional, Union from pydantic import AnyHttpUrl, BaseSettings, PostgresDsn, validator diff --git a/backend/oasst_backend/crud/__init__.py b/backend/oasst_backend/crud/__init__.py index 5ee00d4a..a9a2c5b3 100644 --- a/backend/oasst_backend/crud/__init__.py +++ b/backend/oasst_backend/crud/__init__.py @@ -1,2 +1 @@ -# -*- coding: utf-8 -*- __all__ = [] diff --git a/backend/oasst_backend/crud/base.py b/backend/oasst_backend/crud/base.py index d863c4bc..432d029d 100644 --- a/backend/oasst_backend/crud/base.py +++ b/backend/oasst_backend/crud/base.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from typing import Any, Dict, Generic, List, Optional, Type, TypeVar, Union from fastapi.encoders import jsonable_encoder diff --git a/backend/oasst_backend/database.py b/backend/oasst_backend/database.py index 38e5105c..987aee76 100644 --- a/backend/oasst_backend/database.py +++ b/backend/oasst_backend/database.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from oasst_backend.config import settings from oasst_backend.exceptions import OasstError, OasstErrorCode from sqlmodel import create_engine diff --git a/backend/oasst_backend/exceptions.py b/backend/oasst_backend/exceptions.py index f431b05b..b6fb2d7f 100644 --- a/backend/oasst_backend/exceptions.py +++ b/backend/oasst_backend/exceptions.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from enum import IntEnum from http import HTTPStatus diff --git a/backend/oasst_backend/journal_writer.py b/backend/oasst_backend/journal_writer.py index 415d5a47..67892ded 100644 --- a/backend/oasst_backend/journal_writer.py +++ b/backend/oasst_backend/journal_writer.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import enum from typing import Literal, Optional from uuid import UUID diff --git a/backend/oasst_backend/models/__init__.py b/backend/oasst_backend/models/__init__.py index a942f60f..5818dbef 100644 --- a/backend/oasst_backend/models/__init__.py +++ b/backend/oasst_backend/models/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from .api_client import ApiClient from .journal import Journal, JournalIntegration from .message import Message diff --git a/backend/oasst_backend/models/api_client.py b/backend/oasst_backend/models/api_client.py index e8d722d5..0bebec47 100644 --- a/backend/oasst_backend/models/api_client.py +++ b/backend/oasst_backend/models/api_client.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from typing import Optional from uuid import UUID, uuid4 diff --git a/backend/oasst_backend/models/db_payload.py b/backend/oasst_backend/models/db_payload.py index 62dffa51..9a6fabb6 100644 --- a/backend/oasst_backend/models/db_payload.py +++ b/backend/oasst_backend/models/db_payload.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from typing import Literal from oasst_backend.models.payload_column_type import payload_type diff --git a/backend/oasst_backend/models/journal.py b/backend/oasst_backend/models/journal.py index 0f64433a..0d5a78af 100644 --- a/backend/oasst_backend/models/journal.py +++ b/backend/oasst_backend/models/journal.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from datetime import datetime from typing import Optional from uuid import UUID, uuid1, uuid4 diff --git a/backend/oasst_backend/models/message.py b/backend/oasst_backend/models/message.py index 47512cc7..f07ca881 100644 --- a/backend/oasst_backend/models/message.py +++ b/backend/oasst_backend/models/message.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from datetime import datetime from typing import Optional from uuid import UUID, uuid4 diff --git a/backend/oasst_backend/models/message_reaction.py b/backend/oasst_backend/models/message_reaction.py index 9c93961f..3aaa774c 100644 --- a/backend/oasst_backend/models/message_reaction.py +++ b/backend/oasst_backend/models/message_reaction.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from datetime import datetime from typing import Optional from uuid import UUID diff --git a/backend/oasst_backend/models/payload_column_type.py b/backend/oasst_backend/models/payload_column_type.py index fbda51ce..01b642e2 100644 --- a/backend/oasst_backend/models/payload_column_type.py +++ b/backend/oasst_backend/models/payload_column_type.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import json from typing import Any, Generic, Type, TypeVar diff --git a/backend/oasst_backend/models/task.py b/backend/oasst_backend/models/task.py index 853a5aaa..356eafea 100644 --- a/backend/oasst_backend/models/task.py +++ b/backend/oasst_backend/models/task.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from datetime import datetime from typing import Optional from uuid import UUID, uuid4 diff --git a/backend/oasst_backend/models/text_labels.py b/backend/oasst_backend/models/text_labels.py index b7ff08cf..ec10dca6 100644 --- a/backend/oasst_backend/models/text_labels.py +++ b/backend/oasst_backend/models/text_labels.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from datetime import datetime from typing import Optional from uuid import UUID, uuid4 diff --git a/backend/oasst_backend/models/user.py b/backend/oasst_backend/models/user.py index ec5efa66..1a06a524 100644 --- a/backend/oasst_backend/models/user.py +++ b/backend/oasst_backend/models/user.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from datetime import datetime from typing import Optional from uuid import UUID, uuid4 diff --git a/backend/oasst_backend/models/user_stats.py b/backend/oasst_backend/models/user_stats.py index a92775b9..b7b3231a 100644 --- a/backend/oasst_backend/models/user_stats.py +++ b/backend/oasst_backend/models/user_stats.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from datetime import datetime from typing import Optional from uuid import UUID diff --git a/backend/oasst_backend/prompt_repository.py b/backend/oasst_backend/prompt_repository.py index 8cc770c5..8190d637 100644 --- a/backend/oasst_backend/prompt_repository.py +++ b/backend/oasst_backend/prompt_repository.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import datetime import random from collections import defaultdict diff --git a/discord-bot/bot/__init__.py b/discord-bot/bot/__init__.py index 66779a9c..1a88b7f9 100644 --- a/discord-bot/bot/__init__.py +++ b/discord-bot/bot/__init__.py @@ -1,2 +1 @@ -# -*- coding: utf-8 -*- """The official Open-Assistant Discord Bot.""" diff --git a/discord-bot/bot/__main__.py b/discord-bot/bot/__main__.py index 87032e40..45820f7d 100644 --- a/discord-bot/bot/__main__.py +++ b/discord-bot/bot/__main__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Entry point for the bot.""" import logging import os diff --git a/discord-bot/bot/api_client.py b/discord-bot/bot/api_client.py index f97ab840..3a575e47 100644 --- a/discord-bot/bot/api_client.py +++ b/discord-bot/bot/api_client.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """API Client for interacting with the OASST backend.""" import enum import typing as t diff --git a/discord-bot/bot/bot.py b/discord-bot/bot/bot.py index b2a2eb25..e16504ee 100644 --- a/discord-bot/bot/bot.py +++ b/discord-bot/bot/bot.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Bot logic.""" from datetime import datetime diff --git a/discord-bot/bot/db/schemas.py b/discord-bot/bot/db/schemas.py index 33a49672..68f10ee7 100644 --- a/discord-bot/bot/db/schemas.py +++ b/discord-bot/bot/db/schemas.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Database schemas.""" import typing as t diff --git a/discord-bot/bot/extensions/__init__.py b/discord-bot/bot/extensions/__init__.py index 87295d9a..e9b1c264 100644 --- a/discord-bot/bot/extensions/__init__.py +++ b/discord-bot/bot/extensions/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Extensions for the bot. See: https://hikari-lightbulb.readthedocs.io/en/latest/guides/extensions.html diff --git a/discord-bot/bot/extensions/guild_settings.py b/discord-bot/bot/extensions/guild_settings.py index d09407da..62f21305 100644 --- a/discord-bot/bot/extensions/guild_settings.py +++ b/discord-bot/bot/extensions/guild_settings.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Guild settings.""" import hikari import lightbulb diff --git a/discord-bot/bot/extensions/hot_reload.py b/discord-bot/bot/extensions/hot_reload.py index ad2cd730..c3dbd31b 100644 --- a/discord-bot/bot/extensions/hot_reload.py +++ b/discord-bot/bot/extensions/hot_reload.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Hot reload plugin.""" from glob import glob diff --git a/discord-bot/bot/extensions/text_labels.py b/discord-bot/bot/extensions/text_labels.py index 618e6642..388a93f0 100644 --- a/discord-bot/bot/extensions/text_labels.py +++ b/discord-bot/bot/extensions/text_labels.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Hot reload plugin.""" import typing as t from datetime import datetime diff --git a/discord-bot/bot/extensions/user_input_test.py b/discord-bot/bot/extensions/user_input_test.py index 94ddb973..2d937f6a 100644 --- a/discord-bot/bot/extensions/user_input_test.py +++ b/discord-bot/bot/extensions/user_input_test.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Task plugin for testing different data collection methods.""" # TODO: Delete this once user input method has been decided for final bot. import asyncio diff --git a/discord-bot/bot/extensions/work.py b/discord-bot/bot/extensions/work.py index 822f4e34..1d88fb35 100644 --- a/discord-bot/bot/extensions/work.py +++ b/discord-bot/bot/extensions/work.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Work plugin for collecting user data.""" import asyncio import typing as t diff --git a/discord-bot/bot/settings.py b/discord-bot/bot/settings.py index 136c2b22..24c837a3 100644 --- a/discord-bot/bot/settings.py +++ b/discord-bot/bot/settings.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Configuration for the bot.""" from pydantic import BaseSettings, Field diff --git a/discord-bot/bot/utils.py b/discord-bot/bot/utils.py index 03dfea3d..2d968c93 100644 --- a/discord-bot/bot/utils.py +++ b/discord-bot/bot/utils.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Utility functions.""" import typing as t from datetime import datetime diff --git a/discord-bot/message_templates.py b/discord-bot/message_templates.py index 256f93d3..94bb031f 100644 --- a/discord-bot/message_templates.py +++ b/discord-bot/message_templates.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Message templates for the discord bot.""" import typing diff --git a/discord-bot/tests/test_oasst_api_client.py b/discord-bot/tests/test_oasst_api_client.py index c5cafe99..9b0ff383 100644 --- a/discord-bot/tests/test_oasst_api_client.py +++ b/discord-bot/tests/test_oasst_api_client.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from uuid import uuid4 import pytest diff --git a/model/reward/instructor/cls_dataset.py b/model/reward/instructor/cls_dataset.py index 7992c37c..23644ebc 100644 --- a/model/reward/instructor/cls_dataset.py +++ b/model/reward/instructor/cls_dataset.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ classification based ranking diff --git a/model/reward/instructor/experimental_dataset.py b/model/reward/instructor/experimental_dataset.py index 28f62967..d8fb60d7 100644 --- a/model/reward/instructor/experimental_dataset.py +++ b/model/reward/instructor/experimental_dataset.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ HFSummary diff --git a/model/reward/instructor/rank_datasets.py b/model/reward/instructor/rank_datasets.py index 99ba9955..f63af85a 100644 --- a/model/reward/instructor/rank_datasets.py +++ b/model/reward/instructor/rank_datasets.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ author: theblackcat102 diff --git a/model/reward/instructor/summary_quality_trainer.py b/model/reward/instructor/summary_quality_trainer.py index 88bf1abf..f47c2c82 100644 --- a/model/reward/instructor/summary_quality_trainer.py +++ b/model/reward/instructor/summary_quality_trainer.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import os from argparse import ArgumentParser from typing import Any, Callable, Dict, List, Optional, Tuple, Union diff --git a/model/reward/instructor/tests/test_dataset.py b/model/reward/instructor/tests/test_dataset.py index f367a50d..746a3c1e 100644 --- a/model/reward/instructor/tests/test_dataset.py +++ b/model/reward/instructor/tests/test_dataset.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from experimental_dataset import DataCollatorForSummaryScore, HFSummaryQuality from rank_datasets import DataCollatorForPairRank, HFSummary, WebGPT from torch.utils.data import DataLoader diff --git a/model/reward/instructor/trainer.py b/model/reward/instructor/trainer.py index 0e98e4c5..b7eb8731 100644 --- a/model/reward/instructor/trainer.py +++ b/model/reward/instructor/trainer.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import os from argparse import ArgumentParser from dataclasses import dataclass diff --git a/model/reward/instructor/utils.py b/model/reward/instructor/utils.py index 9441ddb9..6c777dea 100644 --- a/model/reward/instructor/utils.py +++ b/model/reward/instructor/utils.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import re import yaml diff --git a/oasst-shared/oasst_shared/schemas/protocol.py b/oasst-shared/oasst_shared/schemas/protocol.py index 5f05adc3..d3b2ed6c 100644 --- a/oasst-shared/oasst_shared/schemas/protocol.py +++ b/oasst-shared/oasst_shared/schemas/protocol.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import enum from datetime import datetime from typing import Literal, Optional, Union diff --git a/oasst-shared/oasst_shared/utils.py b/oasst-shared/oasst_shared/utils.py index dd1cbf07..b99bb7ed 100644 --- a/oasst-shared/oasst_shared/utils.py +++ b/oasst-shared/oasst_shared/utils.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from datetime import datetime, timezone diff --git a/oasst-shared/setup.py b/oasst-shared/setup.py index ebaf4217..22fbcc60 100644 --- a/oasst-shared/setup.py +++ b/oasst-shared/setup.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # setup.py for the shared python modules from distutils.core import setup diff --git a/scripts/postprocessing/infogain_selector.py b/scripts/postprocessing/infogain_selector.py index 51f60fa7..4eedbc5c 100644 --- a/scripts/postprocessing/infogain_selector.py +++ b/scripts/postprocessing/infogain_selector.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import numpy as np from scipy import log2 from scipy.integrate import nquad diff --git a/scripts/postprocessing/rankings.py b/scripts/postprocessing/rankings.py index 7b28399c..f6e7a31e 100644 --- a/scripts/postprocessing/rankings.py +++ b/scripts/postprocessing/rankings.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from typing import List import numpy as np diff --git a/scripts/postprocessing/scoring.py b/scripts/postprocessing/scoring.py index 3c145b28..efd236ce 100644 --- a/scripts/postprocessing/scoring.py +++ b/scripts/postprocessing/scoring.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from dataclasses import dataclass, replace from typing import Any diff --git a/text-frontend/__main__.py b/text-frontend/__main__.py index 2bec4942..39cc7b26 100644 --- a/text-frontend/__main__.py +++ b/text-frontend/__main__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Simple REPL frontend.""" import random From 4e9a3ee292322ad311a21208e1142672140e2eda Mon Sep 17 00:00:00 2001 From: kiritowu Date: Mon, 2 Jan 2023 08:02:35 +0800 Subject: [PATCH 17/56] Add fastapi-limiter to requirements.txt --- backend/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/requirements.txt b/backend/requirements.txt index dd11aa18..fedf8ee3 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -1,5 +1,6 @@ alembic==1.8.1 fastapi==0.88.0 +fastapi-limiter==0.1.5 loguru==0.6.0 numpy==1.22.4 psycopg2-binary==2.9.5 From 144a5bc424679c5cff50365d764dfd7b2c4f98a3 Mon Sep 17 00:00:00 2001 From: kiritowu Date: Mon, 2 Jan 2023 08:04:59 +0800 Subject: [PATCH 18/56] Initialise redis connection for Fastapi limiter --- backend/main.py | 26 ++++++++++++++++++++++++++ backend/oasst_backend/config.py | 4 ++++ 2 files changed, 30 insertions(+) diff --git a/backend/main.py b/backend/main.py index 9cf43701..81adcccd 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- from http import HTTPStatus +from math import ceil from pathlib import Path from typing import Optional @@ -7,6 +8,8 @@ import alembic.command import alembic.config import fastapi import pydantic +import redis.asyncio as redis +from fastapi_limiter import FastAPILimiter from loguru import logger from oasst_backend.api.deps import get_dummy_api_client from oasst_backend.api.v1.api import api_router @@ -63,6 +66,29 @@ if settings.UPDATE_ALEMBIC: logger.exception("Alembic upgrade failed on startup") +if settings.RATE_LIMIT: + + @app.on_event("startup") + async def connect_redis(): + async def http_callback(request: fastapi.Request, response: fastapi.Response, pexpire: int): + """Error callback function when too many requests""" + expire = ceil(pexpire / 1000) + raise OasstError( + f"Too Many Requests. Retry After {expire} seconds.", + OasstErrorCode.TOO_MANY_REQUESTS, + HTTPStatus.TOO_MANY_REQUESTS, + ) + + try: + redis_client = redis.from_url( + f"redis://{settings.REDIS_HOST}:{settings.REDIS_PORT}/0", encoding="utf-8", decode_responses=True + ) + logger.info(f"Connected to {redis_client=}") + await FastAPILimiter.init(redis_client, http_callback=http_callback) + except Exception: + logger.exception("Failed to establish Redis connection") + + if settings.DEBUG_USE_SEED_DATA: @app.on_event("startup") diff --git a/backend/oasst_backend/config.py b/backend/oasst_backend/config.py index 602780be..cfe0d4c7 100644 --- a/backend/oasst_backend/config.py +++ b/backend/oasst_backend/config.py @@ -15,6 +15,10 @@ class Settings(BaseSettings): POSTGRES_DB: str = "postgres" DATABASE_URI: Optional[PostgresDsn] = None + RATE_LIMIT: bool = True + REDIS_HOST: str = "localhost" + REDIS_PORT: str = "6379" + DEBUG_ALLOW_ANY_API_KEY: bool = False DEBUG_SKIP_API_KEY_CHECK: bool = False DEBUG_USE_SEED_DATA: bool = False From 5daadd697789f0be11b7ae8f4d321b041ec993ac Mon Sep 17 00:00:00 2001 From: kiritowu Date: Mon, 2 Jan 2023 08:09:35 +0800 Subject: [PATCH 19/56] Add TOO_MANY_REQUEST to OasstErrorCode --- backend/oasst_backend/exceptions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/oasst_backend/exceptions.py b/backend/oasst_backend/exceptions.py index f431b05b..7d4da6ef 100644 --- a/backend/oasst_backend/exceptions.py +++ b/backend/oasst_backend/exceptions.py @@ -18,6 +18,7 @@ class OasstErrorCode(IntEnum): DATABASE_URI_NOT_SET = 1 API_CLIENT_NOT_AUTHORIZED = 2 SERVER_ERROR = 3 + TOO_MANY_REQUESTS = 429 # 1000-2000: tasks endpoint TASK_INVALID_REQUEST_TYPE = 1000 From 8d9f3c80afabf15d9c54cd57db22e7a37eb2ec9b Mon Sep 17 00:00:00 2001 From: Alex Ott <66271487+AlexanderHOtt@users.noreply.github.com> Date: Sun, 1 Jan 2023 17:00:24 -0800 Subject: [PATCH 20/56] update readme with a better getting started guide --- discord-bot/README.md | 47 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/discord-bot/README.md b/discord-bot/README.md index 1ff47c31..052c8b43 100644 --- a/discord-bot/README.md +++ b/discord-bot/README.md @@ -10,16 +10,56 @@ To add the official Open-Assistant data collection bot to your discord server [c If you are unfamiliar with `hikari`, `lightbulb`, or `miru`, please refer to the [large list of examples](https://gist.github.com/AlexanderHOtt/7805843a7120f755938a3b75d680d2e7) -### Setup +### Bot Setup + +1. Create a new discord application at the [Discord Developer Portal](https://discord.com/developers/applications) + +1. Go to the "Bot" tab and create a new bot + +1. Scroll down to "Privileged Gateway Intents" and enable the following options: + + - Server Members Intent + - Presence Intent + - Message Content Intent + +This page also contains the bot token, which you will need to add to the `.env` file later. + +2. Go to the "OAuth2" tab scroll to "Default Authorization Link" + +3. Set "AUTHORIZATION METHOD" to "In-app Authorization" + +4. Select the "bot" and "applications.commands" scopes + +5. For testing and local development, it's easiest to set "BOT PERMISSIONS" to "Administrator" + +Remember to save your changes. + +6. Copy the "CLIENT ID" from the top of the page and replace it in the link below to invite your bot. + +``` +https://discord.com/oauth2/authorize?client_id=YOUR_ID_HERE&permissions=8&scope=bot%20applications.commands +``` + +### Environment Setup To run the bot ```bash +# in the base open-assist folder +cd oasst-shared +pip install -e . + +cd ../discord-bot + cp .env.example .env +# edit .env and add your bot token and other values + python -V # 3.10 pip install -r requirements.txt + +# in the discord-bot folder python -m bot ``` @@ -38,11 +78,6 @@ git add . git commit -m "" ``` -To test the bot on your own discord server you need to register a discord application at the [Discord Developer Portal](https://discord.com/developers/applications) and get at bot token. - -1. Follow a tutorial on how to get a bot token, for example this one: [Creating a discord bot & getting a token](https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token) -2. The bot script expects the bot token to be in the `.env` file under the `TOKEN` variable. - ### Resources #### Structure From 8e831f897fb065bcb645bba9fe6a9d4ed4c3893d Mon Sep 17 00:00:00 2001 From: Alex Ott <66271487+AlexanderHOtt@users.noreply.github.com> Date: Sun, 1 Jan 2023 17:06:54 -0800 Subject: [PATCH 21/56] fix invite link --- discord-bot/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord-bot/README.md b/discord-bot/README.md index 05723895..1ad99a71 100644 --- a/discord-bot/README.md +++ b/discord-bot/README.md @@ -9,7 +9,7 @@ the bot's outputs. If you want to learn more about RLHF please refer ## Invite official bot To add the official Open-Assistant data collection bot to your discord server -[click here](https://discord.com/api/oauth2/authorize?client_id=1054078345542910022&permissions=1634235579456&scope=bot). +[click here](https://discord.com/api/oauth2/authorize?client_id=1054078345542910022&permissions=1634235579456&scope=bot%20applications.commands). The bot needs access to read the contents of user text messages. ## Contributing From 2ff6108047a1c6cb95b61886b02a93ac521d87f7 Mon Sep 17 00:00:00 2001 From: James Melvin Date: Mon, 2 Jan 2023 12:43:37 +0530 Subject: [PATCH 22/56] fix: typo in EssayInstructions.md and EssayRevision.md --- notebooks/data-argumentation/EssayInstructions.md | 4 ++-- notebooks/data-argumentation/EssayRevision.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/notebooks/data-argumentation/EssayInstructions.md b/notebooks/data-argumentation/EssayInstructions.md index 210263d4..fba070f2 100644 --- a/notebooks/data-argumentation/EssayInstructions.md +++ b/notebooks/data-argumentation/EssayInstructions.md @@ -1,11 +1,11 @@ # Essay Instructions -Essay Instructions is a notebook that takes an essay as an input and genrates +Essay Instructions is a notebook that takes an essay as an input and generates instructions on how to generate that essay. This will be very useful for data collecting for the model ## Contributing Feel free to contribute to this notebook, it's nowhere near perfect but it's a -good start. If you want to contribute fidning a new model that better suits this +good start. If you want to contribute finding a new model that better suits this task would be great. Hugginface has a lot of models that could help. diff --git a/notebooks/data-argumentation/EssayRevision.md b/notebooks/data-argumentation/EssayRevision.md index 18b76a34..fc7205db 100644 --- a/notebooks/data-argumentation/EssayRevision.md +++ b/notebooks/data-argumentation/EssayRevision.md @@ -1,11 +1,11 @@ # Essay Revision Essay Revision is a notebook that generates data for improving essays. It does -that by taking a "good" essay, making it worse step by step and the fidning +that by taking a "good" essay, making it worse step by step and the finding instructions for making it better. This will be useful for generating data for the model. ## Contributing Feel free to contribute to this notebook. It's not perfect but it is quite good. -Finding a better way to make gramatical errors may be a good place to start. +Finding a better way to make grammatical errors may be a good place to start. From 9902e013b2c3ec702154424182ffd6dfd7b121d8 Mon Sep 17 00:00:00 2001 From: AbdBarho Date: Mon, 2 Jan 2023 08:26:33 +0100 Subject: [PATCH 23/56] Use Chakra UI for Messages --- website/src/components/FlaggableElement.tsx | 129 +++++++++----------- website/src/components/Messages.tsx | 18 ++- 2 files changed, 66 insertions(+), 81 deletions(-) diff --git a/website/src/components/FlaggableElement.tsx b/website/src/components/FlaggableElement.tsx index cae24484..c8fc17ce 100644 --- a/website/src/components/FlaggableElement.tsx +++ b/website/src/components/FlaggableElement.tsx @@ -2,6 +2,7 @@ import { Button, Checkbox, Flex, + Grid, Popover, PopoverAnchor, PopoverArrow, @@ -15,6 +16,7 @@ import { SliderTrack, Spacer, useBoolean, + useId, } from "@chakra-ui/react"; import { FlagIcon, QuestionMarkCircleIcon } from "@heroicons/react/20/solid"; import { useState } from "react"; @@ -65,58 +67,47 @@ export const FlaggableElement = (props) => { isLazy lazyBehavior="keepMounted" > -
+ {props.children} - -
+ - -
- -
    - {TEXT_LABEL_FLAGS.map((option, i) => { - return ( - - ); - })} -
-
- -
-
+
+
+ + {TEXT_LABEL_FLAGS.map((option, i) => ( + + ))} + + + + ); }; -function FlagCheckboxLi(props: { +function FlagCheckbox(props: { option: textFlagLabels; idx: number; checkboxValues: boolean[]; @@ -136,37 +127,35 @@ function FlagCheckboxLi(props: { ); } + const id = useId(); + return ( -
  • - - { - props.checkboxHandler(e.target.checked, props.idx); - }} - /> - - - { - props.sliderHandler(val / 100, props.idx); - }} - > - - - - - - -
  • + + { + props.checkboxHandler(e.target.checked, props.idx); + }} + /> + + + { + props.sliderHandler(val / 100, props.idx); + }} + > + + + + + + ); } interface textFlagLabels { diff --git a/website/src/components/Messages.tsx b/website/src/components/Messages.tsx index cc94fcc0..5b77cd26 100644 --- a/website/src/components/Messages.tsx +++ b/website/src/components/Messages.tsx @@ -1,3 +1,4 @@ +import { Grid } from "@chakra-ui/react"; import { FlaggableElement } from "./FlaggableElement"; export interface Message { @@ -10,18 +11,13 @@ const getColor = (isAssistant: boolean) => (isAssistant ? "bg-slate-800" : "bg-s export const Messages = ({ messages, post_id }: { messages: Message[]; post_id: string }) => { const items = messages.map(({ text, is_assistant }: Message, i: number) => { return ( -
    - -
    - {text} -
    -
    -
    + +
    + {text} +
    +
    ); }); // Maybe also show a legend of the colors? - return <>{items}; + return {items}; }; From 0df6d7fd31adbba0e2c50e770b76fdcdfa599898 Mon Sep 17 00:00:00 2001 From: Adrian Cowan Date: Mon, 2 Jan 2023 00:27:36 +1100 Subject: [PATCH 24/56] website: more e2e tests for signin Fixed issue where existing sign in test fails due to the existence of dev test login. Added reusable cy.signInWithEmail() to login before testing rest of UI. --- website/cypress.config.js | 7 +++++ website/cypress/e2e/auth/signin.cy.ts | 35 ++++++++++++++++++++-- website/cypress/support/commands.ts | 34 +++++++++++++++++++++ website/cypress/support/e2e.ts | 4 --- website/cypress/support/index.ts | 22 ++++++++++++++ website/package-lock.json | 17 +++++++++++ website/package.json | 1 + website/src/components/Header/UserMenu.tsx | 4 ++- website/src/pages/auth/signin.tsx | 2 +- 9 files changed, 118 insertions(+), 8 deletions(-) create mode 100644 website/cypress/support/index.ts diff --git a/website/cypress.config.js b/website/cypress.config.js index 9610624f..7d391f23 100644 --- a/website/cypress.config.js +++ b/website/cypress.config.js @@ -22,4 +22,11 @@ export default defineConfig({ getCompareSnapshotsPlugin(on, config); }, }, + + env: { + MAILDEV_PROTOCOL: "http", + MAILDEV_HOST: "localhost", + MAILDEV_SMTP_PORT: "1025", + MAILDEV_API_PORT: "1080", + }, }); diff --git a/website/cypress/e2e/auth/signin.cy.ts b/website/cypress/e2e/auth/signin.cy.ts index b6914016..e87d4b88 100644 --- a/website/cypress/e2e/auth/signin.cy.ts +++ b/website/cypress/e2e/auth/signin.cy.ts @@ -1,10 +1,41 @@ +import { faker } from "@faker-js/faker"; + describe("signin flow", () => { it("redirects to a confirmation page on submit of valid email address", () => { cy.visit("/auth/signin"); - cy.get(".chakra-input").type(`test@example.com`); - cy.get(".chakra-stack > .chakra-button").click(); + cy.get('form[data-cy="signin-email"').within(() => { + cy.get(".chakra-input").type(`test@example.com`); + cy.get(".chakra-stack > .chakra-button").click(); + }); cy.url().should("contain", "/auth/verify"); }); + it("emails a login link to the user when signing in with email", () => { + // Use random email to avoid possibility of tests passing just due to other tests or previous runs also causing emails to be sent + const emailAddress = faker.internet.email(); + cy.log("emailAddress", emailAddress); + cy.request("GET", "/api/auth/csrf") + .then((response) => { + const csrfToken = response.body.csrfToken; + cy.request("POST", "/api/auth/signin/email", { + callbackUrl: "/", + email: emailAddress, + csrfToken, + json: "true", + }); + }) + .then((response) => { + cy.signInUsingEmailedLink(emailAddress).then(() => { + cy.get('[data-cy="username"]').should("exist"); + }); + }); + }); + it("shows the logged in users email address if logged in with email", () => { + const emailAddress = "user@example.com"; + cy.signInWithEmail(emailAddress); + // The user will only see the email address if the window is wide enough, not technically required as even when hidden this will find it in the page. + cy.viewport(1920, 1000); + cy.contains('[data-cy="username"]', emailAddress); + }); }); export {}; diff --git a/website/cypress/support/commands.ts b/website/cypress/support/commands.ts index 2ed74fb3..096720d0 100644 --- a/website/cypress/support/commands.ts +++ b/website/cypress/support/commands.ts @@ -36,4 +36,38 @@ // } // } +Cypress.Commands.add("signInUsingEmailedLink", (emailAddress) => { + const mailDevApi = `${Cypress.env("MAILDEV_PROTOCOL")}://${Cypress.env( + "MAILDEV_HOST" + )}:${Cypress.env("MAILDEV_API_PORT")}`; + cy.request( + "GET", + `${mailDevApi}/email?headers.to=${emailAddress.toLowerCase()}` + ).then((response) => { + const emails = response.body; + + // Find and use login link + const loginLink = emails + .pop() + .html.match(/href="[^"]+(\/api\/auth\/callback\/[^"]+?)"/)[1]; + cy.visit(loginLink); + }); +}); + +Cypress.Commands.add("signInWithEmail", (emailAddress) => { + cy.request("GET", "/api/auth/csrf") + .then((response) => { + const csrfToken = response.body.csrfToken; + cy.request("POST", "/api/auth/signin/email", { + callbackUrl: "/", + email: emailAddress, + csrfToken, + json: "true", + }); + }) + .then(() => { + cy.signInUsingEmailedLink(emailAddress); + }); +}); + export {}; diff --git a/website/cypress/support/e2e.ts b/website/cypress/support/e2e.ts index 4c9b7b84..1ed26be7 100644 --- a/website/cypress/support/e2e.ts +++ b/website/cypress/support/e2e.ts @@ -13,12 +13,8 @@ // https://on.cypress.io/configuration // *********************************************************** -// Import commands.js using ES2015 syntax: import "./commands"; import compareSnapshotCommand from "cypress-image-diff-js/dist/command"; compareSnapshotCommand(); -// Alternatively you can use CommonJS syntax: -// require('./commands') - export {}; diff --git a/website/cypress/support/index.ts b/website/cypress/support/index.ts new file mode 100644 index 00000000..80fba7eb --- /dev/null +++ b/website/cypress/support/index.ts @@ -0,0 +1,22 @@ +// load type definitions that come with Cypress module +/// + +declare global { + namespace Cypress { + interface Chainable { + /** + * Custom command to sign in with a given email address + * @example cy.signInWithEmail('user@example.com') + */ + signInWithEmail(emailAddress: string): Chainable; + + /** + * Custom command to sign in with the link emailed to the given email address + * @example cy.signInUsingEmailedLink('user@example.com') + */ + signInUsingEmailedLink(emailAddress: string): Chainable; + } + } +} + +export {}; diff --git a/website/package-lock.json b/website/package-lock.json index 1587c01e..38f7446e 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -44,6 +44,7 @@ "devDependencies": { "@babel/core": "^7.20.7", "@chakra-ui/storybook-addon": "^4.0.16", + "@faker-js/faker": "^7.6.0", "@storybook/addon-actions": "^6.5.15", "@storybook/addon-essentials": "^6.5.15", "@storybook/addon-interactions": "^6.5.15", @@ -3591,6 +3592,16 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/@faker-js/faker": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-7.6.0.tgz", + "integrity": "sha512-XK6BTq1NDMo9Xqw/YkYyGjSsg44fbNwYRx7QK2CuoQgyy+f1rrTDHoExVM5PsyXCtfl2vs2vVJ0MN0yN6LppRw==", + "dev": true, + "engines": { + "node": ">=14.0.0", + "npm": ">=6.0.0" + } + }, "node_modules/@gar/promisify": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", @@ -31099,6 +31110,12 @@ } } }, + "@faker-js/faker": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-7.6.0.tgz", + "integrity": "sha512-XK6BTq1NDMo9Xqw/YkYyGjSsg44fbNwYRx7QK2CuoQgyy+f1rrTDHoExVM5PsyXCtfl2vs2vVJ0MN0yN6LppRw==", + "dev": true + }, "@gar/promisify": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", diff --git a/website/package.json b/website/package.json index bc1f3b69..2bd531a0 100644 --- a/website/package.json +++ b/website/package.json @@ -54,6 +54,7 @@ "devDependencies": { "@babel/core": "^7.20.7", "@chakra-ui/storybook-addon": "^4.0.16", + "@faker-js/faker": "^7.6.0", "@storybook/addon-actions": "^6.5.15", "@storybook/addon-essentials": "^6.5.15", "@storybook/addon-interactions": "^6.5.15", diff --git a/website/src/components/Header/UserMenu.tsx b/website/src/components/Header/UserMenu.tsx index c42d8895..cbd71787 100644 --- a/website/src/components/Header/UserMenu.tsx +++ b/website/src/components/Header/UserMenu.tsx @@ -34,7 +34,9 @@ export function UserMenu() { height="40" className="rounded-full" > -

    {session.user.name || session.user.email}

    +

    + {session.user.name || session.user.email} +

    diff --git a/website/src/pages/auth/signin.tsx b/website/src/pages/auth/signin.tsx index 2ead2414..a1af2326 100644 --- a/website/src/pages/auth/signin.tsx +++ b/website/src/pages/auth/signin.tsx @@ -41,7 +41,7 @@ export default function Signin({ csrfToken, providers }) { )} {email && ( -
    +