From 738352a063c5a9e7e1b08c141f6b8f3d4c8e9ac9 Mon Sep 17 00:00:00 2001 From: nsde Date: Thu, 3 Aug 2023 20:40:54 +0200 Subject: [PATCH] Added more tutorials --- cord/bot.py | 13 ++++++++- cord/credential_manager.py | 1 + cord/tutorials.py | 55 +++++++++++++++++++++++++++++++++++++- 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/cord/bot.py b/cord/bot.py index 3d13885..59d95b0 100644 --- a/cord/bot.py +++ b/cord/bot.py @@ -76,7 +76,18 @@ async def tutorial(interaction: nextcord.Interaction, how_can_i: str = SlashOption(# description='Read a tutorial on how to...', required=True, - choices=['fix ModuleNotFoundErrors', 'use the Python library', 'use curl', 'use Node.js', 'program a Python Discord Bot with streaming'] + choices=[ + 'fix error 401 (invalid key)', + 'fix error 429 (ratelimit/not enough credits)', + 'use GPT-4', + 'use curl', + 'use Node.js', + 'get my NovaAI API key', + 'use the Python library', + 'fix ModuleNotFoundErrors', + 'use the API in custom front-ends', + 'program a Python Discord Bot with streaming', + ] ) ): return await tutorials.send(interaction, how_can_i) diff --git a/cord/credential_manager.py b/cord/credential_manager.py index 5fcbb35..60f3986 100644 --- a/cord/credential_manager.py +++ b/cord/credential_manager.py @@ -67,6 +67,7 @@ We reserve the right to __disable your API key at any time__ if you violate our If you accept the terms of service and privacy policy, feel free to use the following API key: ## ||`{api_key}`|| +(Don't see anything? Click the empty space above to reveal it.) Learn more about how to use our API at **https://nova-oss.com**. """, ephemeral=True) diff --git a/cord/tutorials.py b/cord/tutorials.py index c227caf..90d819e 100644 --- a/cord/tutorials.py +++ b/cord/tutorials.py @@ -1,6 +1,59 @@ import embedder async def send(interaction, how_can_i): + if how_can_i == 'fix error 429 (ratelimit/not enough credits)': + text = """This means you used the API too often. You can either wait or: +- boost the server +- donate cryptocurrency (and contact us before or after so we can verify it was you) +- contribute in any meaningful (we decide) way (programming, research, design, moderating the Discord etc.) + +If you try to bypass this, all your accounts and IP addresses may get banned. +""" + + if how_can_i == 'fix error 401 (invalid key)': + text = """Make sure you entered your NovaAI API key (starting with `nv-`) correctly. +For HTTP requests, it can be specified using a header: +``` +Authorization: Bearer nv-... +``` +""" + + if how_can_i == 'use GPT-4': + text = """Yes, we support GPT-4. For free. You read that correctly. +Please note though that it might not be very stable or support every parameter. + +Simply set the model to `gpt-4`. That's it <3 +""" + + if how_can_i == 'use the API in custom front-ends': + text = """Depending on the front end, the endpoints might differ a bit: + +**ChatGPT Next Web** +(https://chat-gpt-next-web.vercel.app/): +`https://api.nova-oss.com` + +Code: https://github.com/Yidadaa/ChatGPT-Next-Web + +**Better ChatGPT** +(https://chat.resisto.rodeo/, https://chatgpt1.nextweb.fun/, https://freechatgpt.chat/, https://bettergpt.chat/): +`https://api.nova-oss.com/v1/chat/completions` + +Code: https://github.com/ztjhz/BetterChatGPT + + +Don't forget to also set the correct model and API key! + +**Warning:** in theory, these front-ends could __steal your NovaAI key__. +Self-host them if you know how to. Otherwise, wait for us to create a official NovaAI front-end. +""" + + if how_can_i == 'get my NovaAI API key': + text = """Open up the **`#commands`** channel and run **`/credentials`**. +Then, follow the instructions carefully. + +Fore more information: https://nova-oss.com/novacord +""" + if how_can_i == 'fix ModuleNotFoundErrors': text = """You can install Python packages using `pip`. Here's an example: `pip install openai`. Don't have `pip` installed? Learn more here: https://pip.pypa.io/en/stable/installation/. @@ -127,4 +180,4 @@ async def chat(interaction: nextcord.Interaction, bot.run(os.getenv('DISCORD_TOKEN')) ``` """ - return await embedder.info(interaction, text) + return await embedder.info(interaction, title=f'Tutorial: "{how_can_i}"', text=text)