请随时给我买咖啡,以帮助支持该项目。
SOWY是一种聊天机器人,可以使用本地图像生成器(FLUX)和/或DALL-E 3生成图像。为聊天,它使用JSON,CHATGPT和本地搜索引擎的组合来与用户进行对话。它将为您的用户聊天消息索引,并使用这些消息来创建用户的配置文件。它还将为您的服务器上的每个通道索引其访问权限。
有多种汤。
汤需要Openai API访问ChatGpt型号。因此,汤的聊天部分使用了真实的钱。 DALL-E 3图像也确实如此。您可以跳过dall-e 3代,只能在本地使用通量。
最初的设置,其中将下载和索引服务器的频道历史记录,并且服务器上的所有用户都将通过Chatgpt的API进行资金。有一天,我还将支持当地的LLM,但尚未支持。
为了使通量工作,我强烈建议您从官方的通量存储库开始。但是,一旦上升和奔跑,您就可以使用此存储库中包含的soupy-gradio.py 。
!flux (本地映像模型) !generate (dall-e 3),! !analyze (chatgpt)和!transform (chatgpt)等各种令人惊奇的命令,以执行一系列酷动作。.env中的BEHAVIOUR变量来执行此操作。但是要小心您如何更改它。它的措辞对于保持略带的轨道很重要。 在设置汤之前,请确保系统上安装了以下内容:
首先将汤库克隆到您当地的机器:
git clone https://github.com/sneezeparty/soupy.git
cd soupy
建议使用虚拟环境来管理依赖关系。
python -m venv soupy
激活虚拟环境:
在MacOS和Linux上:
source soupy/bin/activate
在Windows上:
soupyScriptsactivate
使用pip安装所需的Python软件包:
pip install -r requirements.txt
在项目的根目录中创建.env文件,并使用必要的环境变量填充它:
DISCORD_TOKEN=your_discord_bot_token
OPENAI_API_KEY=your_openai_api_key
CHANNEL_IDS=00,11
MAX_TOKENS=2500
MAX_TOKENS_RANDOM=75
MODEL_CHAT=gpt-4o-mini
UPDATE_INTERVAL_MINUTES=61
TRANSFORM="You give detailed and accurate descriptions, be specific in whatever ways you can, such as but not limited to colors, species, poses, orientations, objects, and contexts."
BEHAVIOUR="You are Soupy Dafoe, a sarcastic and witty Discord chatbot. You recall past interactions and conversations to inform your responses. Your replies are concise, straightforward, and infused with a bit of sarcasm, much like Jules from "Pulp Fiction." You are not overly positive and avoid asking questions unless necessary. Prioritize the most recent five messages when formulating your responses, especially if not directly mentioned. If the latest message is brief, focus your reply accordingly and consider ignoring extensive chat history. Integrate the user's profile information subtly to tailor your responses without making it the main focus. Be conversational, stay in the moment, and avoid being too random or wordy. Remember, you're kind of a jerk, but in a human-like way."
请注意,汤将可以访问它可以访问的所有渠道。但是它将响应上面指定的渠道中的所有消息。否则,它只会随机响应,或者@tagged时。
在脚本中,搜索“/absolute/directory/of/of/your/script/”,然后用脚本位置的绝对目录替换为脚本。
Apache Solr用于索引和搜索消息和用户配置文件。请按照以下步骤安装和配置Solr以备汤。
下载Solr :访问Apache Solr网站并下载最新的稳定版本。您也可以使用一些软件包经理 - 查看发行版的信息。
提取包装
安装Solr作为服务:按照此过程的确切步骤遵循文档。不过,这并不难。你可以做到。
验证安装:
打开浏览器并导航到http://localhost:8983/solr访问Solr Admin接口。
SOWY需要一个具有特定字段的单一SOLR核心来有效地索引用户配置文件。
bin/solr create -c soupy
将必要的字段添加到soupy芯中以存储用户配置文件。
访问Solr Admin接口:
导航到http://localhost:8983/solr ,然后选择soupy芯。
定义字段:
curl -X POST -H 'Content-type:application/json'
http://localhost:8983/solr/soupy/schema
-d '{
"add-field": {
"name": "id",
"type": "string",
"indexed": true,
"stored": true,
"required": true,
"multiValued": false
}
}'
或这个
curl -X POST -H "Content-Type: application/json"
"http://localhost:8983/solr/soupy/schema"
-d '{
"add-field":{
"name":"user_problems",
"type":"text_general",
"indexed":true,
"stored":true
}
}'
将必要的字段添加到soupy芯中,以存储用户配置文件和渠道信息。
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false"/>
<field name="username" type="string" indexed="true" stored="true"/>
<field name="nicknames" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="join_date" type="date" indexed="true" stored="true"/>
<field name="political_party" type="string" indexed="true" stored="true"/>
<field name="user_job_career" type="text_general" indexed="true" stored="true"/>
<field name="user_family_friends" type="text_general" indexed="true" stored="true"/>
<field name="user_activities" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_games" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_movies" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_music" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_television" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_life" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_food" type="text_general" indexed="true" stored="true"/>
<field name="general_opinions" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_politics" type="text_general" indexed="true" stored="true"/>
<field name="personality_traits" type="text_general" indexed="true" stored="true"/>
<field name="hobbies" type="text_general" indexed="true" stored="true"/>
<field name="user_interests" type="text_general" indexed="true" stored="true"/>
<field name="user_problems" type="text_general" indexed="true" stored="true"/>
<field name="tech_interests" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_technology" type="text_general" indexed="true" stored="true"/>
<field name="sports_interests" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_sports" type="text_general" indexed="true" stored="true"/>
<field name="book_preferences" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_books" type="text_general" indexed="true" stored="true"/>
<field name="art_interests" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_art" type="text_general" indexed="true" stored="true"/>
<field name="health_concerns" type="text_general" indexed="true" stored="true"/>
<field name="health_habits" type="text_general" indexed="true" stored="true"/>
<field name="science_interests" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_science" type="text_general" indexed="true" stored="true"/>
<field name="travel_preferences" type="text_general" indexed="true" stored="true"/>
<field name="travel_experiences" type="text_general" indexed="true" stored="true"/>
<field name="food_preferences" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_food" type="text_general" indexed="true" stored="true"/>
<field name="last_updated" type="date" indexed="true" stored="true"/>
<field name="channel_id" type="string" indexed="true" stored="true" required="true" multiValued="false"/>
<field name="username" type="string" indexed="true" stored="true"/>
<field name="content" type="text_general" indexed="true" stored="true"/>
<field name="timestamp" type="pdate" indexed="true" stored="true"/>
提交更改:
添加所有字段后,提交更改以使其有效。
完成安装和配置步骤后,您可以使用以下命令启动机器人。第一次运行将需要一段时间,具体取决于服务器上的活动和用户数量。可能需要几分钟或数小时。终端输出将告诉您要做什么。
python soupy-solr.py
或者
python soupy-flux.py
和
python gradio-soupy.py
确保您处于soupy的虚拟环境和正确目录中。
gradio-soupy.py是基于Gradio的Flux的后端。您也可以通过浏览器访问此功能。
!flux使用Flux模型生成图像,并支持各种修饰符和交互式按钮,以进一步自定义。
并使用 - 固定修饰符,或使用“重写”按钮:
修饰符:
--wide :生成宽图像(1920x1024)。--tall :生成一个高图(1024x1920)。--small :生成一个小图像(512x512)。--fancy :详细说明提示更具创造力和详细。这使用Chatgpt的通过API。--seed <number> :使用特定种子进行图像生成。用法:
!flux A mystical forest with glowing plants --tall
使用!flux命令生成图像后,soupy提供了交互式按钮以进行进一步的自定义:
Remix :基于现有提示以及新的随机种子生成新图像。Rewrite :详细说明提示提高创造力和细节。这使用Chatgpt的API(与--fancy修饰符相同)。Wide :将图像尺寸调整为广泛的格式。Tall :将图像尺寸调整为高度格式。 !generate基于带有可选修饰符的文本提示,使用DALL-E 3生成图像。这可能很快就会弃用。
修饰符:
--wide :生成宽图像(1920x1024)。--tall :生成一个高图(1024x1920)。用法:
!generate A futuristic city skyline at sunset --wide
!analyze根据提供的说明分析附件的图像,例如在图像中翻译文本或识别对象及其属性。
用法:
!analyze Identify all the animals in this image.
!analyze Describe this image forensically.
使用此命令时附加图像。
!8ball向魔术8球问一个问题。不使用LLM或任何ML。
用法:
!8ball Will I get an A on my exam?
!whattime在指定城市中获取并显示当前时间。
用法:
!whattime New York
该项目已根据MIT许可获得许可。
MIT许可证版权(C)2024 Sneezeparty
特此免费授予任何获得此软件副本和相关文档文件副本(“软件”)的人,以无限制处理软件,包括无限制的使用权,复制,复制,修改,合并,合并,分发,发行,分发,分发,分布,订婚,和/或允许其允许的人允许以下条件,并指出以下条件,并指出以下条件,并指出以下内容,请注意以下内容:该软件的副本或大量部分。
该软件是“原样”提供的,没有任何形式的明示或暗示保证,包括但不限于适销性,特定目的的适用性和非侵权的保证。在任何情况下,作者或版权持有人都不应对任何索赔,损害赔偿或其他责任责任,无论是在合同,侵权的诉讼中还是其他责任,是由软件,使用或与软件中的使用或其他交易有关的。
如果您遇到任何问题或有疑问,请随时在存储库的GitHub问题部分中打开问题。
给我买咖啡来帮助支持这个项目。