feat: Add discord bot

Former-commit-id: 9f47cc2bff
discord-bot
Zack 2 years ago
parent d47e8d1efe
commit 213053cc1e

@ -0,0 +1,28 @@
name: Run Python script
on:
push:
branches:
- discord-bot
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install Gradio
run: python -m pip install gradio
- name: Log in to Hugging Face
run: python -c 'import huggingface_hub; huggingface_hub.login(token="${{ secrets.hf_token }}")'
- name: Deploy to Spaces
run: gradio deploy

@ -1,3 +1,9 @@
---
title: omni_bot
app_file: omni_ui.py
sdk: gradio
sdk_version: 3.33.1
---
![Swarming banner icon](images/swarmsbanner.png) ![Swarming banner icon](images/swarmsbanner.png)
<div align="center"> <div align="center">

@ -0,0 +1,12 @@
Monitezation of the Swarm
=========================
The swarm is a free and open source frame work for building autonous agents in the form of swarms
some possible ways to monitize the swarm are:
- selling the swarm as a service
-through eg the domain where users can pay a fee to have their swarm hosted on the swarm server
-Consumer interface for them to interact with their swarm subscription 99 per month interact
-swarm as a service

@ -57,7 +57,9 @@ group = GroupChat(
manager = GroupChatManager( manager = GroupChatManager(
groupchat=group, groupchat=group,
max_consecutive_auto_reply=3, # max_consecutive_auto_reply=3,
# human_input_mode="NEVER",
# system_message="Group chat manager"
) )
output = group.run( output = group.run(

@ -7,19 +7,23 @@ import base64
from langchain.llms import OpenAIChat from langchain.llms import OpenAIChat
from swarms.agents import OmniModalAgent from swarms.agents import OmniModalAgent
import gradio_client as grc import gradio_client as grc
from dspy import Program, Prompt, Finetune, Decompose
from dspy import Program, Prompt, Finetune, Decompose
from dspy.retrieval import retrieve
grc.Client("Wawaa/omniagent").deploy_discord() program = Program(
Decompose(
# Function to convert image to base64 Prompt("I have 4 shirts that take 5hrs to dry long shoul")
)
grc.Client("Wawaa/omni_bot").deploy_discord()
# Function to convert image to base64
def image_to_base64(image_path): def image_to_base64(image_path):
with open(image_path, "rb") as image_file: with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode() return base64.b64encode(image_file.read()).decode()
# Function to get the most recently created image in the directory # Function to get the most recently created image in the directory
def get_latest_image(): def get_latest_image():
list_of_files=glob.glob('./*.png') # Replace with your image file type list_of_files=glob.glob('./*.png') # Replace with your image file type
if not list_of_files: if not list_of_files:
@ -36,8 +40,6 @@ agent = OmniModalAgent(llm) # Replace with your actual initialization
chat_history=[] chat_history=[]
# Function to update chat # Function to update chat
def update_chat(user_input): def update_chat(user_input):
global chat_history global chat_history
chat_history.append({"type": "user", "content": user_input}) chat_history.append({"type": "user", "content": user_input})
@ -59,8 +61,6 @@ def update_chat(user_input):
return render_chat(chat_history) return render_chat(chat_history)
# Function to render chat as HTML # Function to render chat as HTML
def render_chat(chat_history): def render_chat(chat_history):
chat_str="<div style='max-height:400px;overflow-y:scroll;'>" chat_str="<div style='max-height:400px;overflow-y:scroll;'>"
for message in chat_history: for message in chat_history:
@ -85,8 +85,6 @@ iface = Interface(
) )
# Function to update the chat display # Function to update the chat display
def update_display(): def update_display():
global chat_history global chat_history
while True: while True:

@ -77,14 +77,14 @@ class GroupChatManager(Worker):
def __init__( def __init__(
self, self,
groupchat: GroupChat, groupchat: GroupChat,
ai_name: Optional[str] = "chat_manager", name: Optional[str] = "chat_manager",
max_consecutive_auto_reply: Optional[int] = sys.maxsize, max_consecutive_auto_reply: Optional[int] = sys.maxsize,
human_input_mode: Optional[str] = "NEVER", human_input_mode: Optional[str] = "NEVER",
system_message: Optional[str] = "Group chat manager", system_message: Optional[str] = "Group chat manager",
**kwargs **kwargs
): ):
super().__init__( super().__init__(
ai_name=ai_name, name=name,
max_consecutive_auto_reply=max_consecutive_auto_reply, max_consecutive_auto_reply=max_consecutive_auto_reply,
human_input_mode=human_input_mode, human_input_mode=human_input_mode,
system_message=system_message, system_message=system_message,

Loading…
Cancel
Save