raidhon commited on
Commit
070f6a7
1 Parent(s): ba68249

feat: App has been updated

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -25,6 +25,7 @@ types_and_models = {
25
  ],
26
  'deepinfra': [
27
  ('Llama 8B', 'meta-llama/Meta-Llama-3.1-8B-Instruct'),
 
28
  ('Llama 70B', 'meta-llama/Meta-Llama-3.1-70B-Instruct'),
29
  ('Llama 405B', 'meta-llama/Meta-Llama-3.1-405B-Instruct'),
30
  ('Qwen 72B', 'Qwen/Qwen2.5-72B-Instruct'),
@@ -53,12 +54,17 @@ async def chat_with_server(chat_history, api_key, base_url, selected_type, selec
53
 
54
  api_url = 'https://api.logicboost.net' # API URL
55
 
56
- api_messages = []
57
- for user_msg, assistant_msg in chat_history:
58
  if user_msg is not None:
59
- api_messages.append({'role': 'user', 'content': user_msg})
60
- if assistant_msg is not None and not assistant_msg.startswith("Assistant is thinking"):
61
- api_messages.append({'role': 'assistant', 'content': assistant_msg})
 
 
 
 
 
62
 
63
  model = custom_model if selected_type in ['custom', 'open_router'] else selected_model
64
 
 
25
  ],
26
  'deepinfra': [
27
  ('Llama 8B', 'meta-llama/Meta-Llama-3.1-8B-Instruct'),
28
+ ('Llama 3B', 'meta-llama/Llama-3.2-3B-Instruct'),
29
  ('Llama 70B', 'meta-llama/Meta-Llama-3.1-70B-Instruct'),
30
  ('Llama 405B', 'meta-llama/Meta-Llama-3.1-405B-Instruct'),
31
  ('Qwen 72B', 'Qwen/Qwen2.5-72B-Instruct'),
 
54
 
55
  api_url = 'https://api.logicboost.net' # API URL
56
 
57
+ conversation = []
58
+ for user_msg, assistant_msg in reversed(chat_history):
59
  if user_msg is not None:
60
+ conversation.append(f"User: {user_msg}")
61
+ if assistant_msg and not assistant_msg.startswith("Assistant is thinking"):
62
+ conversation.append(f"Assistant: {assistant_msg}")
63
+ elif assistant_msg and assistant_msg.startswith("Assistant is thinking"):
64
+ conversation.append(f"System: {assistant_msg}")
65
+
66
+ user_content = "\n".join(conversation)
67
+ api_messages = [{'role': 'user', 'content': user_content}]
68
 
69
  model = custom_model if selected_type in ['custom', 'open_router'] else selected_model
70