Skip to content

Commit 934384d

Browse files
committed
fix: use dateutil.parser.isoparse instead of datetime.fromisoformat
1 parent 6fbd9db commit 934384d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

gptme/server/api_v2.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from itertools import islice
1212

1313
import flask
14+
from dateutil.parser import isoparse
1415
from flask import request
1516
from gptme.config import ChatConfig, Config, set_config
1617
from gptme.llm.models import (
@@ -162,9 +163,7 @@ def api_conversation_put(conversation_id: str):
162163

163164
for msg in req_json.get("messages", []):
164165
timestamp: datetime = (
165-
datetime.fromisoformat(msg["timestamp"])
166-
if "timestamp" in msg
167-
else datetime.now()
166+
isoparse(msg["timestamp"]) if "timestamp" in msg else datetime.now()
168167
)
169168
msgs.append(Message(msg["role"], msg["content"], timestamp=timestamp))
170169

0 commit comments

Comments
 (0)