Spaces:
Runtime error
Runtime error
Fixed spacing
Browse files
app.py
CHANGED
|
@@ -18,8 +18,8 @@ def clear_session() -> History:
|
|
| 18 |
def history_to_messages(history: History) -> Messages:
|
| 19 |
messages = []
|
| 20 |
for h in history:
|
| 21 |
-
messages.append({'role': 'user', 'content': h[0]})
|
| 22 |
-
messages.append({'role': 'assistant', 'content': h[1]})
|
| 23 |
return messages
|
| 24 |
|
| 25 |
def messages_to_history(messages: Messages) -> Tuple[str, History]:
|
|
@@ -34,7 +34,7 @@ def model_chat(query: Optional[str], history: Optional[History]) -> Generator[Tu
|
|
| 34 |
if history is None:
|
| 35 |
history = []
|
| 36 |
messages = history_to_messages(history)
|
| 37 |
-
messages.append({'role': 'user', 'content': query})
|
| 38 |
gen = oai_client.chat.completions.create(
|
| 39 |
model='dicta-il/dictalm2.0-instruct',
|
| 40 |
messages=messages,
|
|
|
|
| 18 |
def history_to_messages(history: History) -> Messages:
|
| 19 |
messages = []
|
| 20 |
for h in history:
|
| 21 |
+
messages.append({'role': 'user', 'content': h[0].strip()})
|
| 22 |
+
messages.append({'role': 'assistant', 'content': h[1].strip()})
|
| 23 |
return messages
|
| 24 |
|
| 25 |
def messages_to_history(messages: Messages) -> Tuple[str, History]:
|
|
|
|
| 34 |
if history is None:
|
| 35 |
history = []
|
| 36 |
messages = history_to_messages(history)
|
| 37 |
+
messages.append({'role': 'user', 'content': query.strip()})
|
| 38 |
gen = oai_client.chat.completions.create(
|
| 39 |
model='dicta-il/dictalm2.0-instruct',
|
| 40 |
messages=messages,
|