smgc commited on
Commit
073567b
·
verified ·
1 Parent(s): b0e0276

Rename app.py to package-lock.json

Browse files
Files changed (2) hide show
  1. app.py +0 -271
  2. package-lock.json +463 -0
app.py DELETED
@@ -1,271 +0,0 @@
1
- import os
2
- import time
3
- import json
4
- import grpc
5
- import asyncio
6
- from typing import List, Optional
7
- from fastapi import FastAPI, HTTPException, Request
8
- from fastapi.responses import JSONResponse, StreamingResponse
9
- from pydantic import BaseModel
10
- from dotenv import load_dotenv
11
- from grpc_tools import protoc
12
- from grpc._channel import _MultiThreadedRendezvous
13
- import re
14
- import importlib
15
- from google.protobuf.json_format import MessageToDict
16
- import uuid
17
-
18
- # 加载环境变量
19
- load_dotenv()
20
-
21
- # 配置类
22
- class Config:
23
- def __init__(self):
24
- self.API_PREFIX = os.getenv('API_PREFIX', '/')
25
- self.API_KEY = os.getenv('API_KEY', '')
26
- self.MAX_RETRY_COUNT = int(os.getenv('MAX_RETRY_COUNT', 3))
27
- self.RETRY_DELAY = int(os.getenv('RETRY_DELAY', 5000))
28
- self.COMMON_GRPC = 'runtime-native-io-vertex-inference-grpc-service-lmuw6mcn3q-ul.a.run.app'
29
- self.COMMON_PROTO = 'protos/VertexInferenceService.proto'
30
- self.GPT_GRPC = 'runtime-native-io-gpt-inference-grpc-service-lmuw6mcn3q-ul.a.run.app'
31
- self.GPT_PROTO = 'protos/GPTInferenceService.proto'
32
- self.PORT = int(os.getenv('PORT', 8787))
33
- self.SUPPORTED_MODELS = [
34
- "gpt-4o-mini", "gpt-4o", "gpt-4-turbo", "gpt-4", "gpt-3.5-turbo",
35
- "claude-3-sonnet@20240229", "claude-3-opus@20240229", "claude-3-haiku@20240307",
36
- "claude-3-5-sonnet@20240620", "gemini-1.5-flash", "gemini-1.5-pro",
37
- "chat-bison", "codechat-bison"
38
- ]
39
-
40
- def is_valid_model(self, model):
41
- regex_input = r'^(claude-3-(5-sonnet|haiku|sonnet|opus))-(\d{8})$'
42
- match_input = re.match(regex_input, model)
43
- normalized_model = f"{match_input.group(1)}@{match_input.group(3)}" if match_input else model
44
- return normalized_model in self.SUPPORTED_MODELS
45
-
46
- # gRPC处理类
47
- class GRPCHandler:
48
- def __init__(self, proto_file):
49
- self.proto_file = proto_file
50
- self._compile_proto()
51
- self._load_proto()
52
-
53
- def _compile_proto(self):
54
- proto_dir = os.path.dirname(self.proto_file)
55
- proto_file = os.path.basename(self.proto_file)
56
- protoc.main((
57
- '',
58
- f'-I{proto_dir}',
59
- f'--python_out=.',
60
- f'--grpc_python_out=.',
61
- os.path.join(proto_dir, proto_file)
62
- ))
63
-
64
- def _load_proto(self):
65
- module_name = os.path.splitext(os.path.basename(self.proto_file))[0]
66
- grpc_module = importlib.import_module(f"{module_name}_pb2_grpc")
67
- pb2_module = importlib.import_module(f"{module_name}_pb2")
68
-
69
- if 'GPT' in module_name:
70
- self.stub_class = getattr(grpc_module, "GPTInferenceServiceStub")
71
- else:
72
- self.stub_class = getattr(grpc_module, "VertexInferenceServiceStub")
73
-
74
- self.requests_class = getattr(pb2_module, "Requests")
75
- self.response_class = getattr(pb2_module, "Response")
76
- self.messages_class = getattr(pb2_module, "Messages")
77
- self.args_class = getattr(pb2_module, "Args")
78
-
79
- def _build_request(self, model, content, rules, temperature, top_p):
80
- messages = self.messages_class(unknown=1, message=content)
81
- args = self.args_class(messages=messages, rules=rules)
82
- return self.requests_class(
83
- models=model,
84
- args=args
85
- )
86
-
87
- async def grpc_to_pieces(self, model, content, rules, temperature, top_p):
88
- metadata = [
89
- ('user-agent', 'dart-grpc/2.0.0')
90
- ]
91
- channel = grpc.aio.secure_channel(
92
- config.COMMON_GRPC,
93
- grpc.ssl_channel_credentials()
94
- )
95
- stub = self.stub_class(channel)
96
-
97
- try:
98
- request = self._build_request(model, content, rules, temperature, top_p)
99
- print(f"Sending request: {request}") # 记录发送的请求
100
- response = await stub.Predict(request, metadata=metadata)
101
- print(f"Received response: {response}") # 记录接收到的响应
102
- result = self._process_response(response, model)
103
- print(f"Processed result: {result}") # 记录处理后的结果
104
- return result
105
- except grpc.RpcError as e:
106
- print(f"RPC failed: {e}")
107
- return {"error": str(e)}
108
- finally:
109
- await channel.close()
110
-
111
- async def grpc_to_pieces_stream(self, model, content, rules, temperature, top_p):
112
- metadata = [
113
- ('user-agent', 'dart-grpc/2.0.0')
114
- ]
115
- channel = grpc.aio.secure_channel(
116
- config.COMMON_GRPC,
117
- grpc.ssl_channel_credentials()
118
- )
119
- stub = self.stub_class(channel)
120
-
121
- try:
122
- request = self._build_request(model, content, rules, temperature, top_p)
123
- async for response in stub.PredictWithStream(request, metadata=metadata):
124
- result = self._process_stream_response(response, model)
125
- if result:
126
- yield f"data: {json.dumps(result)}\n\n"
127
- except grpc.RpcError as e:
128
- print(f"Stream RPC failed: {e}")
129
- yield f"data: {json.dumps({'error': str(e)})}\n\n"
130
- finally:
131
- await channel.close()
132
-
133
- def _process_response(self, response, model):
134
- response_dict = MessageToDict(response)
135
- print(f"Response dict: {response_dict}") # 记录转换后的响应字典
136
- message = response_dict.get('args', {}).get('args', {}).get('args', {}).get('message', '')
137
- print(f"Extracted message: {message}") # 记录提取的消息
138
- return chat_completion_with_model(message, model)
139
-
140
- def _process_stream_response(self, response, model):
141
- response_dict = MessageToDict(response)
142
- return chat_completion_stream_with_model(response_dict.get('args', {}).get('args', {}).get('args', {}).get('message', ''), model)
143
-
144
- # 工具函数
145
- def messages_process(messages):
146
- rules = ''
147
- message = ''
148
-
149
- for msg in messages:
150
- role = msg.role
151
- content = msg.content
152
-
153
- if isinstance(content, list):
154
- content = ''.join([item.get('text', '') for item in content if item.get('text')])
155
-
156
- if role == 'system':
157
- rules += f"system:{content};\r\n"
158
- elif role in ['user', 'assistant']:
159
- message += f"{role}:{content};\r\n"
160
-
161
- return rules, message
162
-
163
- def chat_completion_with_model(message, model):
164
- # 处理消息并创建响应
165
- response = {
166
- "id": "chatcmpl-" + str(uuid.uuid4()),
167
- "object": "chat.completion",
168
- "created": int(time.time()),
169
- "model": model,
170
- "usage": {
171
- "prompt_tokens": 0,
172
- "completion_tokens": 0,
173
- "total_tokens": 0
174
- },
175
- "choices": [
176
- {
177
- "message": {
178
- "role": "assistant",
179
- "content": message
180
- },
181
- "finish_reason": "stop",
182
- "index": 0
183
- }
184
- ]
185
- }
186
- print(f"Final response: {response}") # 记录最终的响应
187
- return response
188
-
189
- def chat_completion_stream_with_model(text: str, model: str):
190
- return {
191
- "id": "chatcmpl-Nekohy",
192
- "object": "chat.completion.chunk",
193
- "created": 0,
194
- "model": model,
195
- "choices": [
196
- {
197
- "index": 0,
198
- "delta": {
199
- "content": text,
200
- },
201
- "finish_reason": None,
202
- },
203
- ],
204
- }
205
-
206
- # 初始化配置
207
- config = Config()
208
-
209
- # 初始化 FastAPI 应用
210
- app = FastAPI()
211
-
212
- # 定义请求模型
213
- class ChatMessage(BaseModel):
214
- role: str
215
- content: str
216
-
217
- class ChatCompletionRequest(BaseModel):
218
- model: str
219
- messages: List[ChatMessage]
220
- stream: Optional[bool] = False
221
- temperature: Optional[float] = None
222
- top_p: Optional[float] = None
223
-
224
- # 路由定义
225
- @app.get("/")
226
- async def root():
227
- return {"message": "API 服务运行中~"}
228
-
229
- @app.get("/ping")
230
- async def ping():
231
- return {"message": "pong"}
232
-
233
- @app.get(config.API_PREFIX + "/v1/models")
234
- async def list_models():
235
- with open('cloud_model.json', 'r') as f:
236
- cloud_models = json.load(f)
237
-
238
- models = [
239
- {"id": model["unique"], "object": "model", "owned_by": "pieces-os"}
240
- for model in cloud_models["iterable"]
241
- ]
242
-
243
- return JSONResponse({
244
- "object": "list",
245
- "data": models
246
- })
247
-
248
- @app.post(config.API_PREFIX + "/v1/chat/completions")
249
- async def chat_completions(request: ChatCompletionRequest):
250
- proto_file = config.GPT_PROTO if request.model.startswith('gpt') else config.COMMON_PROTO
251
- grpc_handler = GRPCHandler(proto_file)
252
-
253
- if request.stream:
254
- return StreamingResponse(
255
- grpc_handler.grpc_to_pieces_stream(
256
- request.model, content, rules, request.temperature, request.top_p
257
- ),
258
- media_type="text/event-stream"
259
- )
260
- else:
261
- response = await grpc_handler.grpc_to_pieces(
262
- request.model, content, rules, request.temperature, request.top_p
263
- )
264
- return JSONResponse(content=response)
265
- result = await grpc_handler.grpc_to_pieces(request.model, content, rules, request.temperature, request.top_p)
266
- print(f"Response content: {result}") # 添加这行来记录响应内容
267
- return JSONResponse(content=result)
268
-
269
- if __name__ == "__main__":
270
- import uvicorn
271
- uvicorn.run(app, host="0.0.0.0", port=config.PORT)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package-lock.json ADDED
@@ -0,0 +1,463 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "pieces-os",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "pieces-os",
9
+ "version": "1.0.0",
10
+ "dependencies": {
11
+ "@grpc/proto-loader": "^0.7.13",
12
+ "@huayue/grpc-js": "^1.12.1",
13
+ "@whatwg-node/server": "^0.9.50",
14
+ "dotenv": "^16.4.5",
15
+ "itty-router": "^5.0.18"
16
+ }
17
+ },
18
+ "node_modules/@grpc/proto-loader": {
19
+ "version": "0.7.13",
20
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@grpc/proto-loader/-/proto-loader-0.7.13.tgz",
21
+ "integrity": "sha512-AiXO/bfe9bmxBjxxtYxFAXGZvMaN5s8kO+jBHAJCON8rJoB5YS/D6X7ZNc6XQkuHNmyl4CYaMI1fJ/Gn27RGGw==",
22
+ "license": "Apache-2.0",
23
+ "dependencies": {
24
+ "lodash.camelcase": "^4.3.0",
25
+ "long": "^5.0.0",
26
+ "protobufjs": "^7.2.5",
27
+ "yargs": "^17.7.2"
28
+ },
29
+ "bin": {
30
+ "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js"
31
+ },
32
+ "engines": {
33
+ "node": ">=6"
34
+ }
35
+ },
36
+ "node_modules/@huayue/grpc-js": {
37
+ "version": "1.12.1",
38
+ "resolved": "https://registry.npmjs.org/@huayue/grpc-js/-/grpc-js-1.12.1.tgz",
39
+ "integrity": "sha512-QoCEAV3tXxy/WF/F1q4EXcEfKZLzeMFF8vooza60v5spfWn0BLW4tRBcqs/33FMEdp90es5/UfKZLey2ajcAqA==",
40
+ "license": "Apache-2.0",
41
+ "dependencies": {
42
+ "@grpc/proto-loader": "^0.7.13",
43
+ "@js-sdsl/ordered-map": "^4.4.2"
44
+ },
45
+ "engines": {
46
+ "node": ">=12.10.0"
47
+ }
48
+ },
49
+ "node_modules/@js-sdsl/ordered-map": {
50
+ "version": "4.4.2",
51
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz",
52
+ "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==",
53
+ "license": "MIT",
54
+ "funding": {
55
+ "type": "opencollective",
56
+ "url": "https://opencollective.com/js-sdsl"
57
+ }
58
+ },
59
+ "node_modules/@kamilkisiela/fast-url-parser": {
60
+ "version": "1.1.4",
61
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@kamilkisiela/fast-url-parser/-/fast-url-parser-1.1.4.tgz",
62
+ "integrity": "sha512-gbkePEBupNydxCelHCESvFSFM8XPh1Zs/OAVRW/rKpEqPAl5PbOM90Si8mv9bvnR53uPD2s/FiRxdvSejpRJew==",
63
+ "license": "MIT"
64
+ },
65
+ "node_modules/@protobufjs/aspromise": {
66
+ "version": "1.1.2",
67
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
68
+ "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==",
69
+ "license": "BSD-3-Clause"
70
+ },
71
+ "node_modules/@protobufjs/base64": {
72
+ "version": "1.1.2",
73
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@protobufjs/base64/-/base64-1.1.2.tgz",
74
+ "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==",
75
+ "license": "BSD-3-Clause"
76
+ },
77
+ "node_modules/@protobufjs/codegen": {
78
+ "version": "2.0.4",
79
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@protobufjs/codegen/-/codegen-2.0.4.tgz",
80
+ "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==",
81
+ "license": "BSD-3-Clause"
82
+ },
83
+ "node_modules/@protobufjs/eventemitter": {
84
+ "version": "1.1.0",
85
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
86
+ "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==",
87
+ "license": "BSD-3-Clause"
88
+ },
89
+ "node_modules/@protobufjs/fetch": {
90
+ "version": "1.1.0",
91
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@protobufjs/fetch/-/fetch-1.1.0.tgz",
92
+ "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==",
93
+ "license": "BSD-3-Clause",
94
+ "dependencies": {
95
+ "@protobufjs/aspromise": "^1.1.1",
96
+ "@protobufjs/inquire": "^1.1.0"
97
+ }
98
+ },
99
+ "node_modules/@protobufjs/float": {
100
+ "version": "1.0.2",
101
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@protobufjs/float/-/float-1.0.2.tgz",
102
+ "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==",
103
+ "license": "BSD-3-Clause"
104
+ },
105
+ "node_modules/@protobufjs/inquire": {
106
+ "version": "1.1.0",
107
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@protobufjs/inquire/-/inquire-1.1.0.tgz",
108
+ "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==",
109
+ "license": "BSD-3-Clause"
110
+ },
111
+ "node_modules/@protobufjs/path": {
112
+ "version": "1.1.2",
113
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@protobufjs/path/-/path-1.1.2.tgz",
114
+ "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==",
115
+ "license": "BSD-3-Clause"
116
+ },
117
+ "node_modules/@protobufjs/pool": {
118
+ "version": "1.1.0",
119
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@protobufjs/pool/-/pool-1.1.0.tgz",
120
+ "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==",
121
+ "license": "BSD-3-Clause"
122
+ },
123
+ "node_modules/@protobufjs/utf8": {
124
+ "version": "1.1.0",
125
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@protobufjs/utf8/-/utf8-1.1.0.tgz",
126
+ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==",
127
+ "license": "BSD-3-Clause"
128
+ },
129
+ "node_modules/@types/node": {
130
+ "version": "22.7.9",
131
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@types/node/-/node-22.7.9.tgz",
132
+ "integrity": "sha512-jrTfRC7FM6nChvU7X2KqcrgquofrWLFDeYC1hKfwNWomVvrn7JIksqf344WN2X/y8xrgqBd2dJATZV4GbatBfg==",
133
+ "license": "MIT",
134
+ "dependencies": {
135
+ "undici-types": "~6.19.2"
136
+ }
137
+ },
138
+ "node_modules/@whatwg-node/fetch": {
139
+ "version": "0.9.22",
140
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@whatwg-node/fetch/-/fetch-0.9.22.tgz",
141
+ "integrity": "sha512-+RIBffgoaRlWV9cKV6wAX71sbeoU2APOI3G13ZRMkabYHwkvDMeZDTyxJcsMXA5CpieJ7NFXF9Xyu72jwvdzqA==",
142
+ "license": "MIT",
143
+ "dependencies": {
144
+ "@whatwg-node/node-fetch": "^0.5.27",
145
+ "urlpattern-polyfill": "^10.0.0"
146
+ },
147
+ "engines": {
148
+ "node": ">=18.0.0"
149
+ }
150
+ },
151
+ "node_modules/@whatwg-node/node-fetch": {
152
+ "version": "0.5.27",
153
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@whatwg-node/node-fetch/-/node-fetch-0.5.27.tgz",
154
+ "integrity": "sha512-0OaMj5W4fzWimRSFq07qFiWfquaUMNB+695GwE76LYKVuah+jwCdzSgsIOtwPkiyJ35w0XGhXmJPiIJCdLwopg==",
155
+ "license": "MIT",
156
+ "dependencies": {
157
+ "@kamilkisiela/fast-url-parser": "^1.1.4",
158
+ "busboy": "^1.6.0",
159
+ "fast-querystring": "^1.1.1",
160
+ "tslib": "^2.6.3"
161
+ },
162
+ "engines": {
163
+ "node": ">=18.0.0"
164
+ }
165
+ },
166
+ "node_modules/@whatwg-node/server": {
167
+ "version": "0.9.50",
168
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/@whatwg-node/server/-/server-0.9.50.tgz",
169
+ "integrity": "sha512-7Vd8k6iu+ps8bkZT+Y/wPm42EDh8KojAL+APKa79mntgkyPtdq0r1//CO+0eYqQBz6HGrDxHRT4KChSOy4jGIw==",
170
+ "license": "MIT",
171
+ "dependencies": {
172
+ "@whatwg-node/fetch": "^0.9.22",
173
+ "tslib": "^2.6.3"
174
+ },
175
+ "engines": {
176
+ "node": ">=18.0.0"
177
+ }
178
+ },
179
+ "node_modules/ansi-regex": {
180
+ "version": "5.0.1",
181
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/ansi-regex/-/ansi-regex-5.0.1.tgz",
182
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
183
+ "license": "MIT",
184
+ "engines": {
185
+ "node": ">=8"
186
+ }
187
+ },
188
+ "node_modules/ansi-styles": {
189
+ "version": "4.3.0",
190
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/ansi-styles/-/ansi-styles-4.3.0.tgz",
191
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
192
+ "license": "MIT",
193
+ "dependencies": {
194
+ "color-convert": "^2.0.1"
195
+ },
196
+ "engines": {
197
+ "node": ">=8"
198
+ },
199
+ "funding": {
200
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
201
+ }
202
+ },
203
+ "node_modules/busboy": {
204
+ "version": "1.6.0",
205
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/busboy/-/busboy-1.6.0.tgz",
206
+ "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==",
207
+ "dependencies": {
208
+ "streamsearch": "^1.1.0"
209
+ },
210
+ "engines": {
211
+ "node": ">=10.16.0"
212
+ }
213
+ },
214
+ "node_modules/cliui": {
215
+ "version": "8.0.1",
216
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/cliui/-/cliui-8.0.1.tgz",
217
+ "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
218
+ "license": "ISC",
219
+ "dependencies": {
220
+ "string-width": "^4.2.0",
221
+ "strip-ansi": "^6.0.1",
222
+ "wrap-ansi": "^7.0.0"
223
+ },
224
+ "engines": {
225
+ "node": ">=12"
226
+ }
227
+ },
228
+ "node_modules/color-convert": {
229
+ "version": "2.0.1",
230
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/color-convert/-/color-convert-2.0.1.tgz",
231
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
232
+ "license": "MIT",
233
+ "dependencies": {
234
+ "color-name": "~1.1.4"
235
+ },
236
+ "engines": {
237
+ "node": ">=7.0.0"
238
+ }
239
+ },
240
+ "node_modules/color-name": {
241
+ "version": "1.1.4",
242
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/color-name/-/color-name-1.1.4.tgz",
243
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
244
+ "license": "MIT"
245
+ },
246
+ "node_modules/dotenv": {
247
+ "version": "16.4.5",
248
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/dotenv/-/dotenv-16.4.5.tgz",
249
+ "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==",
250
+ "license": "BSD-2-Clause",
251
+ "engines": {
252
+ "node": ">=12"
253
+ },
254
+ "funding": {
255
+ "url": "https://dotenvx.com"
256
+ }
257
+ },
258
+ "node_modules/emoji-regex": {
259
+ "version": "8.0.0",
260
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/emoji-regex/-/emoji-regex-8.0.0.tgz",
261
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
262
+ "license": "MIT"
263
+ },
264
+ "node_modules/escalade": {
265
+ "version": "3.2.0",
266
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/escalade/-/escalade-3.2.0.tgz",
267
+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
268
+ "license": "MIT",
269
+ "engines": {
270
+ "node": ">=6"
271
+ }
272
+ },
273
+ "node_modules/fast-decode-uri-component": {
274
+ "version": "1.0.1",
275
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz",
276
+ "integrity": "sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==",
277
+ "license": "MIT"
278
+ },
279
+ "node_modules/fast-querystring": {
280
+ "version": "1.1.2",
281
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/fast-querystring/-/fast-querystring-1.1.2.tgz",
282
+ "integrity": "sha512-g6KuKWmFXc0fID8WWH0jit4g0AGBoJhCkJMb1RmbsSEUNvQ+ZC8D6CUZ+GtF8nMzSPXnhiePyyqqipzNNEnHjg==",
283
+ "license": "MIT",
284
+ "dependencies": {
285
+ "fast-decode-uri-component": "^1.0.1"
286
+ }
287
+ },
288
+ "node_modules/get-caller-file": {
289
+ "version": "2.0.5",
290
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/get-caller-file/-/get-caller-file-2.0.5.tgz",
291
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
292
+ "license": "ISC",
293
+ "engines": {
294
+ "node": "6.* || 8.* || >= 10.*"
295
+ }
296
+ },
297
+ "node_modules/is-fullwidth-code-point": {
298
+ "version": "3.0.0",
299
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
300
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
301
+ "license": "MIT",
302
+ "engines": {
303
+ "node": ">=8"
304
+ }
305
+ },
306
+ "node_modules/itty-router": {
307
+ "version": "5.0.18",
308
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/itty-router/-/itty-router-5.0.18.tgz",
309
+ "integrity": "sha512-mK3ReOt4ARAGy0V0J7uHmArG2USN2x0zprZ+u+YgmeRjXTDbaowDy3kPcsmQY6tH+uHhDgpWit9Vqmv/4rTXwA==",
310
+ "license": "MIT"
311
+ },
312
+ "node_modules/lodash.camelcase": {
313
+ "version": "4.3.0",
314
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
315
+ "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==",
316
+ "license": "MIT"
317
+ },
318
+ "node_modules/long": {
319
+ "version": "5.2.3",
320
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/long/-/long-5.2.3.tgz",
321
+ "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==",
322
+ "license": "Apache-2.0"
323
+ },
324
+ "node_modules/protobufjs": {
325
+ "version": "7.4.0",
326
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/protobufjs/-/protobufjs-7.4.0.tgz",
327
+ "integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==",
328
+ "hasInstallScript": true,
329
+ "license": "BSD-3-Clause",
330
+ "dependencies": {
331
+ "@protobufjs/aspromise": "^1.1.2",
332
+ "@protobufjs/base64": "^1.1.2",
333
+ "@protobufjs/codegen": "^2.0.4",
334
+ "@protobufjs/eventemitter": "^1.1.0",
335
+ "@protobufjs/fetch": "^1.1.0",
336
+ "@protobufjs/float": "^1.0.2",
337
+ "@protobufjs/inquire": "^1.1.0",
338
+ "@protobufjs/path": "^1.1.2",
339
+ "@protobufjs/pool": "^1.1.0",
340
+ "@protobufjs/utf8": "^1.1.0",
341
+ "@types/node": ">=13.7.0",
342
+ "long": "^5.0.0"
343
+ },
344
+ "engines": {
345
+ "node": ">=12.0.0"
346
+ }
347
+ },
348
+ "node_modules/require-directory": {
349
+ "version": "2.1.1",
350
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/require-directory/-/require-directory-2.1.1.tgz",
351
+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
352
+ "license": "MIT",
353
+ "engines": {
354
+ "node": ">=0.10.0"
355
+ }
356
+ },
357
+ "node_modules/streamsearch": {
358
+ "version": "1.1.0",
359
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/streamsearch/-/streamsearch-1.1.0.tgz",
360
+ "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==",
361
+ "engines": {
362
+ "node": ">=10.0.0"
363
+ }
364
+ },
365
+ "node_modules/string-width": {
366
+ "version": "4.2.3",
367
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/string-width/-/string-width-4.2.3.tgz",
368
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
369
+ "license": "MIT",
370
+ "dependencies": {
371
+ "emoji-regex": "^8.0.0",
372
+ "is-fullwidth-code-point": "^3.0.0",
373
+ "strip-ansi": "^6.0.1"
374
+ },
375
+ "engines": {
376
+ "node": ">=8"
377
+ }
378
+ },
379
+ "node_modules/strip-ansi": {
380
+ "version": "6.0.1",
381
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/strip-ansi/-/strip-ansi-6.0.1.tgz",
382
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
383
+ "license": "MIT",
384
+ "dependencies": {
385
+ "ansi-regex": "^5.0.1"
386
+ },
387
+ "engines": {
388
+ "node": ">=8"
389
+ }
390
+ },
391
+ "node_modules/tslib": {
392
+ "version": "2.8.0",
393
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/tslib/-/tslib-2.8.0.tgz",
394
+ "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==",
395
+ "license": "0BSD"
396
+ },
397
+ "node_modules/undici-types": {
398
+ "version": "6.19.8",
399
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/undici-types/-/undici-types-6.19.8.tgz",
400
+ "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
401
+ "license": "MIT"
402
+ },
403
+ "node_modules/urlpattern-polyfill": {
404
+ "version": "10.0.0",
405
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz",
406
+ "integrity": "sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg==",
407
+ "license": "MIT"
408
+ },
409
+ "node_modules/wrap-ansi": {
410
+ "version": "7.0.0",
411
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
412
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
413
+ "license": "MIT",
414
+ "dependencies": {
415
+ "ansi-styles": "^4.0.0",
416
+ "string-width": "^4.1.0",
417
+ "strip-ansi": "^6.0.0"
418
+ },
419
+ "engines": {
420
+ "node": ">=10"
421
+ },
422
+ "funding": {
423
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
424
+ }
425
+ },
426
+ "node_modules/y18n": {
427
+ "version": "5.0.8",
428
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/y18n/-/y18n-5.0.8.tgz",
429
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
430
+ "license": "ISC",
431
+ "engines": {
432
+ "node": ">=10"
433
+ }
434
+ },
435
+ "node_modules/yargs": {
436
+ "version": "17.7.2",
437
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/yargs/-/yargs-17.7.2.tgz",
438
+ "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
439
+ "license": "MIT",
440
+ "dependencies": {
441
+ "cliui": "^8.0.1",
442
+ "escalade": "^3.1.1",
443
+ "get-caller-file": "^2.0.5",
444
+ "require-directory": "^2.1.1",
445
+ "string-width": "^4.2.3",
446
+ "y18n": "^5.0.5",
447
+ "yargs-parser": "^21.1.1"
448
+ },
449
+ "engines": {
450
+ "node": ">=12"
451
+ }
452
+ },
453
+ "node_modules/yargs-parser": {
454
+ "version": "21.1.1",
455
+ "resolved": "https://mirrors.huaweicloud.com/repository/npm/yargs-parser/-/yargs-parser-21.1.1.tgz",
456
+ "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
457
+ "license": "ISC",
458
+ "engines": {
459
+ "node": ">=12"
460
+ }
461
+ }
462
+ }
463
+ }