deepanything 0.1.5__py3-none-any.whl → 0.1.6__py3-none-any.whl
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.
- deepanything/Server/Server.py +10 -7
- deepanything/__main__.py +3 -1
- deepanything/metadatas.py +1 -0
- {deepanything-0.1.5.dist-info → deepanything-0.1.6.dist-info}/METADATA +1 -1
- {deepanything-0.1.5.dist-info → deepanything-0.1.6.dist-info}/RECORD +9 -8
- {deepanything-0.1.5.dist-info → deepanything-0.1.6.dist-info}/LICENSE +0 -0
- {deepanything-0.1.5.dist-info → deepanything-0.1.6.dist-info}/WHEEL +0 -0
- {deepanything-0.1.5.dist-info → deepanything-0.1.6.dist-info}/entry_points.txt +0 -0
- {deepanything-0.1.5.dist-info → deepanything-0.1.6.dist-info}/top_level.txt +0 -0
deepanything/Server/Server.py
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
from chunk import Chunk
|
1
2
|
from dataclasses import dataclass
|
2
3
|
import time
|
3
4
|
import uvicorn
|
@@ -6,7 +7,7 @@ import json
|
|
6
7
|
|
7
8
|
from openai.types.model import Model as OpenaiModel
|
8
9
|
from fastapi import FastAPI,Depends, HTTPException, status,Header,Request
|
9
|
-
from fastapi.responses import StreamingResponse
|
10
|
+
from fastapi.responses import StreamingResponse,Response
|
10
11
|
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
|
11
12
|
from uvicorn.config import LOGGING_CONFIG
|
12
13
|
|
@@ -184,14 +185,13 @@ class DeepAnythingServer:
|
|
184
185
|
|
185
186
|
model = self.models[query.model]
|
186
187
|
|
187
|
-
# 修改点1:将request传递给_sse_warp生成器
|
188
188
|
async def _sse_warp(it: AsyncStream, req: Request):
|
189
189
|
async for chunk in it:
|
190
190
|
if await req.is_disconnected():
|
191
191
|
await it.close()
|
192
192
|
break
|
193
|
-
yield f"data: {chunk.model_dump_json(indent=None)}\n\n"
|
194
|
-
yield "data: [DONE]"
|
193
|
+
yield f"data: {chunk.model_dump_json(indent=None)}\n\n".encode("utf-8")
|
194
|
+
yield "data: [DONE]".encode('utf-8')
|
195
195
|
|
196
196
|
args = DeepAnythingServer._extract_args(query)
|
197
197
|
|
@@ -214,11 +214,11 @@ class DeepAnythingServer:
|
|
214
214
|
reason_args=args,
|
215
215
|
max_tokens=max_tokens
|
216
216
|
),
|
217
|
-
request
|
217
|
+
request
|
218
218
|
)
|
219
219
|
return StreamingResponse(
|
220
220
|
res,
|
221
|
-
media_type="text/event-stream"
|
221
|
+
media_type="text/event-stream",
|
222
222
|
)
|
223
223
|
else:
|
224
224
|
res = await chat_completion_async(
|
@@ -233,7 +233,10 @@ class DeepAnythingServer:
|
|
233
233
|
reason_args=args,
|
234
234
|
max_tokens=max_tokens
|
235
235
|
)
|
236
|
-
return
|
236
|
+
return Response(
|
237
|
+
content=res.model_dump_json(indent=None),
|
238
|
+
media_type="application/json"
|
239
|
+
)
|
237
240
|
|
238
241
|
def get_models(self) -> Types.ModelsListResponse:
|
239
242
|
return Types.ModelsListResponse(
|
deepanything/__main__.py
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
from deepanything.Server.Server import DeepAnythingServer
|
2
2
|
import argparse
|
3
3
|
import json
|
4
|
+
from .metadatas import VERSION
|
4
5
|
def main():
|
5
|
-
parser = argparse.ArgumentParser(prog="deepanything",description="Run a DeepAnything Server.")
|
6
|
+
parser = argparse.ArgumentParser(prog=f"deepanything {VERSION}",description="Run a DeepAnything Server.")
|
6
7
|
parser.add_argument('--host', type=str, required=False, help='Specific the host to listen.If specified,the host will be overwritten by this.')
|
7
8
|
parser.add_argument('--port', type=int, required=False, help='Specific the port to listen.If specified,the port will be overwritten by this.')
|
8
9
|
parser.add_argument('--config', type=str, required=True, help='Specific the confi path.')
|
10
|
+
parser.add_argument('--version', action='version', version=f'%(prog)s {VERSION}')
|
9
11
|
|
10
12
|
args = parser.parse_args()
|
11
13
|
|
@@ -0,0 +1 @@
|
|
1
|
+
VERSION = "v0.1.6"
|
@@ -4,13 +4,14 @@ deepanything/ResponseClient.py,sha256=NbXjlU_0qTKBNjZy8B9J9emuABQYvx3NZsWuja9OnM
|
|
4
4
|
deepanything/Stream.py,sha256=8ESR8ttjyPZ-uXPDENsVWUzaL34_GT2OZBJ0PWu7vsA,1578
|
5
5
|
deepanything/Utility.py,sha256=TFH-4NS-gQpzzEb1Aba7WpDEqBqNRF1STWFzfRqQLcg,6645
|
6
6
|
deepanything/__init__.py,sha256=_2RolcKcpxmW0dmtiQpXlvgxe5dvqx90Yg_Q_oVLVZQ,175
|
7
|
-
deepanything/__main__.py,sha256=
|
8
|
-
deepanything/
|
7
|
+
deepanything/__main__.py,sha256=N40zRebnTUmVd9a0wcK_I0au7Lvl4axxKX6zJGDdXq0,1066
|
8
|
+
deepanything/metadatas.py,sha256=WspkzXRul9GiZA9N8kBo-wnZEexn6N3Y_ykPEaT8dL8,18
|
9
|
+
deepanything/Server/Server.py,sha256=HIM-MHuRG98jv8MTeGK9So-xd8OiTA9R74uvKbWrXyk,9847
|
9
10
|
deepanything/Server/Types.py,sha256=b7aMaRBgODEKdyYe0FeraUfrygJuye3b5lfQTOWASXA,650
|
10
11
|
deepanything/Server/__init__.py,sha256=eIpn6NbNvEg4ST8CuuIuzPT3m_fTlmPC3sikPoPFsYo,92
|
11
|
-
deepanything-0.1.
|
12
|
-
deepanything-0.1.
|
13
|
-
deepanything-0.1.
|
14
|
-
deepanything-0.1.
|
15
|
-
deepanything-0.1.
|
16
|
-
deepanything-0.1.
|
12
|
+
deepanything-0.1.6.dist-info/LICENSE,sha256=JWYd2E-mcNcSYjT5nk4ayM5kkkDq6ZlOxVcYsyqCIwU,1059
|
13
|
+
deepanything-0.1.6.dist-info/METADATA,sha256=-h3eS_CkiwY27ju-QxH2_40IJMBszckjbjmhBTqW0Ig,7851
|
14
|
+
deepanything-0.1.6.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
15
|
+
deepanything-0.1.6.dist-info/entry_points.txt,sha256=UT4gNGx6dJsKBjZIl3VkMekh385O5WMbMidAAla6UB4,60
|
16
|
+
deepanything-0.1.6.dist-info/top_level.txt,sha256=wGeRb__4jEJTclCUl0cxhgubD_Bq-QT38VIH6C4KpzY,13
|
17
|
+
deepanything-0.1.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|