Lenna  Kihn

Lenna Kihn

1672240440

An OpenAI Based Chat-bot That Is Similar to OpenAI's ChatGPT

GPT-Shell

GPT-Shell is an OpenAI based chat-bot that is similar to OpenAI's ChatGPT (https://chat.openai.com/).

It allows users to converse with a virtual companion. It uses nodejs and typescript, as well as modern yarn, to create a seamless conversation experience.

https://user-images.githubusercontent.com/108406948/207628213-c8bebc1b-ce72-45ba-907f-e0d6f51c27cd.mp4

 

Try it out

You can try the bot on the official Discord server:

Usage

Set up a discord bot and add it to your server.

Follow the setup instructions below.

To interact with GPT-Shell, users can:

  • Use the /chat-gpt command to start a conversation with the bot
  • Ping the bot in a channel it's in
  • Message the bot directly

The /chat-gpt command will start a new conversation thread, and whenever the user types something, the bot will respond.

The bot is able to handle multiple conversations at once, so you can start as many conversations as you like.

Setup

Prerequisites:

Nodejs: https://nodejs.org/en/ (18 or above) Yarn: https://nodejs.org/en/ (after installing nodejs)

To use GPT-Shell, you will need to:

  • Clone the project
  • Open the terminal in the project's folder
    • (in windows, right click somewhere in the folder and select "Open In Terminal")
    • if you see something about powershell, type cmd and hit enter, to go to the simpler command line terminal.
  • Run yarn install

You can also fork the replit:

https://replit.com/@Ephemeros/GPT-Shell

Set up the environment variables as described below.

Then to start a development environment, run yarn dev. To build and run, run yarn build and then yarn start.

Environment Variables

The following environment variables are required for GPT-Shell to work properly.

MongoDB:

  • MONGODB_URI: The MongoDB connection string.
    • Should look something like this: mongodb+srv://:..mongodb.net/?retryWrites=true&w=majority
  • DB_NAME: The name of the collection in MongoDB

Bot Token:

Commands:

  • COMMAND_NAME: The name of the chat-gpt command
  • API_KEY_COMMAND_NAME: The name of the chat-gpt-openai-api-key command (if you want users to add the bot to their server)

OpenAI API Key:

  • OPENAI_API_KEY: The API key for your OpenAI account

Discord Server Details:

  • MAIN_SERVER_ID: The Discord server where the bot lives
  • LOG_CHANNEL_ID: (Optional) The channel for log messages
  • MAIN_SERVER_INVITE: (Optional) The ideally non-expiring server invite link (if you want users to add the bot to their server)
  • USE_SAME_API_KEY_FOR_ALL: (Optional) When set to 'true', it will allow any server or user to use the bot without needing to provide their own API keys.

You can set the environment variables in any way you like, or place an .env.local file at the root of your project, next to package.json, that looks like this:

# MongoDB:
MONGODB_URI=
DB_NAME=

# Bot Token:
BOT_TOKEN=

# Commands:
COMMAND_NAME=chat-gpt
# API_KEY_COMMAND_NAME=chat-gpt-openai-api-key # enable this if you want the bot to be installed in other servers.

# OpenAI API Key:
OPENAI_API_KEY=

# Discord Server Details:
MAIN_SERVER_ID=
LOG_CHANNEL_ID=
MAIN_SERVER_INVITE=
USE_SAME_API_KEY_FOR_ALL=

Contributions

We welcome contributions to GPT-Shell. If you have an idea for a new feature or have found a bug, please open an issue on GitHub. We would also appreciate any sponsorships or donations.

You can sponsor us through our GitHub sponsor page here.


Download details:

Author: firtoz
Source code: https://github.com/firtoz/GPT-Shell

License: MIT license

#chatgpt #openai 

What is GEEK

Buddha Community

An OpenAI Based Chat-bot That Is Similar to OpenAI's ChatGPT
Zachary Palmer

Zachary Palmer

1555901576

CSS Flexbox Tutorial | Build a Chat Application

Creating the conversation sidebar and main chat section

In this article we are going to focus on building a basic sidebar, and the main chat window inside our chat shell. See below.

Chat shell with a fixed width sidebar and expanded chat window

This is the second article in this series. You can check out the previous article for setting up the shell OR you can just check out the chat-shell branch from the following repository.

https://github.com/lyraddigital/flexbox-chat-app.git

Open up the chat.html file. You should have the following HTML.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Chat App</title>
    <link rel="stylesheet" type="text/css" media="screen" href="css/chat.css" />
</head>
<body>
    <div id="chat-container">
    </div>
</body>
</html>

Now inside of the chat-container div add the following HTML.

<div id="side-bar">
</div>
<div id="chat-window">
</div>

Now let’s also add the following CSS under the #chat-container selector in the chat.css file.

#side-bar {
    background: #0048AA;
    border-radius: 10px 0 0 10px;
}
#chat-window {
    background: #999;
    border-radius: 0 10px 10px 0;
}

Now reload the page. You should see the following:-

So what happened? Where is our sidebar and where is our chat window? I expected to see a blue side bar and a grey chat window, but it’s no where to be found. Well it’s all good. This is because we have no content inside of either element, so it can be 0 pixels wide.

Sizing Flex Items

So now that we know that our items are 0 pixels wide, let’s attempt to size them. We’ll attempt to try this first using explicit widths.

Add the following width property to the #side-bar rule, then reload the page.

width: 275px;

Hmm. Same result. It’s still a blank shell. Oh wait I have to make sure the height is 100% too. So we better do that too. Once again add the following property to the #side-bar rule, then reload the page.

height: 100%;

So now we have our sidebar that has grown to be exactly 275 pixels wide, and is 100% high. So that’s it. We’re done right? Wrong. Let me ask you a question. How big is the chat window? Let’s test that by adding some text to it. Try this yourself just add some text. You should see something similar to this.

So as you can see the chat window is only as big as the text that’s inside of it, and it is not next to the side bar. And this makes sense because up until now the chat shell is not a flex container, and just a regular block level element.

So let’s make our chat shell a flex container. Set the following display property for the #chat-window selector. Then reload the page.

display: flex;

So as you can see by the above illustration, we can see it’s now next to the side bar, and not below it. But as you can see currently it’s only as wide as the text that’s inside of it.

But we want it to take up the remaining space of the chat shell. Well we know how to do this, as we did it in the previous article. Set the flex-grow property to 1 on the #chat-window selector. Basically copy and paste the property below and reload the page.

flex-grow: 1;

So now we have the chat window taking up the remaining space of the chat shell. Next, let’s remove the background property, and also remove all text inside the chat-window div if any still exists. You should now see the result below.

But are we done? Technically yes, but before we move on, let’s improve things a little bit.

Understanding the default alignment

If you remember, before we had defined our chat shell to be a flex container, we had to make sure we set the height of the side bar to be 100%. Otherwise it was 0 pixels high, and as a result nothing was displayed. With that said, try removing the height property from the #side-bar selector and see what happens when you reload the page. Yes that’s right, it still works. The height of the sidebar is still 100% high.

So what happened here? Why do we no longer have to worry about setting the height to 100%? Well this is one of the cool things Flexbox gives you for free. By default every flex item will stretch vertically to fill in the entire height of the flex container. We can in fact change this behaviour, and we will see how this is done in a future article.

Setting the size of the side bar properly

So another feature of Flexbox is being able to set the size of a flex item by using the flex-basis property. The flex-basis property allows you to specify an initial size of a flex item, before any growing or shrinking takes place. We’ll understand more about this in an upcoming article.

For now I just want you to understand one important thing. And that is using width to specify the size of the sidebar is not a good idea. Let’s see why.

Say that potentially, if the screen is mobile we want the side bar to now appear across the top of the chat shell, acting like a top bar instead. We can do this by changing the direction flex items can flex inside a flex container. For example, add the following CSS to the #chat-container selector. Then reload the page.

flex-direction: column;

So as you can see we are back to a blank shell. So firstly let’s understand what we actually did here. By setting the flex-direction property to column, we changed the direction of how the flex items flex. By default flex items will flex from left to right. However when we set flex-direction to column, it changes this behaviour forcing flex items to flex from top to bottom instead. On top of this, when the direction of flex changes, the sizing and alignment of flex items changes as well.

When flexing from left to right, we get a height of 100% for free as already mentioned, and then we made sure the side bar was set to be 275 pixels wide, by setting the width property.

However now that we a flexing from top to bottom, the width of the flex item by default would be 100% wide, and you would need to specify the height instead. So try this. Add the following property to the #side-bar selector to set the height of the side bar. Then reload the page.

height: 275px;

Now we are seeing the side bar again, as we gave it a fixed height too. But we still have that fixed width. That’s not what we wanted. We want the side bar (ie our new top bar) here to now be 100% wide. Comment out the width for a moment and reload the page again.

So now we were able to move our side bar so it appears on top instead, acting like a top bar. Which as previously mentioned might be suited for mobile device widths. But to do this we had to swap the value of width to be the value of height. Wouldn’t it be great if this size was preserved regardless of which direction our items are flexing.

Try this, remove all widths and height properties from the #side-bar selector and write the following instead. Then reload the page.

flex-basis: 275px;

As you can see we get the same result. Now remove the flex-direction property from the #chat-container selector. Then once again reload the page.

Once again we are back to our final output. But now we also have the flexibility to easily change the side bar to be a top bar if we need to, by just changing the direction items can flow. Regardless of the direction of flex, the size of our side bar / top bar is preserved.

Conclusion

Ok so once again we didn’t build much, but we did cover a lot of concepts about Flexbox around sizing. 

#css #programming #webdev 

Lenna  Kihn

Lenna Kihn

1672240440

An OpenAI Based Chat-bot That Is Similar to OpenAI's ChatGPT

GPT-Shell

GPT-Shell is an OpenAI based chat-bot that is similar to OpenAI's ChatGPT (https://chat.openai.com/).

It allows users to converse with a virtual companion. It uses nodejs and typescript, as well as modern yarn, to create a seamless conversation experience.

https://user-images.githubusercontent.com/108406948/207628213-c8bebc1b-ce72-45ba-907f-e0d6f51c27cd.mp4

 

Try it out

You can try the bot on the official Discord server:

Usage

Set up a discord bot and add it to your server.

Follow the setup instructions below.

To interact with GPT-Shell, users can:

  • Use the /chat-gpt command to start a conversation with the bot
  • Ping the bot in a channel it's in
  • Message the bot directly

The /chat-gpt command will start a new conversation thread, and whenever the user types something, the bot will respond.

The bot is able to handle multiple conversations at once, so you can start as many conversations as you like.

Setup

Prerequisites:

Nodejs: https://nodejs.org/en/ (18 or above) Yarn: https://nodejs.org/en/ (after installing nodejs)

To use GPT-Shell, you will need to:

  • Clone the project
  • Open the terminal in the project's folder
    • (in windows, right click somewhere in the folder and select "Open In Terminal")
    • if you see something about powershell, type cmd and hit enter, to go to the simpler command line terminal.
  • Run yarn install

You can also fork the replit:

https://replit.com/@Ephemeros/GPT-Shell

Set up the environment variables as described below.

Then to start a development environment, run yarn dev. To build and run, run yarn build and then yarn start.

Environment Variables

The following environment variables are required for GPT-Shell to work properly.

MongoDB:

  • MONGODB_URI: The MongoDB connection string.
    • Should look something like this: mongodb+srv://:..mongodb.net/?retryWrites=true&w=majority
  • DB_NAME: The name of the collection in MongoDB

Bot Token:

Commands:

  • COMMAND_NAME: The name of the chat-gpt command
  • API_KEY_COMMAND_NAME: The name of the chat-gpt-openai-api-key command (if you want users to add the bot to their server)

OpenAI API Key:

  • OPENAI_API_KEY: The API key for your OpenAI account

Discord Server Details:

  • MAIN_SERVER_ID: The Discord server where the bot lives
  • LOG_CHANNEL_ID: (Optional) The channel for log messages
  • MAIN_SERVER_INVITE: (Optional) The ideally non-expiring server invite link (if you want users to add the bot to their server)
  • USE_SAME_API_KEY_FOR_ALL: (Optional) When set to 'true', it will allow any server or user to use the bot without needing to provide their own API keys.

You can set the environment variables in any way you like, or place an .env.local file at the root of your project, next to package.json, that looks like this:

# MongoDB:
MONGODB_URI=
DB_NAME=

# Bot Token:
BOT_TOKEN=

# Commands:
COMMAND_NAME=chat-gpt
# API_KEY_COMMAND_NAME=chat-gpt-openai-api-key # enable this if you want the bot to be installed in other servers.

# OpenAI API Key:
OPENAI_API_KEY=

# Discord Server Details:
MAIN_SERVER_ID=
LOG_CHANNEL_ID=
MAIN_SERVER_INVITE=
USE_SAME_API_KEY_FOR_ALL=

Contributions

We welcome contributions to GPT-Shell. If you have an idea for a new feature or have found a bug, please open an issue on GitHub. We would also appreciate any sponsorships or donations.

You can sponsor us through our GitHub sponsor page here.


Download details:

Author: firtoz
Source code: https://github.com/firtoz/GPT-Shell

License: MIT license

#chatgpt #openai 

Sival Alethea

Sival Alethea

1624410000

Create A Twitter Bot With Python

Create a Twitter bot with Python that tweets images or status updates at a set interval. The Python script also scrapes the web for data.

📺 The video in this post was made by freeCodeCamp.org
The origin of the article: https://www.youtube.com/watch?v=8u-zJVVVhT4&list=PLWKjhJtqVAbnqBxcdjVGgT3uVR10bzTEB&index=14
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#python #a twitter bot #a twitter bot with python #bot #bot with python #create a twitter bot with python

Noelia  Douglas

Noelia Douglas

1672182660

QChatGPT: QQ Robot Bot Developed Based on OpenAI ChatGPT

QChatGPT🤖

测试号: 2196084348

交流、答疑群: 204785790

  • 进群提问前请您确保已经找遍文档和issue均无法解决
  • 进群提问前请您确保已经找遍文档和issue均无法解决
  • 进群提问前请您确保已经找遍文档和issue均无法解决

QQ频道机器人见QQChannelChatGPT

通过调用OpenAI GPT-3模型提供的Completion API来实现一个更加智能的QQ机器人

✅功能

以下是功能特色,点击展开查看具体使用方法

✅回复符合上下文

  • 程序向模型发送近几次对话内容,模型根据上下文生成回复
  • 您可在config.py中修改process_message_timeout自定义联系上下文的范围

✅支持敏感词过滤,避免账号风险

  • 难以监测机器人与用户对话时的内容,故引入此功能以减少机器人风险
  • 编辑sensitive.json,并在config.py中修改sensitive_word_filter的值以开启此功能

✅使用官方api,不需要网络代理,稳定快捷

  • 不使用ChatGPT逆向接口,而使用官方的Completion API,稳定性高
  • 您可以在config.py中自定义completion_api_params字段,设置向官方API提交的参数以自定义机器人的风格

✅完善的多api-key管理,超额自动切换

  • 支持配置多个api-key,内部统计使用量并在超额时自动切换
  • 请在config.py中修改openai_config的值以设置api-key
  • 可以在config.py中修改api_key_usage_threshold来自定义切换阈值
  • 运行期间向机器人说!usage以查看当前使用情况

✅组件少,部署方便,提供一键安装器及Docker安装

  • 手动部署步骤少
  • 提供自动安装器及docker方式,详见以下安装步骤

✅支持预设指令文字

  • 支持以自然语言预设文字,自定义机器人人格等信息
  • 详见config.py中的default_prompt部分

✅完善的会话管理,重启不丢失

  • 使用SQLite进行会话内容持久化
  • 最后一次对话一定时间后自动保存,请到config.py中修改session_expire_time的值以自定义时间
  • 运行期间可使用!reset !list !last !next !prompt等指令管理会话

💻技术栈

  • Mirai 高效率 QQ 机器人支持库
  • YiriMirai 一个轻量级、低耦合的基于 mirai-api-http 的 Python SDK。
  • OpenAI API OpenAI API

🧱项目结构

  • pkg.database 数据库操作相关
    • 数据库用于存放会话的历史记录,确保在程序重启后能记住对话内容
  • pkg.openai OpenAI API相关
    • 用于调用OpenAI的API生成回复内容
  • pkg.qqbot QQ机器人相关
    • 处理QQ收到的消息,调用API并进行回复

🔩部署

部署过程中遇到任何问题,请先在QChatGPTqcg-installer的issue里进行搜索

注册OpenAI账号

参考以下文章

只需 1 元搞定 ChatGPT 注册
手把手教你如何注册ChatGPT,超级详细

注册成功后请前往个人中心查看api_key
完成注册后,使用以下自动化或手动部署步骤

自动化部署

以下方式二选一,Linux首选Docker,Windows首选安装器

Docker方式

请查看此仓库mikumifa/QChatGPT-Docker-Installer

安装器方式

使用此安装器(若无法访问请到Gitee)进行部署

  • 安装器目前仅支持部分平台,请到仓库文档查看,其他平台请手动部署

手动部署

手动部署适用于所有平台

  • 请使用Python 3.9.x以上版本
  • 请注意OpenAI账号额度消耗
    • 每个账户仅有18美元免费额度,如未绑定银行卡,则会在超出时报错
    • OpenAI收费标准:默认使用的text-davinci-003模型 0.02美元/千字

配置Mirai

按照此教程配置Mirai及YiriMirai
启动mirai-console后,使用login命令登录QQ账号,保持mirai-console运行状态

配置主程序

  1. 克隆此项目
git clone https://github.com/RockChinQ/QChatGPT
cd QChatGPT
  1. 安装依赖
pip3 install pymysql yiri-mirai openai colorlog func_timeout
  1. 运行一次主程序,生成配置文件
python3 main.py
  1. 编辑配置文件config.py

按照文件内注释填写配置信息

  1. 运行主程序
python3 main.py

无报错信息即为运行成功

常见问题

  • mirai登录提示QQ版本过低,见此issue
  • 如提示安装uvicornhypercorn不要安装,这两个不是必需的,目前存在未知原因bug
  • 如报错TypeError: As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary, 请参考 此处

🚀使用

私聊使用

  1. 添加机器人QQ为好友
  2. 发送消息给机器人,机器人即会自动回复
  3. 可以通过!help查看帮助信息

私聊示例

群聊使用

  1. 将机器人拉进群
  2. at机器人并发送消息,机器人即会自动回复
  3. at机器人并发送!help查看帮助信息

群聊示例


Download Details:

Author: RockChinQ
Source Code: https://github.com/RockChinQ/QChatGPT

License: AGPL-3.0 license

#chatgpt #openai 

Mary  Turcotte

Mary Turcotte

1672318157

ChatGPT Kodyfire: Interact with ChatGPT Chat Bot

ChatGPT-kodyfire

Interact with the unofficial ChatGPT API chatbot and export the conversation to Markdown and more using Kodyfire.

Homepage

Requirements

  1. kodyfire-cli to be installed
npm install -g kodyfire-cli
  1. Node version >= 18
  2. OPENAI_EMAIL and OPENAI_PASSWORD in .env these are your Openai credentials.
  3. The package uses chatgpt-api. Puppeteer is used to handle the authentication. You will need to manually handle any recaptcha. This will probably change once Openai releases the official api.

Install

npm i chatgpt-kodyfire

 

Usage

In order to generate your exports, run the generate command. As an example, run the following command from your terminal:

kody generate chatgpt:md topic-no-space

Available concepts

md

Initiate a new chat session and saves the output to an md file.

x

@todo: requested concepts by the community.

Usage

kody g chatgpt:md

Arguments

  • kody string - The name of the kody. chatgpt in our case. You can have multiple kodies installed. To list your installed kodies with your project run kody list
  • concept string - The name of the concept you want to execute. To list the concepts of your installed kody (chatgpt), run kody list chatgpt
  • topic string - The topic question to start the conversation with no spaces. This will be used as filename

📅 Future Features

  • Output conversation to a text file
  • Extract code and save using provided extension
  • Output conversation to Word
  • Output conversation to Excel or CSV
  • Live run code and feedback output back to Chatgpt
  • Generate an image using Dalle|other and a description provided by chatgpt
  • Use Google https://github.com/googleapis/nodejs-text-to-speech
  • Generate an audio file using Google text-to-speech api

Author

Anis Marrouchi

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

Credits


Download details:

Author: nooqta
Source code: https://github.com/nooqta/chatgpt-kodyfire

License: MIT license

#chatgpt #openai