Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit 79fdbeb

Browse files
committed
modify some code and update chainlit 1.3.0
1 parent 94a16a3 commit 79fdbeb

3 files changed

Lines changed: 114 additions & 103 deletions

File tree

src/app.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
from utils.logger import logger
88
from chainlit.config import config
99

10-
# setting default tag and history
11-
@cl.on_chat_start
12-
def start_chat():
13-
cl.user_session.set("is_new_session", True)
1410

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

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

27+
# setting default tag and history
28+
@cl.on_chat_start
29+
def start_chat():
30+
cl.user_session.set("is_new_session", True)
31+
3132
# main logic ,receive message will call this function
3233
@cl.on_message
3334
async def main(message: cl.Message):

src/config.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,5 @@ async def chat_profile():
7676

7777
# get model for profile
7878
def get_model_for_profile(chat_profile: str) -> str:
79-
model_map = config.get('MODEL_MAP', {})
80-
if model_map.get(chat_profile):
81-
model_name = model_map.get(chat_profile).get('model_name', 'gpt-4o-mini')
82-
return model_name
83-
return "gpt-4o-mini"
84-
79+
return config.get('MODEL_MAP', {}).get(chat_profile, {}).get('model_name', 'gpt-4o-mini')
8580

0 commit comments

Comments
 (0)