mirror of
https://github.com/Hopiu/llm.git
synced 2026-03-16 20:50:25 +00:00
parent
b8e8052229
commit
571f4b2a4d
5 changed files with 12 additions and 9 deletions
|
|
@ -182,8 +182,8 @@ def register_commands(cli):
|
|||
to_print = []
|
||||
for model in models:
|
||||
# Print id, owned_by, root, created as ISO 8601
|
||||
created_str = datetime.datetime.utcfromtimestamp(
|
||||
model["created"]
|
||||
created_str = datetime.datetime.fromtimestamp(
|
||||
model["created"], datetime.timezone.utc
|
||||
).isoformat()
|
||||
to_print.append(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,10 @@ def migrate(db):
|
|||
if name not in already_applied:
|
||||
fn(db)
|
||||
db["_llm_migrations"].insert(
|
||||
{"name": name, "applied_at": str(datetime.datetime.utcnow())}
|
||||
{
|
||||
"name": name,
|
||||
"applied_at": str(datetime.datetime.now(datetime.timezone.utc)),
|
||||
}
|
||||
)
|
||||
already_applied.add(name)
|
||||
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ class Response(_BaseResponse):
|
|||
|
||||
def __iter__(self) -> Iterator[str]:
|
||||
self._start = time.monotonic()
|
||||
self._start_utcnow = datetime.datetime.utcnow()
|
||||
self._start_utcnow = datetime.datetime.now(datetime.timezone.utc)
|
||||
if self._done:
|
||||
yield from self._chunks
|
||||
return
|
||||
|
|
@ -434,7 +434,7 @@ class AsyncResponse(_BaseResponse):
|
|||
|
||||
def __aiter__(self):
|
||||
self._start = time.monotonic()
|
||||
self._start_utcnow = datetime.datetime.utcnow()
|
||||
self._start_utcnow = datetime.datetime.now(datetime.timezone.utc)
|
||||
return self
|
||||
|
||||
async def __anext__(self) -> str:
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ def test_openai_models(mocked_models):
|
|||
result = runner.invoke(cli, ["openai", "models", "--key", "x"])
|
||||
assert result.exit_code == 0
|
||||
assert result.output == (
|
||||
"id owned_by created \n"
|
||||
"ada:2020-05-03 openai 2020-05-03T20:26:40\n"
|
||||
"babbage:2020-05-03 openai 2020-05-03T20:26:40\n"
|
||||
"id owned_by created \n"
|
||||
"ada:2020-05-03 openai 2020-05-03T20:26:40+00:00\n"
|
||||
"babbage:2020-05-03 openai 2020-05-03T20:26:40+00:00\n"
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ def log_path(user_path):
|
|||
log_path = str(user_path / "logs.db")
|
||||
db = sqlite_utils.Database(log_path)
|
||||
migrate(db)
|
||||
start = datetime.datetime.utcnow()
|
||||
start = datetime.datetime.now(datetime.timezone.utc)
|
||||
db["responses"].insert_all(
|
||||
{
|
||||
"id": str(ULID()).lower(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue