請隨時給我買咖啡,以幫助支持該項目。
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問題部分中打開問題。
給我買咖啡來幫助支持這個項目。