fere-sdk 0.1.0.dev6__tar.gz → 0.1.0.dev9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fere_sdk-0.1.0.dev6 → fere_sdk-0.1.0.dev9}/.gitignore +3 -0
- {fere_sdk-0.1.0.dev6 → fere_sdk-0.1.0.dev9}/PKG-INFO +1 -1
- {fere_sdk-0.1.0.dev6 → fere_sdk-0.1.0.dev9}/pyproject.toml +1 -1
- {fere_sdk-0.1.0.dev6 → fere_sdk-0.1.0.dev9}/src/fere_sdk/low_level.py +19 -2
- {fere_sdk-0.1.0.dev6 → fere_sdk-0.1.0.dev9}/README.md +0 -0
- {fere_sdk-0.1.0.dev6 → fere_sdk-0.1.0.dev9}/src/fere_sdk/__init__.py +0 -0
- {fere_sdk-0.1.0.dev6 → fere_sdk-0.1.0.dev9}/src/fere_sdk/auth.py +0 -0
- {fere_sdk-0.1.0.dev6 → fere_sdk-0.1.0.dev9}/src/fere_sdk/client.py +0 -0
- {fere_sdk-0.1.0.dev6 → fere_sdk-0.1.0.dev9}/src/fere_sdk/models.py +0 -0
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
|
+
import logging
|
|
6
7
|
from collections.abc import AsyncIterator
|
|
7
8
|
from typing import Any
|
|
8
9
|
|
|
@@ -22,6 +23,8 @@ from .models import (
|
|
|
22
23
|
WithdrawRequest,
|
|
23
24
|
)
|
|
24
25
|
|
|
26
|
+
logger = logging.getLogger(__name__)
|
|
27
|
+
|
|
25
28
|
DEFAULT_BASE_URL = "https://api.fereai.xyz"
|
|
26
29
|
|
|
27
30
|
|
|
@@ -163,7 +166,14 @@ class FereAPI:
|
|
|
163
166
|
if line.startswith("event:"):
|
|
164
167
|
event_type = line[6:].strip()
|
|
165
168
|
elif line.startswith("data:"):
|
|
166
|
-
|
|
169
|
+
raw = line[5:].strip()
|
|
170
|
+
if not raw:
|
|
171
|
+
continue
|
|
172
|
+
try:
|
|
173
|
+
data = json.loads(raw)
|
|
174
|
+
except (json.JSONDecodeError, ValueError):
|
|
175
|
+
logger.debug("Unparseable SSE data: %r", raw)
|
|
176
|
+
continue
|
|
167
177
|
yield ChatEvent(event=event_type, data=data)
|
|
168
178
|
|
|
169
179
|
async def get_threads(self, skip: int = 0, limit: int = 10) -> list[dict]:
|
|
@@ -359,7 +369,14 @@ class FereAPI:
|
|
|
359
369
|
if line.startswith("event:"):
|
|
360
370
|
event_type = line[6:].strip()
|
|
361
371
|
elif line.startswith("data:"):
|
|
362
|
-
|
|
372
|
+
raw = line[5:].strip()
|
|
373
|
+
if not raw:
|
|
374
|
+
continue
|
|
375
|
+
try:
|
|
376
|
+
data = json.loads(raw)
|
|
377
|
+
except (json.JSONDecodeError, ValueError):
|
|
378
|
+
logger.debug("Unparseable SSE data: %r", raw)
|
|
379
|
+
continue
|
|
363
380
|
yield ChatEvent(event=event_type, data=data)
|
|
364
381
|
|
|
365
382
|
# ----------------------------------------------------------
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|