Skip to content

Commit

Permalink
modify some code and update chainlit 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgrsc committed Oct 25, 2024
1 parent 94a16a3 commit 79fdbeb
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 103 deletions.
9 changes: 5 additions & 4 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
from utils.logger import logger
from chainlit.config import config

# setting default tag and history
@cl.on_chat_start
def start_chat():
cl.user_session.set("is_new_session", True)

# Construct a new conversation setting system prompt.
async def handle_new_session(user_input: str):
Expand All @@ -28,6 +24,11 @@ async def handle_new_session(user_input: str):

cl.user_session.set("is_new_session", False)

# setting default tag and history
@cl.on_chat_start
def start_chat():
cl.user_session.set("is_new_session", True)

# main logic ,receive message will call this function
@cl.on_message
async def main(message: cl.Message):
Expand Down
7 changes: 1 addition & 6 deletions src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,5 @@ async def chat_profile():

# get model for profile
def get_model_for_profile(chat_profile: str) -> str:
model_map = config.get('MODEL_MAP', {})
if model_map.get(chat_profile):
model_name = model_map.get(chat_profile).get('model_name', 'gpt-4o-mini')
return model_name
return "gpt-4o-mini"

return config.get('MODEL_MAP', {}).get(chat_profile, {}).get('model_name', 'gpt-4o-mini')

Loading

0 comments on commit 79fdbeb

Please sign in to comment.