dall-e-3
modified: README.rst modified: app.py new file: flask-socketio-llm-completions-2.png
This commit is contained in:
parent
d5db3b274b
commit
f41e9e5bd9
3 changed files with 13 additions and 2 deletions
|
|
@ -3,11 +3,15 @@ flask-socketio-llm-completions
|
|||
|
||||
This project is a chatroom application that allows users to join different chat rooms, send messages, and interact with multiple language models in real-time. The backend is built with Flask and Flask-SocketIO for real-time web communication, while the frontend uses HTML, CSS, and JavaScript to provide an interactive user interface.
|
||||
|
||||
|
||||
.. image:: flask-socketio-llm-completions.png
|
||||
:alt: Flask-SocketIO LLM Completions
|
||||
:align: center
|
||||
|
||||
.. image:: flask-socketio-llm-completions-2.png
|
||||
:alt: Flask-SocketIO LLM Completions Dall-e-3
|
||||
:align: center
|
||||
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
|
|
@ -83,6 +87,7 @@ To interact with the various language models, you can use the following commands
|
|||
- For GPT-4, send a message with ``gpt-4`` including your prompt.
|
||||
- For Claude-v1, send a message with ``claude-v1`` including your prompt.
|
||||
- For Claude-v2, send a message with ``claude-v2`` including your prompt.
|
||||
- For Dall-e-3, send a message with ``dall-e-3`` including your prompt.
|
||||
|
||||
The system will process your message and provide a response from the selected language model.
|
||||
|
||||
|
|
|
|||
8
app.py
8
app.py
|
|
@ -716,6 +716,11 @@ def gpt_generate_room_title(messages, model_name):
|
|||
Generate a title for the room based on a list of messages.
|
||||
"""
|
||||
openai_client = OpenAI()
|
||||
|
||||
def is_base64_image(content):
|
||||
return "<img src=\"data:image/jpeg;base64," in content
|
||||
|
||||
|
||||
chat_history = [
|
||||
{
|
||||
"role": "system"
|
||||
|
|
@ -730,6 +735,7 @@ def gpt_generate_room_title(messages, model_name):
|
|||
"content": f"{msg.username}: {msg.content}",
|
||||
}
|
||||
for msg in reversed(messages)
|
||||
if not is_base64_image(msg.content)
|
||||
]
|
||||
|
||||
chat_history.append(
|
||||
|
|
@ -758,7 +764,7 @@ def generate_new_title(room_name, username):
|
|||
last_messages = (
|
||||
Message.query.filter_by(room_id=room.id)
|
||||
.order_by(Message.id.desc())
|
||||
.limit(10) # Adjust the limit as needed
|
||||
.limit(100) # Adjust the limit as needed
|
||||
.all()
|
||||
)
|
||||
|
||||
|
|
|
|||
BIN
flask-socketio-llm-completions-2.png
Normal file
BIN
flask-socketio-llm-completions-2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 854 KiB |
Loading…
Add table
Add a link
Reference in a new issue