Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
azure-open-ai-embeddings-sales
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c9e48e7b
authored
Feb 25, 2024
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化工作线程数
1 parent
765503a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
2 deletions
.vscode/PythonImportHelper-v2-Completion.json
code/Sales_FastApi.py
.vscode/PythonImportHelper-v2-Completion.json
View file @
c9e48e7
...
@@ -749,6 +749,14 @@
...
@@ -749,6 +749,14 @@
"documentation"
:
{}
"documentation"
:
{}
},
},
{
{
"label"
:
"Server"
,
"importPath"
:
"uvicorn"
,
"description"
:
"uvicorn"
,
"isExtraImport"
:
true
,
"detail"
:
"uvicorn"
,
"documentation"
:
{}
},
{
"label"
:
"Body"
,
"label"
:
"Body"
,
"importPath"
:
"fastapi"
,
"importPath"
:
"fastapi"
,
"description"
:
"fastapi"
,
"description"
:
"fastapi"
,
...
@@ -1882,6 +1890,15 @@
...
@@ -1882,6 +1890,15 @@
"documentation"
:
{}
"documentation"
:
{}
},
},
{
{
"label"
:
"importlib"
,
"kind"
:
6
,
"isExtraImport"
:
true
,
"importPath"
:
"importlib"
,
"description"
:
"importlib"
,
"detail"
:
"importlib"
,
"documentation"
:
{}
},
{
"label"
:
"OAuth2PasswordBearer"
,
"label"
:
"OAuth2PasswordBearer"
,
"importPath"
:
"fastapi.security"
,
"importPath"
:
"fastapi.security"
,
"description"
:
"fastapi.security"
,
"description"
:
"fastapi.security"
,
...
@@ -1890,6 +1907,14 @@
...
@@ -1890,6 +1907,14 @@
"documentation"
:
{}
"documentation"
:
{}
},
},
{
{
"label"
:
"Config"
,
"importPath"
:
"uvicorn.config"
,
"description"
:
"uvicorn.config"
,
"isExtraImport"
:
true
,
"detail"
:
"uvicorn.config"
,
"documentation"
:
{}
},
{
"label"
:
"random,datetime"
,
"label"
:
"random,datetime"
,
"kind"
:
6
,
"kind"
:
6
,
"isExtraImport"
:
true
,
"isExtraImport"
:
true
,
...
...
code/Sales_FastApi.py
View file @
c9e48e7
import
argparse
import
argparse
import
hashlib
import
hashlib
import
importlib
import
logging
import
logging
import
json
import
json
import
os
import
os
...
@@ -10,6 +11,7 @@ from typing import Dict, List, Optional
...
@@ -10,6 +11,7 @@ from typing import Dict, List, Optional
# import nltk
# import nltk
import
pydantic
import
pydantic
import
uvicorn
import
uvicorn
from
uvicorn
import
Server
from
fastapi
import
(
Body
,
Depends
,
FastAPI
,
File
,
Form
,
HTTPException
,
Query
,
from
fastapi
import
(
Body
,
Depends
,
FastAPI
,
File
,
Form
,
HTTPException
,
Query
,
Request
,
UploadFile
,
WebSocket
,
WebSocketDisconnect
)
Request
,
UploadFile
,
WebSocket
,
WebSocketDisconnect
)
from
fastapi.middleware.cors
import
CORSMiddleware
from
fastapi.middleware.cors
import
CORSMiddleware
...
@@ -21,6 +23,7 @@ from typing_extensions import Annotated
...
@@ -21,6 +23,7 @@ from typing_extensions import Annotated
# EMBEDDING_MODEL, LLM_MODEL, NLTK_DATA_PATH,
# EMBEDDING_MODEL, LLM_MODEL, NLTK_DATA_PATH,
# VECTOR_SEARCH_TOP_K, LLM_HISTORY_LEN, OPEN_CROSS_DOMAIN)
# VECTOR_SEARCH_TOP_K, LLM_HISTORY_LEN, OPEN_CROSS_DOMAIN)
from
utilities.helper
import
LLMHelper
from
utilities.helper
import
LLMHelper
from
uvicorn.config
import
Config
logger
=
logging
.
getLogger
()
logger
=
logging
.
getLogger
()
oauth2_scheme
=
OAuth2PasswordBearer
(
tokenUrl
=
"token"
)
oauth2_scheme
=
OAuth2PasswordBearer
(
tokenUrl
=
"token"
)
...
@@ -340,8 +343,19 @@ def api_start(host, port):
...
@@ -340,8 +343,19 @@ def api_start(host, port):
app
.
websocket
(
"/ws/{client_id}"
)(
websocket_endpoint
)
app
.
websocket
(
"/ws/{client_id}"
)(
websocket_endpoint
)
# 测试WS连接代码
# 测试WS连接代码
app
.
websocket
(
"/ws1/{client_id}"
)(
websocket_endpoint_01
)
app
.
websocket
(
"/ws1/{client_id}"
)(
websocket_endpoint_01
)
uvicorn
.
Config
(
app
,
workers
=
8
)
uvicorn
.
run
(
app
,
host
=
host
,
port
=
port
)
# config = uvicorn.Config(app, host=host, port=port, workers=8)
# uvicorn.run(config)
uvicorn_config
=
uvicorn
.
Config
(
app
=
app
,
host
=
host
,
port
=
port
,
workers
=
8
,
)
Server
(
uvicorn_config
)
.
run
()
# uvicorn.run(app, host=host, port=port, workers=8)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment