x1ongzhu 2 жил өмнө
parent
commit
3afe4521da

+ 7 - 0
.env

@@ -47,3 +47,10 @@ ALIYUN_OSS_REGION=oss-cn-shenzhen
 ALIYUN_OSS_CDN=https://cdn.raex.vip
 ALIYUN_SMS_SIGN=华储AI
 ALIYUN_SMS_TEMPLATE_CODE=SMS_228870098
+
+AZURE_OPENAI_KEY=beb32e4625a94b65ba8bc0ba1688c4d2
+AZURE_OPENAI_ENDPOINT=https://zouma.openai.azure.com
+AZURE_OPENAI_DEPLOYMENT=gpt35
+AZURE_OPENAI_VERSION=2023-03-15-preview
+
+OPENAI_API_KEY=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

+ 0 - 3270
graph.json

@@ -1,3270 +0,0 @@
-{
-  "nodes": {
-    "95355232": {
-      "id": "95355232",
-      "label": "JwtModule",
-      "parent": "-536515674",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "JwtModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "JwtModule",
-        "initTime": 4.236540999263525
-      }
-    },
-    "203550704": {
-      "id": "203550704",
-      "label": "ExternalContextCreator",
-      "parent": "555176277",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "InternalCoreModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": true,
-        "token": "ExternalContextCreator"
-      }
-    },
-    "211572259": {
-      "id": "211572259",
-      "label": "ConfigHostModule",
-      "metadata": {
-        "type": "module",
-        "global": true,
-        "dynamic": false,
-        "internal": false
-      }
-    },
-    "225063248": {
-      "id": "225063248",
-      "label": "InternalCoreModule",
-      "parent": "555176277",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "InternalCoreModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "InternalCoreModule",
-        "initTime": 5.741374999284744
-      }
-    },
-    "233936880": {
-      "id": "233936880",
-      "label": "AppController",
-      "parent": "-19112576",
-      "metadata": {
-        "type": "controller",
-        "internal": false,
-        "sourceModuleName": "AppModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "AppController"
-      }
-    },
-    "266839889": {
-      "id": "266839889",
-      "label": "EntityManager",
-      "parent": "-1026304274",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "TypeOrmCoreModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "EntityManager"
-      }
-    },
-    "303302557": {
-      "id": "303302557",
-      "label": "ModuleRef",
-      "parent": "211572259",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ConfigHostModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "373235992": {
-      "id": "373235992",
-      "label": "SandboxedCodeExecutor",
-      "parent": "-1033621697",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "DevtoolsModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "SandboxedCodeExecutor"
-      }
-    },
-    "385041166": {
-      "id": "385041166",
-      "label": "JwtStrategy",
-      "parent": "-1134487807",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "AuthModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "JwtStrategy"
-      }
-    },
-    "400681591": {
-      "id": "400681591",
-      "label": "DiscoveryService",
-      "parent": "-643397745",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "DiscoveryModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "DiscoveryService"
-      }
-    },
-    "457665600": {
-      "id": "457665600",
-      "label": "AliyunModule",
-      "parent": "612499341",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "AliyunModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "AliyunModule",
-        "initTime": 4.577375002205372
-      }
-    },
-    "545846241": {
-      "id": "545846241",
-      "label": "TypeOrmModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": true,
-        "internal": false
-      }
-    },
-    "545846242": {
-      "id": "545846242",
-      "label": "TypeOrmModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": true,
-        "internal": false
-      }
-    },
-    "555176277": {
-      "id": "555176277",
-      "label": "InternalCoreModule",
-      "metadata": {
-        "type": "module",
-        "global": true,
-        "dynamic": true,
-        "internal": true
-      }
-    },
-    "590446087": {
-      "id": "590446087",
-      "label": "ModuleRef",
-      "parent": "612499341",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "AliyunModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "603011239": {
-      "id": "603011239",
-      "label": "UsersService",
-      "parent": "-2003726489",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "UsersModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "UsersService"
-      }
-    },
-    "612499341": {
-      "id": "612499341",
-      "label": "AliyunModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": false,
-        "internal": false
-      }
-    },
-    "671882984": {
-      "id": "671882984",
-      "label": "Reflector",
-      "parent": "555176277",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "InternalCoreModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "Reflector",
-        "initTime": 5.6712500005960464
-      }
-    },
-    "687352615": {
-      "id": "687352615",
-      "label": "ModuleRef",
-      "parent": "545846241",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "TypeOrmModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "687352616": {
-      "id": "687352616",
-      "label": "ModuleRef",
-      "parent": "545846242",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "TypeOrmModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "712454178": {
-      "id": "712454178",
-      "label": "ApplicationConfig",
-      "parent": "1482218087",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ThrottlerModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "731684192": {
-      "id": "731684192",
-      "label": "TypeOrmCoreModule",
-      "parent": "-1026304274",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "TypeOrmCoreModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "TypeOrmCoreModule"
-      }
-    },
-    "863216333": {
-      "id": "863216333",
-      "label": "ConfigModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": false,
-        "internal": false
-      }
-    },
-    "863216334": {
-      "id": "863216334",
-      "label": "ConfigModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": true,
-        "internal": false
-      }
-    },
-    "863216335": {
-      "id": "863216335",
-      "label": "ConfigModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": true,
-        "internal": false
-      }
-    },
-    "915774976": {
-      "id": "915774976",
-      "label": "ApplicationConfig",
-      "parent": "1712628187",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "930519593": {
-      "id": "930519593",
-      "label": "ConfigService",
-      "parent": "211572259",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "ConfigHostModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "Symbol(CONFIG_SERVICE)"
-      }
-    },
-    "1014874916": {
-      "id": "1014874916",
-      "label": "TypeOrmModuleId",
-      "parent": "-1026304274",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "TypeOrmCoreModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "TypeOrmModuleId"
-      }
-    },
-    "1063746662": {
-      "id": "1063746662",
-      "label": "CONFIGURATION_TOKEN",
-      "parent": "211572259",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "ConfigHostModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "CONFIGURATION_TOKEN",
-        "initTime": 4.8645419999957085
-      }
-    },
-    "1070370213": {
-      "id": "1070370213",
-      "label": "JwtService",
-      "parent": "-536515674",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "JwtModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "JwtService"
-      }
-    },
-    "1144875719": {
-      "id": "1144875719",
-      "label": "ModuleRef",
-      "parent": "863216333",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "1144875720": {
-      "id": "1144875720",
-      "label": "ModuleRef",
-      "parent": "863216334",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "1144875721": {
-      "id": "1144875721",
-      "label": "ModuleRef",
-      "parent": "863216335",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "1259084392": {
-      "id": "1259084392",
-      "label": "SmsRecordRepository",
-      "parent": "545846241",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "TypeOrmModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "SmsRecordRepository"
-      }
-    },
-    "1310883338": {
-      "id": "1310883338",
-      "label": "CONFIGURATION_LOADER",
-      "parent": "863216334",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "CONFIGURATION_LOADER"
-      }
-    },
-    "1333473084": {
-      "id": "1333473084",
-      "label": "CONFIGURATION_LOADER",
-      "parent": "863216335",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "CONFIGURATION_LOADER"
-      }
-    },
-    "1349506255": {
-      "id": "1349506255",
-      "label": "ModuleRef",
-      "parent": "-1327562795",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "FileModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "1376902224": {
-      "id": "1376902224",
-      "label": "FileModule",
-      "parent": "-1327562795",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "FileModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "FileModule",
-        "initTime": 4.214375000447035
-      }
-    },
-    "1399306624": {
-      "id": "1399306624",
-      "label": "ThrottlerModule",
-      "parent": "1482218087",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ThrottlerModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ThrottlerModule",
-        "initTime": 4.858208000659943
-      }
-    },
-    "1404752088": {
-      "id": "1404752088",
-      "label": "AuthController",
-      "parent": "-1134487807",
-      "metadata": {
-        "type": "controller",
-        "internal": false,
-        "sourceModuleName": "AuthModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "AuthController"
-      }
-    },
-    "1434456218": {
-      "id": "1434456218",
-      "label": "Reflector",
-      "parent": "555176277",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "InternalCoreModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": true,
-        "token": "Reflector"
-      }
-    },
-    "1475573941": {
-      "id": "1475573941",
-      "label": "ModuleRef",
-      "parent": "-2135742481",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "TypeOrmModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "1482218087": {
-      "id": "1482218087",
-      "label": "ThrottlerModule",
-      "metadata": {
-        "type": "module",
-        "global": true,
-        "dynamic": true,
-        "internal": false
-      }
-    },
-    "1489982643": {
-      "id": "1489982643",
-      "label": "ApplicationConfig",
-      "parent": "-759474504",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "SmsModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "1529900285": {
-      "id": "1529900285",
-      "label": "Connection",
-      "parent": "-1026304274",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "TypeOrmCoreModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": true,
-        "token": "Connection"
-      }
-    },
-    "1542581243": {
-      "id": "1542581243",
-      "label": "ModuleRef",
-      "parent": "-1134487807",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "AuthModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "1579130544": {
-      "id": "1579130544",
-      "label": "ApplicationConfig",
-      "parent": "-1918983541",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "OpenaiModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "1609867136": {
-      "id": "1609867136",
-      "label": "FileController",
-      "parent": "-1327562795",
-      "metadata": {
-        "type": "controller",
-        "internal": false,
-        "sourceModuleName": "FileModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "FileController",
-        "enhancers": [
-          {
-            "id": "-1624918028",
-            "methodKey": "uploadFile",
-            "subtype": "interceptor"
-          }
-        ]
-      }
-    },
-    "1623724461": {
-      "id": "1623724461",
-      "label": "ModuleRef",
-      "parent": "1482218087",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ThrottlerModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "1688619051": {
-      "id": "1688619051",
-      "label": "DevtoolsHttpServerHost",
-      "parent": "-1033621697",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "DevtoolsModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "DevtoolsHttpServerHost"
-      }
-    },
-    "1690574933": {
-      "id": "1690574933",
-      "label": "ModuleRef",
-      "parent": "1712628187",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "1705191969": {
-      "id": "1705191969",
-      "label": "AliyunService",
-      "parent": "612499341",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "AliyunModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "AliyunService"
-      }
-    },
-    "1712628187": {
-      "id": "1712628187",
-      "label": "ConfigModule",
-      "metadata": {
-        "type": "module",
-        "global": true,
-        "dynamic": true,
-        "internal": false
-      }
-    },
-    "1712941473": {
-      "id": "1712941473",
-      "label": "ApplicationConfig",
-      "parent": "-536515674",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "JwtModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "1769319388": {
-      "id": "1769319388",
-      "label": "ConfigModule",
-      "parent": "1712628187",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ConfigModule",
-        "initTime": 4.98641600087285
-      }
-    },
-    "1787828844": {
-      "id": "1787828844",
-      "label": "ConfigHostModule",
-      "parent": "211572259",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ConfigHostModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ConfigHostModule",
-        "initTime": 4.869625002145767
-      }
-    },
-    "1817334964": {
-      "id": "1817334964",
-      "label": "ModuleRef",
-      "parent": "-1026304274",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "TypeOrmCoreModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "1837744481": {
-      "id": "1837744481",
-      "label": "FileService",
-      "parent": "-1327562795",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "FileModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "FileService"
-      }
-    },
-    "1864578377": {
-      "id": "1864578377",
-      "label": "SmsService",
-      "parent": "-759474504",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "SmsModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "SmsService"
-      }
-    },
-    "1919157847": {
-      "id": "1919157847",
-      "label": "REQUEST",
-      "parent": "555176277",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "InternalCoreModule",
-        "durable": false,
-        "static": false,
-        "scope": 2,
-        "transient": false,
-        "exported": true,
-        "token": "REQUEST",
-        "initTime": 2.5646249987185
-      }
-    },
-    "1989588516": {
-      "id": "1989588516",
-      "label": "ApplicationConfig",
-      "parent": "-1033621697",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "DevtoolsModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "2075644217": {
-      "id": "2075644217",
-      "label": "TypeOrmModuleOptions",
-      "parent": "-1026304274",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "TypeOrmCoreModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "TypeOrmModuleOptions"
-      }
-    },
-    "2118694856": {
-      "id": "2118694856",
-      "label": "ApplicationConfig",
-      "parent": "211572259",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ConfigHostModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "-1486320561": {
-      "id": "-1486320561",
-      "label": "ModuleRef",
-      "parent": "555176277",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "InternalCoreModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "-651043398": {
-      "id": "-651043398",
-      "label": "ApplicationConfig",
-      "parent": "555176277",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "InternalCoreModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "-255469305": {
-      "id": "-255469305",
-      "label": "INQUIRER",
-      "parent": "555176277",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "InternalCoreModule",
-        "durable": false,
-        "static": true,
-        "scope": 1,
-        "transient": true,
-        "exported": true,
-        "token": "INQUIRER",
-        "initTime": 2.561083000153303
-      }
-    },
-    "-26938366": {
-      "id": "-26938366",
-      "label": "ModulesContainer",
-      "parent": "555176277",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "InternalCoreModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": true,
-        "token": "ModulesContainer"
-      }
-    },
-    "-326832201": {
-      "id": "-326832201",
-      "label": "HttpAdapterHost",
-      "parent": "555176277",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "InternalCoreModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": true,
-        "token": "HttpAdapterHost"
-      }
-    },
-    "-553129559": {
-      "id": "-553129559",
-      "label": "HttpAdapterHost",
-      "parent": "555176277",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "InternalCoreModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": true,
-        "token": "HttpAdapterHost",
-        "initTime": 5.931333001703024
-      }
-    },
-    "-702581189": {
-      "id": "-702581189",
-      "label": "LazyModuleLoader",
-      "parent": "555176277",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "InternalCoreModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "LazyModuleLoader",
-        "initTime": 5.39979100227356
-      }
-    },
-    "-1904419534": {
-      "id": "-1904419534",
-      "label": "SerializedGraph",
-      "parent": "555176277",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "InternalCoreModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": true,
-        "token": "SerializedGraph"
-      }
-    },
-    "-19112576": {
-      "id": "-19112576",
-      "label": "AppModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": false,
-        "internal": false
-      }
-    },
-    "-2139588960": {
-      "id": "-2139588960",
-      "label": "AppModule",
-      "parent": "-19112576",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "AppModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "AppModule",
-        "initTime": 5.394708998501301
-      }
-    },
-    "-71302842": {
-      "id": "-71302842",
-      "label": "ModuleRef",
-      "parent": "-19112576",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "AppModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "-2064622725": {
-      "id": "-2064622725",
-      "label": "ApplicationConfig",
-      "parent": "-19112576",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "AppModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "-2130614055": {
-      "id": "-2130614055",
-      "label": "AppService",
-      "parent": "-19112576",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "AppModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "AppService",
-        "initTime": 5.267290998250246
-      }
-    },
-    "-1033621697": {
-      "id": "-1033621697",
-      "label": "DevtoolsModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": true,
-        "internal": false
-      }
-    },
-    "-1142553948": {
-      "id": "-1142553948",
-      "label": "DevtoolsModule",
-      "parent": "-1033621697",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "DevtoolsModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "DevtoolsModule",
-        "initTime": 5.249499998986721
-      }
-    },
-    "-751962311": {
-      "id": "-751962311",
-      "label": "ModuleRef",
-      "parent": "-1033621697",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "DevtoolsModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "-190334293": {
-      "id": "-190334293",
-      "label": "CONFIGURABLE_MODULE_OPTIONS[9e579419cfe20f56e38d2]",
-      "parent": "-1033621697",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "DevtoolsModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "CONFIGURABLE_MODULE_OPTIONS[9e579419cfe20f56e38d2]"
-      }
-    },
-    "-643397745": {
-      "id": "-643397745",
-      "label": "DiscoveryModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": false,
-        "internal": false
-      }
-    },
-    "-1048394624": {
-      "id": "-1048394624",
-      "label": "DiscoveryModule",
-      "parent": "-643397745",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "DiscoveryModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "DiscoveryModule",
-        "initTime": 4.9926670007407665
-      }
-    },
-    "-501891371": {
-      "id": "-501891371",
-      "label": "ModuleRef",
-      "parent": "-643397745",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "DiscoveryModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "-1413161654": {
-      "id": "-1413161654",
-      "label": "ApplicationConfig",
-      "parent": "-643397745",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "DiscoveryModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "-438112115": {
-      "id": "-438112115",
-      "label": "MetadataScanner",
-      "parent": "-643397745",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "DiscoveryModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "MetadataScanner",
-        "initTime": 5.003125000745058
-      }
-    },
-    "-503631789": {
-      "id": "-503631789",
-      "label": "ConfigService",
-      "parent": "1712628187",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "ConfigService"
-      }
-    },
-    "-1952648617": {
-      "id": "-1952648617",
-      "label": "THROTTLER:MODULE_OPTIONS",
-      "parent": "1482218087",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "ThrottlerModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "THROTTLER:MODULE_OPTIONS"
-      }
-    },
-    "-470986226": {
-      "id": "-470986226",
-      "label": "Symbol(ThrottlerStorage)",
-      "parent": "1482218087",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "ThrottlerModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "Symbol(ThrottlerStorage)"
-      }
-    },
-    "-491114354": {
-      "id": "-491114354",
-      "label": "ConfigModule",
-      "parent": "863216333",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ConfigModule",
-        "initTime": 4.7417079992592335
-      }
-    },
-    "-408540750": {
-      "id": "-408540750",
-      "label": "ApplicationConfig",
-      "parent": "863216333",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "-503631788": {
-      "id": "-503631788",
-      "label": "ConfigService",
-      "parent": "863216333",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": true,
-        "token": "ConfigService"
-      }
-    },
-    "-2135742481": {
-      "id": "-2135742481",
-      "label": "TypeOrmModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": true,
-        "internal": false
-      }
-    },
-    "-1872891520": {
-      "id": "-1872891520",
-      "label": "TypeOrmModule",
-      "parent": "-2135742481",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "TypeOrmModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "TypeOrmModule",
-        "initTime": 4.732625000178814
-      }
-    },
-    "-1068388246": {
-      "id": "-1068388246",
-      "label": "ApplicationConfig",
-      "parent": "-2135742481",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "TypeOrmModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "-1026304274": {
-      "id": "-1026304274",
-      "label": "TypeOrmCoreModule",
-      "metadata": {
-        "type": "module",
-        "global": true,
-        "dynamic": true,
-        "internal": false
-      }
-    },
-    "-2035045911": {
-      "id": "-2035045911",
-      "label": "ApplicationConfig",
-      "parent": "-1026304274",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "TypeOrmCoreModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "-2103415210": {
-      "id": "-2103415210",
-      "label": "DataSource",
-      "parent": "-1026304274",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "TypeOrmCoreModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "DataSource"
-      }
-    },
-    "-184353870": {
-      "id": "-184353870",
-      "label": "ApplicationConfig",
-      "parent": "612499341",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "AliyunModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "-491114353": {
-      "id": "-491114353",
-      "label": "ConfigModule",
-      "parent": "863216334",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ConfigModule",
-        "initTime": 4.5489999987185
-      }
-    },
-    "-408540749": {
-      "id": "-408540749",
-      "label": "ApplicationConfig",
-      "parent": "863216334",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "-503631786": {
-      "id": "-503631786",
-      "label": "ConfigService",
-      "parent": "863216334",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "ConfigService"
-      }
-    },
-    "-1790226991": {
-      "id": "-1790226991",
-      "label": "CONFIGURATION(aliyun)",
-      "parent": "863216334",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "CONFIGURATION(aliyun)",
-        "initTime": 4.555833000689745
-      }
-    },
-    "-759474504": {
-      "id": "-759474504",
-      "label": "SmsModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": false,
-        "internal": false
-      }
-    },
-    "-648981088": {
-      "id": "-648981088",
-      "label": "SmsModule",
-      "parent": "-759474504",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "SmsModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "SmsModule",
-        "initTime": 4.504958000034094
-      }
-    },
-    "-811664770": {
-      "id": "-811664770",
-      "label": "ModuleRef",
-      "parent": "-759474504",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "SmsModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "-397258000": {
-      "id": "-397258000",
-      "label": "SmsController",
-      "parent": "-759474504",
-      "metadata": {
-        "type": "controller",
-        "internal": false,
-        "sourceModuleName": "SmsModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "SmsController"
-      }
-    },
-    "-257450702": {
-      "id": "-257450702",
-      "label": "TypeOrmModule",
-      "parent": "545846241",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "TypeOrmModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "TypeOrmModule",
-        "initTime": 4.366042003035545
-      }
-    },
-    "-223917668": {
-      "id": "-223917668",
-      "label": "ApplicationConfig",
-      "parent": "545846241",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "TypeOrmModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "-2003726489": {
-      "id": "-2003726489",
-      "label": "UsersModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": false,
-        "internal": false
-      }
-    },
-    "-495603840": {
-      "id": "-495603840",
-      "label": "UsersModule",
-      "parent": "-2003726489",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "UsersModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "UsersModule",
-        "initTime": 4.358500000089407
-      }
-    },
-    "-618964563": {
-      "id": "-618964563",
-      "label": "ModuleRef",
-      "parent": "-2003726489",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "UsersModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "-643958110": {
-      "id": "-643958110",
-      "label": "ApplicationConfig",
-      "parent": "-2003726489",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "UsersModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "-1629317077": {
-      "id": "-1629317077",
-      "label": "BcryptService",
-      "parent": "-2003726489",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "UsersModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "HashingService",
-        "initTime": 4.353542000055313
-      }
-    },
-    "-1102473136": {
-      "id": "-1102473136",
-      "label": "UsersController",
-      "parent": "-2003726489",
-      "metadata": {
-        "type": "controller",
-        "internal": false,
-        "sourceModuleName": "UsersModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "UsersController"
-      }
-    },
-    "-257450701": {
-      "id": "-257450701",
-      "label": "TypeOrmModule",
-      "parent": "545846242",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "TypeOrmModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "TypeOrmModule",
-        "initTime": 4.327167000621557
-      }
-    },
-    "-223917667": {
-      "id": "-223917667",
-      "label": "ApplicationConfig",
-      "parent": "545846242",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "TypeOrmModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "-323187286": {
-      "id": "-323187286",
-      "label": "UsersRepository",
-      "parent": "545846242",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "TypeOrmModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "UsersRepository"
-      }
-    },
-    "-1134487807": {
-      "id": "-1134487807",
-      "label": "AuthModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": false,
-        "internal": false
-      }
-    },
-    "-1846279256": {
-      "id": "-1846279256",
-      "label": "AuthModule",
-      "parent": "-1134487807",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "AuthModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "AuthModule",
-        "initTime": 4.316874999552965
-      }
-    },
-    "-120792986": {
-      "id": "-120792986",
-      "label": "ApplicationConfig",
-      "parent": "-1134487807",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "AuthModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "-793915935": {
-      "id": "-793915935",
-      "label": "AuthService",
-      "parent": "-1134487807",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "AuthModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "AuthService"
-      }
-    },
-    "-239266870": {
-      "id": "-239266870",
-      "label": "JwtAuthGuard",
-      "parent": "-1134487807",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "AuthModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "APP_GUARD (UUID: 1239237319)",
-        "subtype": "guard"
-      }
-    },
-    "-491114352": {
-      "id": "-491114352",
-      "label": "ConfigModule",
-      "parent": "863216335",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ConfigModule",
-        "initTime": 4.271291997283697
-      }
-    },
-    "-408540748": {
-      "id": "-408540748",
-      "label": "ApplicationConfig",
-      "parent": "863216335",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "-503631784": {
-      "id": "-503631784",
-      "label": "ConfigService",
-      "parent": "863216335",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "ConfigService"
-      }
-    },
-    "-1453472830": {
-      "id": "-1453472830",
-      "label": "CONFIGURATION(jwt)",
-      "parent": "863216335",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "ConfigModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": true,
-        "token": "CONFIGURATION(jwt)",
-        "initTime": 4.2827909998595715
-      }
-    },
-    "-536515674": {
-      "id": "-536515674",
-      "label": "JwtModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": true,
-        "internal": false
-      }
-    },
-    "-588705940": {
-      "id": "-588705940",
-      "label": "ModuleRef",
-      "parent": "-536515674",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "JwtModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "-1900804336": {
-      "id": "-1900804336",
-      "label": "JWT_MODULE_OPTIONS",
-      "parent": "-536515674",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "JwtModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "JWT_MODULE_OPTIONS"
-      }
-    },
-    "-1327562795": {
-      "id": "-1327562795",
-      "label": "FileModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": false,
-        "internal": false
-      }
-    },
-    "-313867974": {
-      "id": "-313867974",
-      "label": "ApplicationConfig",
-      "parent": "-1327562795",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "FileModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ApplicationConfig"
-      }
-    },
-    "-1624918028": {
-      "id": "-1624918028",
-      "label": "579419cfe20f56e38d244",
-      "parent": "-1327562795",
-      "metadata": {
-        "type": "injectable",
-        "internal": false,
-        "sourceModuleName": "FileModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "579419cfe20f56e38d244",
-        "subtype": "interceptor"
-      }
-    },
-    "-1918983541": {
-      "id": "-1918983541",
-      "label": "OpenaiModule",
-      "metadata": {
-        "type": "module",
-        "global": false,
-        "dynamic": false,
-        "internal": false
-      }
-    },
-    "-1281481412": {
-      "id": "-1281481412",
-      "label": "OpenaiModule",
-      "parent": "-1918983541",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "OpenaiModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "OpenaiModule",
-        "initTime": 4.19870799779892
-      }
-    },
-    "-1941036795": {
-      "id": "-1941036795",
-      "label": "ModuleRef",
-      "parent": "-1918983541",
-      "metadata": {
-        "type": "provider",
-        "internal": true,
-        "sourceModuleName": "OpenaiModule",
-        "durable": false,
-        "static": true,
-        "scope": 0,
-        "transient": false,
-        "exported": false,
-        "token": "ModuleRef"
-      }
-    },
-    "-2033682719": {
-      "id": "-2033682719",
-      "label": "OpenaiService",
-      "parent": "-1918983541",
-      "metadata": {
-        "type": "provider",
-        "internal": false,
-        "sourceModuleName": "OpenaiModule",
-        "durable": false,
-        "static": true,
-        "transient": false,
-        "exported": false,
-        "token": "OpenaiService"
-      }
-    }
-  },
-  "edges": {
-    "33362649": {
-      "source": "-1327562795",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "FileModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "33362649"
-    },
-    "43962647": {
-      "source": "-2003726489",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "UsersModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "43962647"
-    },
-    "50149515": {
-      "source": "863216334",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "50149515"
-    },
-    "175763745": {
-      "source": "545846241",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "175763745"
-    },
-    "184060730": {
-      "source": "-643397745",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "DiscoveryModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "184060730"
-    },
-    "219775656": {
-      "source": "-19112576",
-      "target": "-1134487807",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AppModule",
-        "targetModuleName": "AuthModule"
-      },
-      "id": "219775656"
-    },
-    "241654674": {
-      "source": "-1026304274",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmCoreModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "241654674"
-    },
-    "254091268": {
-      "source": "863216333",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "254091268"
-    },
-    "289403048": {
-      "source": "-1134487807",
-      "target": "-2003726489",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AuthModule",
-        "targetModuleName": "UsersModule"
-      },
-      "id": "289403048"
-    },
-    "309543654": {
-      "source": "-759474504",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "SmsModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "309543654"
-    },
-    "353572985": {
-      "source": "1712628187",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "353572985"
-    },
-    "363633297": {
-      "source": "-1327562795",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "FileModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "363633297"
-    },
-    "420319069": {
-      "source": "-2003726489",
-      "target": "-759474504",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "UsersModule",
-        "targetModuleName": "SmsModule"
-      },
-      "id": "420319069"
-    },
-    "450524884": {
-      "source": "545846241",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "450524884"
-    },
-    "453731008": {
-      "source": "863216334",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "453731008"
-    },
-    "459666374": {
-      "source": "-759474504",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "SmsModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "459666374"
-    },
-    "508258671": {
-      "source": "612499341",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AliyunModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "508258671"
-    },
-    "527989730": {
-      "source": "-759474504",
-      "target": "545846241",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "SmsModule",
-        "targetModuleName": "TypeOrmModule"
-      },
-      "id": "527989730"
-    },
-    "561408245": {
-      "source": "-1033621697",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "DevtoolsModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "561408245"
-    },
-    "565650659": {
-      "source": "-536515674",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "JwtModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "565650659"
-    },
-    "584653416": {
-      "source": "1712628187",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "584653416"
-    },
-    "591206582": {
-      "source": "545846241",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "591206582"
-    },
-    "632258133": {
-      "source": "545846242",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "632258133"
-    },
-    "636494595": {
-      "source": "-536515674",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "JwtModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "636494595"
-    },
-    "677989064": {
-      "source": "-643397745",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "DiscoveryModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "677989064"
-    },
-    "784525888": {
-      "source": "-536515674",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "JwtModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "784525888"
-    },
-    "920687522": {
-      "source": "-1134487807",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AuthModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "920687522"
-    },
-    "978356204": {
-      "source": "-1134487807",
-      "target": "-536515674",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AuthModule",
-        "targetModuleName": "JwtModule"
-      },
-      "id": "978356204"
-    },
-    "987755577": {
-      "source": "-2003726489",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "UsersModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "987755577"
-    },
-    "1010561902": {
-      "source": "545846241",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "1010561902"
-    },
-    "1056428433": {
-      "source": "-19112576",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AppModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "1056428433"
-    },
-    "1134336077": {
-      "source": "-536515674",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "JwtModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "1134336077"
-    },
-    "1138009401": {
-      "source": "-1327562795",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "FileModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "1138009401"
-    },
-    "1173495886": {
-      "source": "-759474504",
-      "target": "612499341",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "SmsModule",
-        "targetModuleName": "AliyunModule"
-      },
-      "id": "1173495886"
-    },
-    "1173813571": {
-      "source": "-536515674",
-      "target": "863216335",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "JwtModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "1173813571"
-    },
-    "1176615609": {
-      "source": "-2003726489",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "UsersModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "1176615609"
-    },
-    "1263570858": {
-      "source": "-759474504",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "SmsModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "1263570858"
-    },
-    "1318898112": {
-      "source": "-19112576",
-      "target": "-2135742481",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AppModule",
-        "targetModuleName": "TypeOrmModule"
-      },
-      "id": "1318898112"
-    },
-    "1333633315": {
-      "source": "863216334",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "1333633315"
-    },
-    "1359911797": {
-      "source": "-19112576",
-      "target": "612499341",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AppModule",
-        "targetModuleName": "AliyunModule"
-      },
-      "id": "1359911797"
-    },
-    "1414936007": {
-      "source": "-536515674",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "JwtModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "1414936007"
-    },
-    "1431808641": {
-      "source": "-1134487807",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AuthModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "1431808641"
-    },
-    "1450432242": {
-      "source": "1482218087",
-      "target": "863216333",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ThrottlerModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "1450432242"
-    },
-    "1454288893": {
-      "source": "-2135742481",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "1454288893"
-    },
-    "1457352847": {
-      "source": "-1134487807",
-      "target": "863216335",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AuthModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "1457352847"
-    },
-    "1488040101": {
-      "source": "211572259",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigHostModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "1488040101"
-    },
-    "1498156362": {
-      "source": "863216333",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "1498156362"
-    },
-    "1577638499": {
-      "source": "-1918983541",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "OpenaiModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "1577638499"
-    },
-    "1635338963": {
-      "source": "-2135742481",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "1635338963"
-    },
-    "1690588001": {
-      "source": "-1134487807",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AuthModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "1690588001"
-    },
-    "1720992914": {
-      "source": "-2003726489",
-      "target": "545846242",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "UsersModule",
-        "targetModuleName": "TypeOrmModule"
-      },
-      "id": "1720992914"
-    },
-    "1733675336": {
-      "source": "-1033621697",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "DevtoolsModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "1733675336"
-    },
-    "1733822514": {
-      "source": "1482218087",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ThrottlerModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "1733822514"
-    },
-    "1744123909": {
-      "source": "-1026304274",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmCoreModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "1744123909"
-    },
-    "1759774274": {
-      "source": "-643397745",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "DiscoveryModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "1759774274"
-    },
-    "1786225585": {
-      "source": "1482218087",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ThrottlerModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "1786225585"
-    },
-    "1867382584": {
-      "source": "-1026304274",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmCoreModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "1867382584"
-    },
-    "1901737855": {
-      "source": "863216333",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "1901737855"
-    },
-    "2090103949": {
-      "source": "545846242",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "2090103949"
-    },
-    "2099251801": {
-      "source": "211572259",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigHostModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "2099251801"
-    },
-    "2107559886": {
-      "source": "-1033621697",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "DevtoolsModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "2107559886"
-    },
-    "2109546608": {
-      "source": "863216333",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "2109546608"
-    },
-    "-692061701": {
-      "source": "-19112576",
-      "target": "-1033621697",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AppModule",
-        "targetModuleName": "DevtoolsModule"
-      },
-      "id": "-692061701"
-    },
-    "-844262897": {
-      "source": "-19112576",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AppModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "-844262897"
-    },
-    "-1091370085": {
-      "source": "-19112576",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AppModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "-1091370085"
-    },
-    "-1622731513": {
-      "source": "-19112576",
-      "target": "-759474504",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AppModule",
-        "targetModuleName": "SmsModule"
-      },
-      "id": "-1622731513"
-    },
-    "-158970266": {
-      "source": "-19112576",
-      "target": "-2003726489",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AppModule",
-        "targetModuleName": "UsersModule"
-      },
-      "id": "-158970266"
-    },
-    "-789499568": {
-      "source": "-19112576",
-      "target": "-1327562795",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AppModule",
-        "targetModuleName": "FileModule"
-      },
-      "id": "-789499568"
-    },
-    "-668061890": {
-      "source": "-19112576",
-      "target": "-1918983541",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AppModule",
-        "targetModuleName": "OpenaiModule"
-      },
-      "id": "-668061890"
-    },
-    "-815553404": {
-      "source": "-19112576",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AppModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "-815553404"
-    },
-    "-495517505": {
-      "source": "-19112576",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AppModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "-495517505"
-    },
-    "-1926621316": {
-      "source": "-1033621697",
-      "target": "-643397745",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "DevtoolsModule",
-        "targetModuleName": "DiscoveryModule"
-      },
-      "id": "-1926621316"
-    },
-    "-308574300": {
-      "source": "-1033621697",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "DevtoolsModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "-308574300"
-    },
-    "-932159694": {
-      "source": "-1033621697",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "DevtoolsModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "-932159694"
-    },
-    "-1107570771": {
-      "source": "-643397745",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "DiscoveryModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "-1107570771"
-    },
-    "-1777027914": {
-      "source": "-643397745",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "DiscoveryModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "-1777027914"
-    },
-    "-50008508": {
-      "source": "1712628187",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "-50008508"
-    },
-    "-1766726454": {
-      "source": "1712628187",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "-1766726454"
-    },
-    "-1995183955": {
-      "source": "211572259",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigHostModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "-1995183955"
-    },
-    "-60954175": {
-      "source": "211572259",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigHostModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "-60954175"
-    },
-    "-2016448962": {
-      "source": "1482218087",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ThrottlerModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "-2016448962"
-    },
-    "-1929299820": {
-      "source": "1482218087",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ThrottlerModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "-1929299820"
-    },
-    "-1982558226": {
-      "source": "863216333",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "-1982558226"
-    },
-    "-1887218609": {
-      "source": "-2135742481",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "-1887218609"
-    },
-    "-645931578": {
-      "source": "-2135742481",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "-645931578"
-    },
-    "-230488741": {
-      "source": "-2135742481",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "-230488741"
-    },
-    "-2027398394": {
-      "source": "-1026304274",
-      "target": "863216333",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmCoreModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "-2027398394"
-    },
-    "-485008942": {
-      "source": "-1026304274",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmCoreModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "-485008942"
-    },
-    "-651417091": {
-      "source": "612499341",
-      "target": "863216334",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AliyunModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "-651417091"
-    },
-    "-1086257698": {
-      "source": "612499341",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AliyunModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "-1086257698"
-    },
-    "-304556580": {
-      "source": "612499341",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AliyunModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "-304556580"
-    },
-    "-2117513122": {
-      "source": "612499341",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AliyunModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "-2117513122"
-    },
-    "-1596822380": {
-      "source": "612499341",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AliyunModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "-1596822380"
-    },
-    "-1947734289": {
-      "source": "863216334",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "-1947734289"
-    },
-    "-2041010993": {
-      "source": "863216334",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "-2041010993"
-    },
-    "-355003171": {
-      "source": "-759474504",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "SmsModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "-355003171"
-    },
-    "-663679132": {
-      "source": "-759474504",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "SmsModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "-663679132"
-    },
-    "-733930814": {
-      "source": "545846241",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "-733930814"
-    },
-    "-991562516": {
-      "source": "-2003726489",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "UsersModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "-991562516"
-    },
-    "-127805263": {
-      "source": "-2003726489",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "UsersModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "-127805263"
-    },
-    "-1762775552": {
-      "source": "545846242",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "-1762775552"
-    },
-    "-1347332715": {
-      "source": "545846242",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "-1347332715"
-    },
-    "-1627865725": {
-      "source": "545846242",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "TypeOrmModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "-1627865725"
-    },
-    "-1377619055": {
-      "source": "-1134487807",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AuthModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "-1377619055"
-    },
-    "-1088610631": {
-      "source": "-1134487807",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "AuthModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "-1088610631"
-    },
-    "-994275839": {
-      "source": "863216335",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "-994275839"
-    },
-    "-1912910352": {
-      "source": "863216335",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "-1912910352"
-    },
-    "-1896601298": {
-      "source": "863216335",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "-1896601298"
-    },
-    "-1397857332": {
-      "source": "863216335",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "-1397857332"
-    },
-    "-1881791934": {
-      "source": "863216335",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "ConfigModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "-1881791934"
-    },
-    "-693890971": {
-      "source": "-1327562795",
-      "target": "612499341",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "FileModule",
-        "targetModuleName": "AliyunModule"
-      },
-      "id": "-693890971"
-    },
-    "-497922230": {
-      "source": "-1327562795",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "FileModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "-497922230"
-    },
-    "-1517205111": {
-      "source": "-1327562795",
-      "target": "1482218087",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "FileModule",
-        "targetModuleName": "ThrottlerModule"
-      },
-      "id": "-1517205111"
-    },
-    "-481638553": {
-      "source": "-1918983541",
-      "target": "555176277",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "OpenaiModule",
-        "targetModuleName": "InternalCoreModule"
-      },
-      "id": "-481638553"
-    },
-    "-1676930569": {
-      "source": "-1918983541",
-      "target": "1712628187",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "OpenaiModule",
-        "targetModuleName": "ConfigModule"
-      },
-      "id": "-1676930569"
-    },
-    "-474351304": {
-      "source": "-1918983541",
-      "target": "211572259",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "OpenaiModule",
-        "targetModuleName": "ConfigHostModule"
-      },
-      "id": "-474351304"
-    },
-    "-848542805": {
-      "source": "-1918983541",
-      "target": "-1026304274",
-      "metadata": {
-        "type": "module-to-module",
-        "sourceModuleName": "OpenaiModule",
-        "targetModuleName": "TypeOrmCoreModule"
-      },
-      "id": "-848542805"
-    },
-    "-25889379": {
-      "source": "1609867136",
-      "target": "-1624918028",
-      "metadata": {
-        "type": "class-to-class",
-        "sourceModuleName": "FileModule",
-        "sourceClassName": "FileController",
-        "targetClassName": "579419cfe20f56e38d244",
-        "sourceClassToken": "FileController",
-        "targetClassToken": "579419cfe20f56e38d244",
-        "targetModuleName": "FileModule",
-        "injectionType": "decorator"
-      },
-      "id": "-25889379"
-    },
-    "-1759625292": {
-      "source": "-553129559",
-      "target": "-326832201",
-      "metadata": {
-        "type": "class-to-class",
-        "sourceModuleName": "InternalCoreModule",
-        "sourceClassName": "HttpAdapterHost",
-        "targetClassName": "HttpAdapterHost",
-        "sourceClassToken": "HttpAdapterHost",
-        "targetClassToken": "HttpAdapterHost",
-        "targetModuleName": "InternalCoreModule",
-        "keyOrIndex": 0,
-        "injectionType": "constructor",
-        "internal": true
-      },
-      "id": "-1759625292"
-    }
-  },
-  "entrypoints": {},
-  "extras": {
-    "orphanedEnhancers": [],
-    "attachedEnhancers": []
-  },
-  "status": "partial",
-  "metadata": {
-    "cause": {
-      "type": "unknown",
-      "error": {}
-    }
-  }
-}

+ 1 - 0
package.json

@@ -46,6 +46,7 @@
     "express-basic-auth": "^1.2.1",
     "express-handlebars": "^7.0.6",
     "handlebars": "^4.7.7",
+    "isomorphic-fetch": "^3.0.0",
     "keyv": "^4.5.2",
     "mysql2": "^3.1.2",
     "nodemailer": "^6.9.1",

+ 2 - 2
src/app.module.ts

@@ -11,7 +11,7 @@ import { SmsModule } from './sms/sms.module'
 import { DevtoolsModule } from '@nestjs/devtools-integration'
 import { AuthModule } from './auth/auth.module';
 import { FileModule } from './file/file.module';
-import { OpenaiModule } from './openai/openai.module';
+import { ChatModule } from './chat/chat.module';
 
 @Module({
     imports: [
@@ -63,7 +63,7 @@ import { OpenaiModule } from './openai/openai.module';
         UsersModule,
         AuthModule,
         FileModule,
-        OpenaiModule
+        ChatModule
     ],
     controllers: [AppController],
     providers: [AppService]

+ 1 - 1
src/auth/auth.controller.ts

@@ -12,6 +12,6 @@ export class AuthController {
     @Public()
     @Post('/phoneLogin')
     async phoneLogin(@Body() loginDto: PhoneLoginDto) {
-        return this.authService.loginByPhone(loginDto)
+        return await this.authService.loginByPhone(loginDto)
     }
 }

+ 34 - 0
src/chat/chat.controller.ts

@@ -0,0 +1,34 @@
+import { Controller, Get, Post, Req, Res, Sse, HttpCode } from '@nestjs/common'
+import { ApiTags } from '@nestjs/swagger'
+import { ChatService } from './chat.service'
+import { Observable } from 'rxjs'
+import { Public } from 'src/auth/public.decorator'
+
+@ApiTags('chat')
+@Controller('chat')
+export class ChatController {
+    constructor(private readonly openaiService: ChatService) {}
+
+    @Post('chat-process')
+    @Sse()
+    public chat(@Req() req, @Res() res): Observable<any> {
+        return this.openaiService.chat(req, res)
+    }
+
+    @Post('chat-process1')
+    @Sse()
+    public async chat1(@Req() req, @Res() res) {
+        await this.openaiService.chat1(req, res)
+    }
+
+    @Public()
+    @Post('session')
+    public async session(): Promise<any> {
+        return { status: 'Success', message: '', data: { auth: true, model: 'gpt-3.5-turbo' } }
+    }
+
+    @Post('verify')
+    public verify() {
+        return { status: 'Success', message: 'Verify successfully', data: null }
+    }
+}

+ 9 - 0
src/chat/chat.module.ts

@@ -0,0 +1,9 @@
+import { Module } from '@nestjs/common';
+import { ChatService } from './chat.service';
+import { ChatController } from './chat.controller';
+
+@Module({
+  providers: [ChatService],
+  controllers: [ChatController]
+})
+export class ChatModule {}

+ 65 - 0
src/chat/chat.service.ts

@@ -0,0 +1,65 @@
+import { Injectable } from '@nestjs/common'
+import { Observable } from 'rxjs'
+import { ChatGPTAPI, ChatMessage } from '../chatapi'
+import type { RequestProps } from './types'
+import { chatReplyProcess } from './chatgpt'
+
+@Injectable()
+export class ChatService {
+    constructor() {}
+
+    public chat(req, res): Observable<any> {
+        res.setHeader('Content-Type', 'application/octet-stream')
+        return new Observable((observer) => {
+            const { prompt, options = {}, systemMessage, temperature, top_p } = req.body as RequestProps
+            let firstChunk = true
+            chatReplyProcess({
+                message: prompt,
+                lastContext: options,
+                process: (chat: ChatMessage) => {
+                    // observer.next(
+                    //     new MessageEvent('message', {
+                    //         data: firstChunk ? JSON.stringify(chat) : `\n${JSON.stringify(chat)}`
+                    //     })
+                    // )
+                    observer.next(firstChunk ? JSON.stringify(chat) : `\n${JSON.stringify(chat)}`)
+                    firstChunk = false
+                },
+                systemMessage,
+                temperature,
+                top_p
+            })
+                .then(() => {})
+                .catch((error) => {
+                    observer.error(error)
+                })
+                .finally(() => {
+                    observer.complete()
+                })
+        })
+    }
+
+    public async chat1(req, res) {
+        res.setHeader('Content-type', 'application/octet-stream')
+
+        try {
+            const { prompt, options = {}, systemMessage, temperature, top_p } = req.body as RequestProps
+            let firstChunk = true
+            await chatReplyProcess({
+                message: prompt,
+                lastContext: options,
+                process: (chat: ChatMessage) => {
+                    res.write(firstChunk ? JSON.stringify(chat) : `\n${JSON.stringify(chat)}`)
+                    firstChunk = false
+                },
+                systemMessage,
+                temperature,
+                top_p
+            })
+        } catch (error) {
+            res.write(JSON.stringify(error))
+        } finally {
+            res.end()
+        }
+    }
+}

+ 185 - 0
src/chat/chatgpt/index.ts

@@ -0,0 +1,185 @@
+import * as dotenv from 'dotenv'
+import 'isomorphic-fetch'
+import type { ChatGPTAPIOptions, ChatMessage, SendMessageOptions } from '../../chatapi'
+import { ChatGPTAPI, ChatGPTUnofficialProxyAPI } from '../../chatapi'
+import fetch from 'node-fetch'
+import { sendResponse } from '../utils'
+import { isNotEmptyString } from '../utils/is'
+import type { ApiModel, ChatContext, ChatGPTUnofficialProxyAPIOptions, ModelConfig } from '../types'
+import type { RequestOptions, SetProxyOptions, UsageResponse } from './types'
+
+dotenv.config()
+
+const ErrorCodeMessage: Record<string, string> = {
+    401: '[OpenAI] 提供错误的API密钥 | Incorrect API key provided',
+    403: '[OpenAI] 服务器拒绝访问,请稍后再试 | Server refused to access, please try again later',
+    502: '[OpenAI] 错误的网关 |  Bad Gateway',
+    503: '[OpenAI] 服务器繁忙,请稍后再试 | Server is busy, please try again later',
+    504: '[OpenAI] 网关超时 | Gateway Time-out',
+    500: '[OpenAI] 服务器繁忙,请稍后再试 | Internal Server Error'
+}
+
+const timeoutMs: number = !isNaN(+process.env.TIMEOUT_MS) ? +process.env.TIMEOUT_MS : 100 * 1000
+const disableDebug: boolean = process.env.OPENAI_API_DISABLE_DEBUG === 'true'
+
+let apiModel: ApiModel
+const model = isNotEmptyString(process.env.OPENAI_API_MODEL) ? process.env.OPENAI_API_MODEL : 'gpt-3.5-turbo'
+
+if (!isNotEmptyString(process.env.OPENAI_API_KEY) && !isNotEmptyString(process.env.OPENAI_ACCESS_TOKEN))
+    throw new Error('Missing OPENAI_API_KEY or OPENAI_ACCESS_TOKEN environment variable')
+
+let api: ChatGPTAPI | ChatGPTUnofficialProxyAPI
+;(async () => {
+    // More Info: https://github.com/transitive-bullshit/chatgpt-api
+
+    if (isNotEmptyString(process.env.OPENAI_API_KEY)) {
+        const OPENAI_API_BASE_URL = process.env.OPENAI_API_BASE_URL
+
+        const options: ChatGPTAPIOptions = {
+            apiKey: process.env.AZURE_OPENAI_KEY,
+            apiEndpoint: process.env.AZURE_OPENAI_ENDPOINT,
+            apiDeployment: process.env.AZURE_OPENAI_DEPLOYMENT,
+            apiVersion: process.env.AZURE_OPENAI_VERSION,
+            completionParams: { model },
+            debug: !disableDebug
+        }
+
+        // increase max token limit if use gpt-4
+        if (model.toLowerCase().includes('gpt-4')) {
+            // if use 32k model
+            if (model.toLowerCase().includes('32k')) {
+                options.maxModelTokens = 32768
+                options.maxResponseTokens = 8192
+            } else {
+                options.maxModelTokens = 8192
+                options.maxResponseTokens = 2048
+            }
+        }
+
+        setupProxy(options)
+
+        api = new ChatGPTAPI({ ...options })
+        apiModel = 'ChatGPTAPI'
+    } else {
+        const options: ChatGPTUnofficialProxyAPIOptions = {
+            accessToken: process.env.OPENAI_ACCESS_TOKEN,
+            apiReverseProxyUrl: isNotEmptyString(process.env.API_REVERSE_PROXY)
+                ? process.env.API_REVERSE_PROXY
+                : 'https://bypass.churchless.tech/api/conversation',
+            model,
+            debug: !disableDebug
+        }
+
+        setupProxy(options)
+
+        api = new ChatGPTUnofficialProxyAPI({ ...options })
+        apiModel = 'ChatGPTUnofficialProxyAPI'
+    }
+})()
+
+async function chatReplyProcess(options: RequestOptions) {
+    const { message, lastContext, process, systemMessage, temperature, top_p } = options
+    try {
+        let options: SendMessageOptions = { timeoutMs }
+
+        if (apiModel === 'ChatGPTAPI') {
+            if (isNotEmptyString(systemMessage)) options.systemMessage = systemMessage
+            options.completionParams = { model, temperature, top_p }
+        }
+
+        if (lastContext != null) {
+            if (apiModel === 'ChatGPTAPI') options.parentMessageId = lastContext.parentMessageId
+            else options = { ...lastContext }
+        }
+
+        const response = await api.sendMessage(message, {
+            ...options,
+            onProgress: (partialResponse) => {
+                process?.(partialResponse)
+            }
+        })
+
+        return sendResponse({ type: 'Success', data: response })
+    } catch (error: any) {
+        const code = error.statusCode
+        global.console.log(error)
+        if (Reflect.has(ErrorCodeMessage, code)) return sendResponse({ type: 'Fail', message: ErrorCodeMessage[code] })
+        return sendResponse({ type: 'Fail', message: error.message ?? 'Please check the back-end console' })
+    }
+}
+
+async function fetchUsage() {
+    const OPENAI_API_KEY = process.env.OPENAI_API_KEY
+    const OPENAI_API_BASE_URL = process.env.OPENAI_API_BASE_URL
+
+    if (!isNotEmptyString(OPENAI_API_KEY)) return Promise.resolve('-')
+
+    const API_BASE_URL = isNotEmptyString(OPENAI_API_BASE_URL) ? OPENAI_API_BASE_URL : 'https://api.openai.com'
+
+    const [startDate, endDate] = formatDate()
+
+    // 每月使用量
+    const urlUsage = `${API_BASE_URL}/v1/dashboard/billing/usage?start_date=${startDate}&end_date=${endDate}`
+
+    const headers = {
+        Authorization: `Bearer ${OPENAI_API_KEY}`,
+        'Content-Type': 'application/json'
+    }
+
+    const options = {} as SetProxyOptions
+
+    setupProxy(options)
+
+    try {
+        // 获取已使用量
+        const useResponse = await options.fetch(urlUsage, { headers })
+        if (!useResponse.ok) throw new Error('获取使用量失败')
+        const usageData = (await useResponse.json()) as UsageResponse
+        const usage = Math.round(usageData.total_usage) / 100
+        return Promise.resolve(usage ? `$${usage}` : '-')
+    } catch (error) {
+        global.console.log(error)
+        return Promise.resolve('-')
+    }
+}
+
+function formatDate(): string[] {
+    const today = new Date()
+    const year = today.getFullYear()
+    const month = today.getMonth() + 1
+    const lastDay = new Date(year, month, 0)
+    const formattedFirstDay = `${year}-${month.toString().padStart(2, '0')}-01`
+    const formattedLastDay = `${year}-${month.toString().padStart(2, '0')}-${lastDay
+        .getDate()
+        .toString()
+        .padStart(2, '0')}`
+    return [formattedFirstDay, formattedLastDay]
+}
+
+async function chatConfig() {
+    const usage = await fetchUsage()
+    const reverseProxy = process.env.API_REVERSE_PROXY ?? '-'
+    const httpsProxy = (process.env.HTTPS_PROXY || process.env.ALL_PROXY) ?? '-'
+    const socksProxy =
+        process.env.SOCKS_PROXY_HOST && process.env.SOCKS_PROXY_PORT
+            ? `${process.env.SOCKS_PROXY_HOST}:${process.env.SOCKS_PROXY_PORT}`
+            : '-'
+    return sendResponse<ModelConfig>({
+        type: 'Success',
+        data: { apiModel, reverseProxy, timeoutMs, socksProxy, httpsProxy, usage }
+    })
+}
+
+function setupProxy(options: SetProxyOptions) {
+    options.fetch = (url, options) => {
+        return fetch(url, { ...options })
+    }
+}
+
+function currentModel(): ApiModel {
+    return apiModel
+}
+
+export type { ChatContext, ChatMessage }
+
+export { chatReplyProcess, chatConfig, currentModel }

+ 19 - 0
src/chat/chatgpt/types.ts

@@ -0,0 +1,19 @@
+import type { ChatMessage } from '../../chatapi'
+import type fetch from 'node-fetch'
+
+export interface RequestOptions {
+    message: string
+    lastContext?: { conversationId?: string; parentMessageId?: string }
+    process?: (chat: ChatMessage) => void
+    systemMessage?: string
+    temperature?: number
+    top_p?: number
+}
+
+export interface SetProxyOptions {
+    fetch?: typeof fetch
+}
+
+export interface UsageResponse {
+    total_usage: number
+}

+ 34 - 0
src/chat/types.ts

@@ -0,0 +1,34 @@
+import type { FetchFn } from '../chatapi'
+
+export interface RequestProps {
+  prompt: string
+  options?: ChatContext
+  systemMessage: string
+  temperature?: number
+  top_p?: number
+}
+
+export interface ChatContext {
+  conversationId?: string
+  parentMessageId?: string
+}
+
+export interface ChatGPTUnofficialProxyAPIOptions {
+  accessToken: string
+  apiReverseProxyUrl?: string
+  model?: string
+  debug?: boolean
+  headers?: Record<string, string>
+  fetch?: FetchFn
+}
+
+export interface ModelConfig {
+  apiModel?: ApiModel
+  reverseProxy?: string
+  timeoutMs?: number
+  socksProxy?: string
+  httpsProxy?: string
+  usage?: string
+}
+
+export type ApiModel = 'ChatGPTAPI' | 'ChatGPTUnofficialProxyAPI' | undefined

+ 22 - 0
src/chat/utils/index.ts

@@ -0,0 +1,22 @@
+interface SendResponseOptions<T = any> {
+  type: 'Success' | 'Fail'
+  message?: string
+  data?: T
+}
+
+export function sendResponse<T>(options: SendResponseOptions<T>) {
+  if (options.type === 'Success') {
+    return Promise.resolve({
+      message: options.message ?? null,
+      data: options.data ?? null,
+      status: options.type,
+    })
+  }
+
+  // eslint-disable-next-line prefer-promise-reject-errors
+  return Promise.reject({
+    message: options.message ?? 'Failed',
+    data: options.data ?? null,
+    status: options.type,
+  })
+}

+ 19 - 0
src/chat/utils/is.ts

@@ -0,0 +1,19 @@
+export function isNumber<T extends number>(value: T | unknown): value is number {
+  return Object.prototype.toString.call(value) === '[object Number]'
+}
+
+export function isString<T extends string>(value: T | unknown): value is string {
+  return Object.prototype.toString.call(value) === '[object String]'
+}
+
+export function isNotEmptyString(value: any): boolean {
+  return typeof value === 'string' && value.length > 0
+}
+
+export function isBoolean<T extends boolean>(value: T | unknown): value is boolean {
+  return Object.prototype.toString.call(value) === '[object Boolean]'
+}
+
+export function isFunction<T extends (...args: any[]) => any | void | never>(value: T | unknown): value is T {
+  return Object.prototype.toString.call(value) === '[object Function]'
+}

+ 11 - 5
src/chatapi/chatgpt-api.ts

@@ -14,7 +14,9 @@ const ASSISTANT_LABEL_DEFAULT = 'ChatGPT'
 
 export class ChatGPTAPI {
     protected _apiKey: string
-    protected _apiBaseUrl: string
+    protected _apiEndpoint: string
+    protected _apiDeployment: string
+    protected _apiVersion: string
     protected _apiOrg?: string
     protected _debug: boolean
 
@@ -47,8 +49,10 @@ export class ChatGPTAPI {
     constructor(opts: types.ChatGPTAPIOptions) {
         const {
             apiKey,
+            apiEndpoint,
+            apiDeployment,
+            apiVersion,
             apiOrg,
-            apiBaseUrl = 'https://api.openai.com/v1',
             debug = false,
             messageStore,
             completionParams,
@@ -61,8 +65,10 @@ export class ChatGPTAPI {
         } = opts
 
         this._apiKey = apiKey
+        this._apiEndpoint = apiEndpoint
+        this._apiDeployment = apiDeployment
+        this._apiVersion = apiVersion
         this._apiOrg = apiOrg
-        this._apiBaseUrl = apiBaseUrl
         this._debug = !!debug
         this._fetch = fetch
 
@@ -170,10 +176,10 @@ export class ChatGPTAPI {
         }
 
         const responseP = new Promise<types.ChatMessage>(async (resolve, reject) => {
-            const url = `${this._apiBaseUrl}/chat/completions`
+            const url = `${this._apiEndpoint}/openai/deployments/${this._apiDeployment}/chat/completions?api-version=${this._apiVersion}`
             const headers = {
                 'Content-Type': 'application/json',
-                Authorization: `Bearer ${this._apiKey}`
+                'api-key': `${this._apiKey}`
             }
             const body = {
                 max_tokens: maxTokens,

+ 5 - 2
src/chatapi/types.ts

@@ -7,8 +7,11 @@ export type FetchFn = typeof fetch
 export type ChatGPTAPIOptions = {
     apiKey: string
 
-    /** @defaultValue `'https://api.openai.com'` **/
-    apiBaseUrl?: string
+    apiEndpoint: string
+
+    apiDeployment: string
+
+    apiVersion: string
 
     apiOrg?: string
 

+ 0 - 15
src/openai/openai.controller.ts

@@ -1,15 +0,0 @@
-import { Controller, Post, Req, Res } from '@nestjs/common'
-import { ApiTags } from '@nestjs/swagger'
-import { OpenaiService } from './openai.service'
-
-@ApiTags('openai')
-@Controller('openai')
-export class OpenaiController {
-    constructor(private readonly openaiService: OpenaiService) {}
-
-    @Post('chat')
-    public async chat(@Req() req, @Res() res) {
-        this.openaiService.chat(req, res)
-        return 'chat'
-    }
-}

+ 0 - 9
src/openai/openai.module.ts

@@ -1,9 +0,0 @@
-import { Module } from '@nestjs/common';
-import { OpenaiService } from './openai.service';
-import { OpenaiController } from './openai.controller';
-
-@Module({
-  providers: [OpenaiService],
-  controllers: [OpenaiController]
-})
-export class OpenaiModule {}

+ 0 - 25
src/openai/openai.service.ts

@@ -1,25 +0,0 @@
-import { Injectable } from '@nestjs/common'
-import { ChatGPTAPI } from 'src/chatapi'
-
-@Injectable()
-export class OpenaiService {
-    constructor() {}
-
-    public async chat(req, res) {
-        res.setHeader('Content-type', 'application/octet-stream')
-        const api = new ChatGPTAPI({ apiKey: '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' })
-
-        const prompt = 'Write a python version of bubble sort. Do not include example usage.'
-
-        console.log(prompt)
-        let firstChunk = true
-        const result = await api.sendMessage(prompt, {
-            onProgress: (partialResponse) => {
-                res.write(firstChunk ? JSON.stringify(partialResponse) : `\n${JSON.stringify(partialResponse)}`)
-                firstChunk = false
-            }
-        })
-        console.log(result.text)
-        res.end()
-    }
-}

+ 13 - 0
yarn.lock

@@ -3534,6 +3534,14 @@ isexe@^2.0.0:
   resolved "https://registry.npmmirror.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
   integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==
 
+isomorphic-fetch@^3.0.0:
+  version "3.0.0"
+  resolved "https://registry.npmmirror.com/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz#0267b005049046d2421207215d45d6a262b8b8b4"
+  integrity sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==
+  dependencies:
+    node-fetch "^2.6.1"
+    whatwg-fetch "^3.4.1"
+
 isstream@~0.1.2:
   version "0.1.2"
   resolved "https://registry.npmmirror.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
@@ -6063,6 +6071,11 @@ webpack@5.76.2:
     watchpack "^2.4.0"
     webpack-sources "^3.2.3"
 
+whatwg-fetch@^3.4.1:
+  version "3.6.2"
+  resolved "https://registry.npmmirror.com/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz#dced24f37f2624ed0281725d51d0e2e3fe677f8c"
+  integrity sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==
+
 whatwg-url@^5.0.0:
   version "5.0.0"
   resolved "https://registry.npmmirror.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"