1672240440
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.
You can try the bot on the official Discord server:
Set up a discord bot and add it to your server.
Follow the setup instructions below.
To interact with GPT-Shell, users can:
/chat-gpt
command to start a conversation with the botThe /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.
Nodejs: https://nodejs.org/en/ (18 or above) Yarn: https://nodejs.org/en/ (after installing nodejs)
To use GPT-Shell, you will need to:
cmd
and hit enter, to go to the simpler command line terminal.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
.
The following environment variables are required for GPT-Shell to work properly.
MongoDB:
Bot Token:
Commands:
OpenAI API Key:
Discord Server Details:
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=
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.
Author: firtoz
Source code: https://github.com/firtoz/GPT-Shell
License: MIT license
1555901576
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
1672240440
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.
You can try the bot on the official Discord server:
Set up a discord bot and add it to your server.
Follow the setup instructions below.
To interact with GPT-Shell, users can:
/chat-gpt
command to start a conversation with the botThe /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.
Nodejs: https://nodejs.org/en/ (18 or above) Yarn: https://nodejs.org/en/ (after installing nodejs)
To use GPT-Shell, you will need to:
cmd
and hit enter, to go to the simpler command line terminal.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
.
The following environment variables are required for GPT-Shell to work properly.
MongoDB:
Bot Token:
Commands:
OpenAI API Key:
Discord Server Details:
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=
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.
Author: firtoz
Source code: https://github.com/firtoz/GPT-Shell
License: MIT license
1624410000
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
1672182660
测试号: 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,不需要网络代理,稳定快捷
config.py
中自定义completion_api_params
字段,设置向官方API提交的参数以自定义机器人的风格✅完善的多api-key管理,超额自动切换
api-key
,内部统计使用量并在超额时自动切换config.py
中修改openai_config
的值以设置api-key
config.py
中修改api_key_usage_threshold
来自定义切换阈值!usage
以查看当前使用情况✅组件少,部署方便,提供一键安装器及Docker安装
✅支持预设指令文字
config.py
中的default_prompt
部分✅完善的会话管理,重启不丢失
config.py
中修改session_expire_time
的值以自定义时间!reset
!list
!last
!next
!prompt
等指令管理会话pkg.database
数据库操作相关pkg.openai
OpenAI API相关pkg.qqbot
QQ机器人相关部署过程中遇到任何问题,请先在QChatGPT或qcg-installer的issue里进行搜索
参考以下文章
注册成功后请前往个人中心查看api_key
完成注册后,使用以下自动化或手动部署步骤
以下方式二选一,Linux首选Docker,Windows首选安装器
请查看此仓库mikumifa/QChatGPT-Docker-Installer
手动部署适用于所有平台
text-davinci-003
模型 0.02美元/千字按照此教程配置Mirai及YiriMirai
启动mirai-console后,使用login
命令登录QQ账号,保持mirai-console运行状态
git clone https://github.com/RockChinQ/QChatGPT
cd QChatGPT
pip3 install pymysql yiri-mirai openai colorlog func_timeout
python3 main.py
config.py
按照文件内注释填写配置信息
python3 main.py
无报错信息即为运行成功
常见问题
QQ版本过低
,见此issueuvicorn
或hypercorn
请不要安装,这两个不是必需的,目前存在未知原因bugTypeError: As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary
, 请参考 此处!help
查看帮助信息!help
查看帮助信息Author: RockChinQ
Source Code: https://github.com/RockChinQ/QChatGPT
License: AGPL-3.0 license
1672318157
Interact with the unofficial ChatGPT API chatbot and export the conversation to Markdown and more using Kodyfire.
npm install -g kodyfire-cli
OPENAI_EMAIL
and OPENAI_PASSWORD
in .env these are your Openai credentials.npm i chatgpt-kodyfire
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
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 filenameDalle
|other and a description provided by chatgptAnis Marrouchi
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
Author: nooqta
Source code: https://github.com/nooqta/chatgpt-kodyfire
License: MIT license