FOSWLY / summarize

A small extension that allows you to quickly retell articles
37 stars 0 forks source link

Не собирается расширение (ну или я тупой) #3

Closed bropines closed 9 months ago

bropines commented 9 months ago
 npm run build
> summarize-articles@0.1.0 build
> vue-cli-service build

-  Building for production... ERROR  Error: [copy-webpack-plugin] patterns must be an array
Error: [copy-webpack-plugin] patterns must be an array
    at new CopyWebpackPlugin (D:\AI\GIT\summarize\node_modules\copy-webpack-plugin\dist\index.js:22:15)
    at D:\AI\GIT\summarize\node_modules\webpack-chain\src\Plugin.js:13:18
    at module.exports.toConfig (D:\AI\GIT\summarize\node_modules\webpack-chain\src\Plugin.js:59:22)
    at D:\AI\GIT\summarize\node_modules\webpack-chain\src\Config.js:129:61
    at Array.map (<anonymous>)
    at module.exports.toConfig (D:\AI\GIT\summarize\node_modules\webpack-chain\src\Config.js:129:40)
    at Service.resolveWebpackConfig (D:\AI\GIT\summarize\node_modules\@vue\cli-service\lib\Service.js:251:34)
    at PluginAPI.resolveWebpackConfig (D:\AI\GIT\summarize\node_modules\@vue\cli-service\lib\PluginAPI.js:138:25)
    at module.exports (D:\AI\GIT\summarize\node_modules\@vue\cli-service\lib\commands\build\resolveAppConfig.js:39:25)
    at build (D:\AI\GIT\summarize\node_modules\@vue\cli-service\lib\commands\build\index.js:146:50)
    at D:\AI\GIT\summarize\node_modules\@vue\cli-service\lib\commands\build\index.js:88:13
    at Service.run (D:\AI\GIT\summarize\node_modules\@vue\cli-service\lib\Service.js:236:12)
    at Object.<anonymous> (D:\AI\GIT\summarize\node_modules\@vue\cli-service\bin\vue-cli-service.js:37:9)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
node -v
v18.17.1
ilyhalight commented 9 months ago

Странно, у меня все нормально работает. Попробуй закомментировать 32-47 строку в vue.config.js. После этого должно работать, единственное, в таком случае, после сборки нужно будет вручную закинуть файл manifest.production.json в папку dist и переименовать в manifest.json

image

bropines commented 9 months ago

Не помогло. Плюс он еще при установке пакетов жалуется (2 кодовый блок)

$ npm run build

> summarize-articles@0.1.0 build
> vue-cli-service build

\  Building for production... ERROR  Error: 

Vue packages version mismatch:

- vue@3.3.4 (D:\AI\GIT\summarize\node_modules\vue\index.js)
- vue-template-compiler@2.7.14 (D:\AI\GIT\summarize\node_modules\vue-template-compiler\package.json)

This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using vue-loader@>=10.0, simply update vue-template-compiler.
If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.

Error:

Vue packages version mismatch:

- vue@3.3.4 (D:\AI\GIT\summarize\node_modules\vue\index.js)
- vue-template-compiler@2.7.14 (D:\AI\GIT\summarize\node_modules\vue-template-compiler\package.json)

This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using vue-loader@>=10.0, simply update vue-template-compiler.
If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.

    at Object.<anonymous> (D:\AI\GIT\summarize\node_modules\vue-template-compiler\index.js:10:9)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at loadFromContext (D:\AI\GIT\summarize\node_modules\@vue\cli-service\node_modules\vue-loader\lib\compiler.js:30:10)
    at loadTemplateCompiler (D:\AI\GIT\summarize\node_modules\@vue\cli-service\node_modules\vue-loader\lib\compiler.js:37:12)
    at exports.resolveCompiler (D:\AI\GIT\summarize\node_modules\@vue\cli-service\node_modules\vue-loader\lib\compiler.js:25:23)
    at VueLoaderPlugin.apply (D:\AI\GIT\summarize\node_modules\@vue\cli-service\node_modules\vue-loader\lib\plugin-webpack4.js:91:22)
    at VueLoaderPlugin.apply (D:\AI\GIT\summarize\node_modules\@vue\cli-service\node_modules\vue-loader\lib\plugin.js:13:16)
    at webpack (D:\AI\GIT\summarize\node_modules\@vue\cli-service\node_modules\webpack\lib\webpack.js:47:13)
    at D:\AI\GIT\summarize\node_modules\@vue\cli-service\lib\commands\build\index.js:192:5
    at new Promise (<anonymous>)
    at build (D:\AI\GIT\summarize\node_modules\@vue\cli-service\lib\commands\build\index.js:191:10)
$ npm i

npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142  
npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated consolidate@0.15.1: Please upgrade to consolidate v1.0.0+ as it has been modernized with several long-awaited fixes implemented. Maintenance is supported by Forward Email at https://forwardemail.net ; follow/watch https://github.com/ladjs/consolidate for updates and release changelog
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated acorn-dynamic-import@3.0.0: This is probably built in to whatever tool you're using. If you still need it... idk
npm WARN deprecated html-webpack-plugin@3.2.0: 3.x is no longer supported
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.

added 1652 packages, and audited 1653 packages in 32s

74 packages are looking for funding
  run `npm fund` for details

71 vulnerabilities (1 low, 48 moderate, 17 high, 5 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
bropines commented 9 months ago

Попытка заюзать npm audit fix и npm audit fix --force помогла

bropines commented 9 months ago

HcW258YkRY Еще судя по всему у меня на серваке не работает корс -_-. Как его настроить я не эпу

bropines commented 9 months ago

И еще, на бекенде такая вот приколюха

[05:19:19] INFO     38.180.13.121:56781 - - [19/Oct/2023:05:19:19 +0300] "OPTIONS /generation 1.1" 200 2 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36     logging.py:88
                    (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0"
[05:19:20] INFO     HTTP Request: POST https://300.ya.ru/api/generation "HTTP/1.1 302 Found"                                                                                 _client.py:1729
           INFO     38.180.13.121:56783 - - [19/Oct/2023:05:19:20 +0300] "POST /generation 1.1" 500 21 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36       logging.py:88
                    (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0"
           ERROR    Error in ASGI Framework                                                                                                                                   logging.py:114
                    ╭────────────────────────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────────────────────╮
                    │ /usr/local/lib/python3.10/dist-packages/hypercorn/asyncio/task_group.py:23 in _handle                                                                 │
                    │                                                                                                                                                       │
                    │   20 │   call_soon: Callable,                                                                                                                         │
                    │   21 ) -> None:                                                                                                                                       │
                    │   22 │   try:                                                                                                                                         │
                    │ ❱ 23 │   │   await app(scope, receive, send, sync_spawn, call_soon)                                                                                   │
                    │   24 │   except asyncio.CancelledError:                                                                                                               │
                    │   25 │   │   raise                                                                                                                                    │
                    │   26 │   except Exception:                                                                                                                            │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/hypercorn/app_wrappers.py:33 in __call__                                                                      │
                    │                                                                                                                                                       │
                    │    30 │   │   sync_spawn: Callable,                                                                                                                   │
                    │    31 │   │   call_soon: Callable,                                                                                                                    │
                    │    32 │   ) -> None:                                                                                                                                  │
                    │ ❱  33 │   │   await self.app(scope, receive, send)                                                                                                    │
                    │    34                                                                                                                                                 │
                    │    35                                                                                                                                                 │
                    │    36 class WSGIWrapper:                                                                                                                              │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/fastapi/applications.py:1115 in __call__                                                                      │
                    │                                                                                                                                                       │
                    │   1112 │   async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:                                                              │
                    │   1113 │   │   if self.root_path:                                                                                                                     │
                    │   1114 │   │   │   scope["root_path"] = self.root_path                                                                                                │
                    │ ❱ 1115 │   │   await super().__call__(scope, receive, send)                                                                                           │
                    │   1116 │                                                                                                                                              │
                    │   1117 │   def add_api_route(                                                                                                                         │
                    │   1118 │   │   self,                                                                                                                                  │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/applications.py:122 in __call__                                                                     │
                    │                                                                                                                                                       │
                    │   119 │   │   scope["app"] = self                                                                                                                     │
                    │   120 │   │   if self.middleware_stack is None:                                                                                                       │
                    │   121 │   │   │   self.middleware_stack = self.build_middleware_stack()                                                                               │
                    │ ❱ 122 │   │   await self.middleware_stack(scope, receive, send)                                                                                       │
                    │   123 │                                                                                                                                               │
                    │   124 │   def on_event(self, event_type: str) -> typing.Callable:  # pragma: nocover                                                                  │
                    │   125 │   │   return self.router.on_event(event_type)                                                                                                 │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py:184 in __call__                                                                │
                    │                                                                                                                                                       │
                    │   181 │   │   │   # We always continue to raise the exception.                                                                                        │
                    │   182 │   │   │   # This allows servers to log the error, or allows test clients                                                                      │
                    │   183 │   │   │   # to optionally raise the error within the test case.                                                                               │
                    │ ❱ 184 │   │   │   raise exc                                                                                                                           │
                    │   185 │                                                                                                                                               │
                    │   186 │   def format_line(                                                                                                                            │
                    │   187 │   │   self, index: int, line: str, frame_lineno: int, frame_index: int                                                                        │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py:162 in __call__                                                                │
                    │                                                                                                                                                       │
                    │   159 │   │   │   await send(message)                                                                                                                 │
                    │   160 │   │                                                                                                                                           │
                    │   161 │   │   try:                                                                                                                                    │
                    │ ❱ 162 │   │   │   await self.app(scope, receive, _send)                                                                                               │
                    │   163 │   │   except Exception as exc:                                                                                                                │
                    │   164 │   │   │   request = Request(scope)                                                                                                            │
                    │   165 │   │   │   if self.debug:                                                                                                                      │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/middleware/cors.py:91 in __call__                                                                   │
                    │                                                                                                                                                       │
                    │    88 │   │   │   await response(scope, receive, send)                                                                                                │
                    │    89 │   │   │   return                                                                                                                              │
                    │    90 │   │                                                                                                                                           │
                    │ ❱  91 │   │   await self.simple_response(scope, receive, send, request_headers=headers)                                                               │
                    │    92 │                                                                                                                                               │
                    │    93 │   def is_allowed_origin(self, origin: str) -> bool:                                                                                           │
                    │    94 │   │   if self.allow_all_origins:                                                                                                              │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/middleware/cors.py:146 in simple_response                                                           │
                    │                                                                                                                                                       │
                    │   143 │   │   self, scope: Scope, receive: Receive, send: Send, request_headers: Headers                                                              │
                    │   144 │   ) -> None:                                                                                                                                  │
                    │   145 │   │   send = functools.partial(self.send, send=send, request_headers=request_headers)                                                         │
                    │ ❱ 146 │   │   await self.app(scope, receive, send)                                                                                                    │
                    │   147 │                                                                                                                                               │
                    │   148 │   async def send(                                                                                                                             │
                    │   149 │   │   self, message: Message, send: Send, request_headers: Headers                                                                            │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py:79 in __call__                                                             │
                    │                                                                                                                                                       │
                    │    76 │   │   │   │   handler = self._lookup_exception_handler(exc)                                                                                   │
                    │    77 │   │   │                                                                                                                                       │
                    │    78 │   │   │   if handler is None:                                                                                                                 │
                    │ ❱  79 │   │   │   │   raise exc                                                                                                                       │
                    │    80 │   │   │                                                                                                                                       │
                    │    81 │   │   │   if response_started:                                                                                                                │
                    │    82 │   │   │   │   msg = "Caught handled exception, but response already started."                                                                 │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py:68 in __call__                                                             │
                    │                                                                                                                                                       │
                    │    65 │   │   │   await send(message)                                                                                                                 │
                    │    66 │   │                                                                                                                                           │
                    │    67 │   │   try:                                                                                                                                    │
                    │ ❱  68 │   │   │   await self.app(scope, receive, sender)                                                                                              │
                    │    69 │   │   except Exception as exc:                                                                                                                │
                    │    70 │   │   │   handler = None                                                                                                                      │
                    │    71                                                                                                                                                 │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/fastapi/middleware/asyncexitstack.py:20 in __call__                                                           │
                    │                                                                                                                                                       │
                    │   17 │   │   │   │   await self.app(scope, receive, send)                                                                                             │
                    │   18 │   │   │   except Exception as e:                                                                                                               │
                    │   19 │   │   │   │   dependency_exception = e                                                                                                         │
                    │ ❱ 20 │   │   │   │   raise e                                                                                                                          │
                    │   21 │   │   if dependency_exception:                                                                                                                 │
                    │   22 │   │   │   # This exception was possibly handled by the dependency but it should                                                                │
                    │   23 │   │   │   # still bubble up so that the ServerErrorMiddleware can return a 500                                                                 │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/fastapi/middleware/asyncexitstack.py:17 in __call__                                                           │
                    │                                                                                                                                                       │
                    │   14 │   │   async with AsyncExitStack() as stack:                                                                                                    │
                    │   15 │   │   │   scope[self.context_name] = stack                                                                                                     │
                    │   16 │   │   │   try:                                                                                                                                 │
                    │ ❱ 17 │   │   │   │   await self.app(scope, receive, send)                                                                                             │
                    │   18 │   │   │   except Exception as e:                                                                                                               │
                    │   19 │   │   │   │   dependency_exception = e                                                                                                         │
                    │   20 │   │   │   │   raise e                                                                                                                          │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/routing.py:718 in __call__                                                                          │
                    │                                                                                                                                                       │
                    │   715 │   │   │   match, child_scope = route.matches(scope)                                                                                           │
                    │   716 │   │   │   if match == Match.FULL:                                                                                                             │
                    │   717 │   │   │   │   scope.update(child_scope)                                                                                                       │
                    │ ❱ 718 │   │   │   │   await route.handle(scope, receive, send)                                                                                        │
                    │   719 │   │   │   │   return                                                                                                                          │
                    │   720 │   │   │   elif match == Match.PARTIAL and partial is None:                                                                                    │
                    │   721 │   │   │   │   partial = route                                                                                                                 │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/routing.py:276 in handle                                                                            │
                    │                                                                                                                                                       │
                    │   273 │   │   │   │   )                                                                                                                               │
                    │   274 │   │   │   await response(scope, receive, send)                                                                                                │
                    │   275 │   │   else:                                                                                                                                   │
                    │ ❱ 276 │   │   │   await self.app(scope, receive, send)                                                                                                │
                    │   277 │                                                                                                                                               │
                    │   278 │   def __eq__(self, other: typing.Any) -> bool:                                                                                                │
                    │   279 │   │   return (                                                                                                                                │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/routing.py:66 in app                                                                                │
                    │                                                                                                                                                       │
                    │    63 │   async def app(scope: Scope, receive: Receive, send: Send) -> None:                                                                          │
                    │    64 │   │   request = Request(scope, receive=receive, send=send)                                                                                    │
                    │    65 │   │   if is_coroutine:                                                                                                                        │
                    │ ❱  66 │   │   │   response = await func(request)                                                                                                      │
                    │    67 │   │   else:                                                                                                                                   │
                    │    68 │   │   │   response = await run_in_threadpool(func, request)                                                                                   │
                    │    69 │   │   await response(scope, receive, send)                                                                                                    │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/fastapi/routing.py:274 in app                                                                                 │
                    │                                                                                                                                                       │
                    │    271 │   │   if errors:                                                                                                                             │
                    │    272 │   │   │   raise RequestValidationError(_normalize_errors(errors), body=body)                                                                 │
                    │    273 │   │   else:                                                                                                                                  │
                    │ ❱  274 │   │   │   raw_response = await run_endpoint_function(                                                                                        │
                    │    275 │   │   │   │   dependant=dependant, values=values, is_coroutine=is_coroutine                                                                  │
                    │    276 │   │   │   )                                                                                                                                  │
                    │    277                                                                                                                                                │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/fastapi/routing.py:191 in run_endpoint_function                                                               │
                    │                                                                                                                                                       │
                    │    188 │   assert dependant.call is not None, "dependant.call must be a function"                                                                     │
                    │    189 │                                                                                                                                              │
                    │    190 │   if is_coroutine:                                                                                                                           │
                    │ ❱  191 │   │   return await dependant.call(**values)                                                                                                  │
                    │    192 │   else:                                                                                                                                      │
                    │    193 │   │   return await run_in_threadpool(dependant.call, **values)                                                                               │
                    │    194                                                                                                                                                │
                    │                                                                                                                                                       │
                    │ /root/summarize-backend/routes/endpoints/summarize.py:36 in generation                                                                                │
                    │                                                                                                                                                       │
                    │   33 │   │   │   status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,                                                                                    │
                    │   34 │   │   │   detail='You can select only 1 parameter: article_url or video_url',                                                                  │
                    │   35 │   │   )                                                                                                                                        │
                    │ ❱ 36 │   test = await YandexSummarize().generation(generation_params)                                                                                 │
                    │   37 │   logger.info(test)                                                                                                                            │
                    │   38 │   return test                                                                                                                                  │
                    │   39                                                                                                                                                  │
                    │                                                                                                                                                       │
                    │ /root/summarize-backend/api/summarize.py:44 in generation                                                                                             │
                    │                                                                                                                                                       │
                    │   41 │   async def generation(self, data: dict):                                                                                                      │
                    │   42 │   │   headers = self.headers.copy()                                                                                                            │
                    │   43 │   │   headers['Cookie'] = YANDEX_COOKIE                                                                                                        │
                    │ ❱ 44 │   │   return await self.request('generation', data, headers)                                                                                   │
                    │   45                                                                                                                                                  │
                    │                                                                                                                                                       │
                    │ /root/summarize-backend/api/summarize.py:29 in request                                                                                                │
                    │                                                                                                                                                       │
                    │   26 │   │   │   │   headers = headers                                                                                                                │
                    │   27 │   │   │   )                                                                                                                                    │
                    │   28 │   │   │   self.logger.debug(f'POST /api/{endpoint}: {r.status_code}')                                                                          │
                    │ ❱ 29 │   │   │   return r.json()                                                                                                                      │
                    │   30 │                                                                                                                                                │
                    │   31 │   async def get_sharing_url(self, data: dict):                                                                                                 │
                    │   32 │   │   headers = self.headers.copy()                                                                                                            │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/httpx/_models.py:756 in json                                                                                  │
                    │                                                                                                                                                       │
                    │    753 │   │   │   encoding = guess_json_utf(self.content)                                                                                            │
                    │    754 │   │   │   if encoding is not None:                                                                                                           │
                    │    755 │   │   │   │   return jsonlib.loads(self.content.decode(encoding), **kwargs)                                                                  │
                    │ ❱  756 │   │   return jsonlib.loads(self.text, **kwargs)                                                                                              │
                    │    757 │                                                                                                                                              │
                    │    758 │   @property                                                                                                                                  │
                    │    759 │   def cookies(self) -> "Cookies":                                                                                                            │
                    │                                                                                                                                                       │
                    │ /usr/lib/python3.10/json/__init__.py:346 in loads                                                                                                     │
                    │                                                                                                                                                       │
                    │   343 │   if (cls is None and object_hook is None and                                                                                                 │
                    │   344 │   │   │   parse_int is None and parse_float is None and                                                                                       │
                    │   345 │   │   │   parse_constant is None and object_pairs_hook is None and not kw):                                                                   │
                    │ ❱ 346 │   │   return _default_decoder.decode(s)                                                                                                       │
                    │   347 │   if cls is None:                                                                                                                             │
                    │   348 │   │   cls = JSONDecoder                                                                                                                       │
                    │   349 │   if object_hook is not None:                                                                                                                 │
                    │                                                                                                                                                       │
                    │ /usr/lib/python3.10/json/decoder.py:337 in decode                                                                                                     │
                    │                                                                                                                                                       │
                    │   334 │   │   containing a JSON document).                                                                                                            │
                    │   335 │   │                                                                                                                                           │
                    │   336 │   │   """                                                                                                                                     │
                    │ ❱ 337 │   │   obj, end = self.raw_decode(s, idx=_w(s, 0).end())                                                                                       │
                    │   338 │   │   end = _w(s, end).end()                                                                                                                  │
                    │   339 │   │   if end != len(s):                                                                                                                       │
                    │   340 │   │   │   raise JSONDecodeError("Extra data", s, end)                                                                                         │
                    │                                                                                                                                                       │
                    │ /usr/lib/python3.10/json/decoder.py:355 in raw_decode                                                                                                 │
                    │                                                                                                                                                       │
                    │   352 │   │   try:                                                                                                                                    │
                    │   353 │   │   │   obj, end = self.scan_once(s, idx)                                                                                                   │
                    │   354 │   │   except StopIteration as err:                                                                                                            │
                    │ ❱ 355 │   │   │   raise JSONDecodeError("Expecting value", s, err.value) from None                                                                    │
                    │   356 │   │   return obj, end                                                                                                                         │
                    │   357                                                                                                                                                 │
                    ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
                    JSONDecodeError: Expecting value: line 1 column 1 (char 0)
ilyhalight commented 9 months ago

И еще, на бекенде такая вот приколюха

[05:19:19] INFO     38.180.13.121:56781 - - [19/Oct/2023:05:19:19 +0300] "OPTIONS /generation 1.1" 200 2 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36     logging.py:88
                    (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0"
[05:19:20] INFO     HTTP Request: POST https://300.ya.ru/api/generation "HTTP/1.1 302 Found"                                                                                 _client.py:1729
           INFO     38.180.13.121:56783 - - [19/Oct/2023:05:19:20 +0300] "POST /generation 1.1" 500 21 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36       logging.py:88
                    (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0"
           ERROR    Error in ASGI Framework                                                                                                                                   logging.py:114
                    ╭────────────────────────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────────────────────╮
                    │ /usr/local/lib/python3.10/dist-packages/hypercorn/asyncio/task_group.py:23 in _handle                                                                 │
                    │                                                                                                                                                       │
                    │   20 │   call_soon: Callable,                                                                                                                         │
                    │   21 ) -> None:                                                                                                                                       │
                    │   22 │   try:                                                                                                                                         │
                    │ ❱ 23 │   │   await app(scope, receive, send, sync_spawn, call_soon)                                                                                   │
                    │   24 │   except asyncio.CancelledError:                                                                                                               │
                    │   25 │   │   raise                                                                                                                                    │
                    │   26 │   except Exception:                                                                                                                            │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/hypercorn/app_wrappers.py:33 in __call__                                                                      │
                    │                                                                                                                                                       │
                    │    30 │   │   sync_spawn: Callable,                                                                                                                   │
                    │    31 │   │   call_soon: Callable,                                                                                                                    │
                    │    32 │   ) -> None:                                                                                                                                  │
                    │ ❱  33 │   │   await self.app(scope, receive, send)                                                                                                    │
                    │    34                                                                                                                                                 │
                    │    35                                                                                                                                                 │
                    │    36 class WSGIWrapper:                                                                                                                              │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/fastapi/applications.py:1115 in __call__                                                                      │
                    │                                                                                                                                                       │
                    │   1112 │   async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:                                                              │
                    │   1113 │   │   if self.root_path:                                                                                                                     │
                    │   1114 │   │   │   scope["root_path"] = self.root_path                                                                                                │
                    │ ❱ 1115 │   │   await super().__call__(scope, receive, send)                                                                                           │
                    │   1116 │                                                                                                                                              │
                    │   1117 │   def add_api_route(                                                                                                                         │
                    │   1118 │   │   self,                                                                                                                                  │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/applications.py:122 in __call__                                                                     │
                    │                                                                                                                                                       │
                    │   119 │   │   scope["app"] = self                                                                                                                     │
                    │   120 │   │   if self.middleware_stack is None:                                                                                                       │
                    │   121 │   │   │   self.middleware_stack = self.build_middleware_stack()                                                                               │
                    │ ❱ 122 │   │   await self.middleware_stack(scope, receive, send)                                                                                       │
                    │   123 │                                                                                                                                               │
                    │   124 │   def on_event(self, event_type: str) -> typing.Callable:  # pragma: nocover                                                                  │
                    │   125 │   │   return self.router.on_event(event_type)                                                                                                 │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py:184 in __call__                                                                │
                    │                                                                                                                                                       │
                    │   181 │   │   │   # We always continue to raise the exception.                                                                                        │
                    │   182 │   │   │   # This allows servers to log the error, or allows test clients                                                                      │
                    │   183 │   │   │   # to optionally raise the error within the test case.                                                                               │
                    │ ❱ 184 │   │   │   raise exc                                                                                                                           │
                    │   185 │                                                                                                                                               │
                    │   186 │   def format_line(                                                                                                                            │
                    │   187 │   │   self, index: int, line: str, frame_lineno: int, frame_index: int                                                                        │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py:162 in __call__                                                                │
                    │                                                                                                                                                       │
                    │   159 │   │   │   await send(message)                                                                                                                 │
                    │   160 │   │                                                                                                                                           │
                    │   161 │   │   try:                                                                                                                                    │
                    │ ❱ 162 │   │   │   await self.app(scope, receive, _send)                                                                                               │
                    │   163 │   │   except Exception as exc:                                                                                                                │
                    │   164 │   │   │   request = Request(scope)                                                                                                            │
                    │   165 │   │   │   if self.debug:                                                                                                                      │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/middleware/cors.py:91 in __call__                                                                   │
                    │                                                                                                                                                       │
                    │    88 │   │   │   await response(scope, receive, send)                                                                                                │
                    │    89 │   │   │   return                                                                                                                              │
                    │    90 │   │                                                                                                                                           │
                    │ ❱  91 │   │   await self.simple_response(scope, receive, send, request_headers=headers)                                                               │
                    │    92 │                                                                                                                                               │
                    │    93 │   def is_allowed_origin(self, origin: str) -> bool:                                                                                           │
                    │    94 │   │   if self.allow_all_origins:                                                                                                              │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/middleware/cors.py:146 in simple_response                                                           │
                    │                                                                                                                                                       │
                    │   143 │   │   self, scope: Scope, receive: Receive, send: Send, request_headers: Headers                                                              │
                    │   144 │   ) -> None:                                                                                                                                  │
                    │   145 │   │   send = functools.partial(self.send, send=send, request_headers=request_headers)                                                         │
                    │ ❱ 146 │   │   await self.app(scope, receive, send)                                                                                                    │
                    │   147 │                                                                                                                                               │
                    │   148 │   async def send(                                                                                                                             │
                    │   149 │   │   self, message: Message, send: Send, request_headers: Headers                                                                            │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py:79 in __call__                                                             │
                    │                                                                                                                                                       │
                    │    76 │   │   │   │   handler = self._lookup_exception_handler(exc)                                                                                   │
                    │    77 │   │   │                                                                                                                                       │
                    │    78 │   │   │   if handler is None:                                                                                                                 │
                    │ ❱  79 │   │   │   │   raise exc                                                                                                                       │
                    │    80 │   │   │                                                                                                                                       │
                    │    81 │   │   │   if response_started:                                                                                                                │
                    │    82 │   │   │   │   msg = "Caught handled exception, but response already started."                                                                 │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py:68 in __call__                                                             │
                    │                                                                                                                                                       │
                    │    65 │   │   │   await send(message)                                                                                                                 │
                    │    66 │   │                                                                                                                                           │
                    │    67 │   │   try:                                                                                                                                    │
                    │ ❱  68 │   │   │   await self.app(scope, receive, sender)                                                                                              │
                    │    69 │   │   except Exception as exc:                                                                                                                │
                    │    70 │   │   │   handler = None                                                                                                                      │
                    │    71                                                                                                                                                 │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/fastapi/middleware/asyncexitstack.py:20 in __call__                                                           │
                    │                                                                                                                                                       │
                    │   17 │   │   │   │   await self.app(scope, receive, send)                                                                                             │
                    │   18 │   │   │   except Exception as e:                                                                                                               │
                    │   19 │   │   │   │   dependency_exception = e                                                                                                         │
                    │ ❱ 20 │   │   │   │   raise e                                                                                                                          │
                    │   21 │   │   if dependency_exception:                                                                                                                 │
                    │   22 │   │   │   # This exception was possibly handled by the dependency but it should                                                                │
                    │   23 │   │   │   # still bubble up so that the ServerErrorMiddleware can return a 500                                                                 │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/fastapi/middleware/asyncexitstack.py:17 in __call__                                                           │
                    │                                                                                                                                                       │
                    │   14 │   │   async with AsyncExitStack() as stack:                                                                                                    │
                    │   15 │   │   │   scope[self.context_name] = stack                                                                                                     │
                    │   16 │   │   │   try:                                                                                                                                 │
                    │ ❱ 17 │   │   │   │   await self.app(scope, receive, send)                                                                                             │
                    │   18 │   │   │   except Exception as e:                                                                                                               │
                    │   19 │   │   │   │   dependency_exception = e                                                                                                         │
                    │   20 │   │   │   │   raise e                                                                                                                          │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/routing.py:718 in __call__                                                                          │
                    │                                                                                                                                                       │
                    │   715 │   │   │   match, child_scope = route.matches(scope)                                                                                           │
                    │   716 │   │   │   if match == Match.FULL:                                                                                                             │
                    │   717 │   │   │   │   scope.update(child_scope)                                                                                                       │
                    │ ❱ 718 │   │   │   │   await route.handle(scope, receive, send)                                                                                        │
                    │   719 │   │   │   │   return                                                                                                                          │
                    │   720 │   │   │   elif match == Match.PARTIAL and partial is None:                                                                                    │
                    │   721 │   │   │   │   partial = route                                                                                                                 │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/routing.py:276 in handle                                                                            │
                    │                                                                                                                                                       │
                    │   273 │   │   │   │   )                                                                                                                               │
                    │   274 │   │   │   await response(scope, receive, send)                                                                                                │
                    │   275 │   │   else:                                                                                                                                   │
                    │ ❱ 276 │   │   │   await self.app(scope, receive, send)                                                                                                │
                    │   277 │                                                                                                                                               │
                    │   278 │   def __eq__(self, other: typing.Any) -> bool:                                                                                                │
                    │   279 │   │   return (                                                                                                                                │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/starlette/routing.py:66 in app                                                                                │
                    │                                                                                                                                                       │
                    │    63 │   async def app(scope: Scope, receive: Receive, send: Send) -> None:                                                                          │
                    │    64 │   │   request = Request(scope, receive=receive, send=send)                                                                                    │
                    │    65 │   │   if is_coroutine:                                                                                                                        │
                    │ ❱  66 │   │   │   response = await func(request)                                                                                                      │
                    │    67 │   │   else:                                                                                                                                   │
                    │    68 │   │   │   response = await run_in_threadpool(func, request)                                                                                   │
                    │    69 │   │   await response(scope, receive, send)                                                                                                    │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/fastapi/routing.py:274 in app                                                                                 │
                    │                                                                                                                                                       │
                    │    271 │   │   if errors:                                                                                                                             │
                    │    272 │   │   │   raise RequestValidationError(_normalize_errors(errors), body=body)                                                                 │
                    │    273 │   │   else:                                                                                                                                  │
                    │ ❱  274 │   │   │   raw_response = await run_endpoint_function(                                                                                        │
                    │    275 │   │   │   │   dependant=dependant, values=values, is_coroutine=is_coroutine                                                                  │
                    │    276 │   │   │   )                                                                                                                                  │
                    │    277                                                                                                                                                │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/fastapi/routing.py:191 in run_endpoint_function                                                               │
                    │                                                                                                                                                       │
                    │    188 │   assert dependant.call is not None, "dependant.call must be a function"                                                                     │
                    │    189 │                                                                                                                                              │
                    │    190 │   if is_coroutine:                                                                                                                           │
                    │ ❱  191 │   │   return await dependant.call(**values)                                                                                                  │
                    │    192 │   else:                                                                                                                                      │
                    │    193 │   │   return await run_in_threadpool(dependant.call, **values)                                                                               │
                    │    194                                                                                                                                                │
                    │                                                                                                                                                       │
                    │ /root/summarize-backend/routes/endpoints/summarize.py:36 in generation                                                                                │
                    │                                                                                                                                                       │
                    │   33 │   │   │   status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,                                                                                    │
                    │   34 │   │   │   detail='You can select only 1 parameter: article_url or video_url',                                                                  │
                    │   35 │   │   )                                                                                                                                        │
                    │ ❱ 36 │   test = await YandexSummarize().generation(generation_params)                                                                                 │
                    │   37 │   logger.info(test)                                                                                                                            │
                    │   38 │   return test                                                                                                                                  │
                    │   39                                                                                                                                                  │
                    │                                                                                                                                                       │
                    │ /root/summarize-backend/api/summarize.py:44 in generation                                                                                             │
                    │                                                                                                                                                       │
                    │   41 │   async def generation(self, data: dict):                                                                                                      │
                    │   42 │   │   headers = self.headers.copy()                                                                                                            │
                    │   43 │   │   headers['Cookie'] = YANDEX_COOKIE                                                                                                        │
                    │ ❱ 44 │   │   return await self.request('generation', data, headers)                                                                                   │
                    │   45                                                                                                                                                  │
                    │                                                                                                                                                       │
                    │ /root/summarize-backend/api/summarize.py:29 in request                                                                                                │
                    │                                                                                                                                                       │
                    │   26 │   │   │   │   headers = headers                                                                                                                │
                    │   27 │   │   │   )                                                                                                                                    │
                    │   28 │   │   │   self.logger.debug(f'POST /api/{endpoint}: {r.status_code}')                                                                          │
                    │ ❱ 29 │   │   │   return r.json()                                                                                                                      │
                    │   30 │                                                                                                                                                │
                    │   31 │   async def get_sharing_url(self, data: dict):                                                                                                 │
                    │   32 │   │   headers = self.headers.copy()                                                                                                            │
                    │                                                                                                                                                       │
                    │ /usr/local/lib/python3.10/dist-packages/httpx/_models.py:756 in json                                                                                  │
                    │                                                                                                                                                       │
                    │    753 │   │   │   encoding = guess_json_utf(self.content)                                                                                            │
                    │    754 │   │   │   if encoding is not None:                                                                                                           │
                    │    755 │   │   │   │   return jsonlib.loads(self.content.decode(encoding), **kwargs)                                                                  │
                    │ ❱  756 │   │   return jsonlib.loads(self.text, **kwargs)                                                                                              │
                    │    757 │                                                                                                                                              │
                    │    758 │   @property                                                                                                                                  │
                    │    759 │   def cookies(self) -> "Cookies":                                                                                                            │
                    │                                                                                                                                                       │
                    │ /usr/lib/python3.10/json/__init__.py:346 in loads                                                                                                     │
                    │                                                                                                                                                       │
                    │   343 │   if (cls is None and object_hook is None and                                                                                                 │
                    │   344 │   │   │   parse_int is None and parse_float is None and                                                                                       │
                    │   345 │   │   │   parse_constant is None and object_pairs_hook is None and not kw):                                                                   │
                    │ ❱ 346 │   │   return _default_decoder.decode(s)                                                                                                       │
                    │   347 │   if cls is None:                                                                                                                             │
                    │   348 │   │   cls = JSONDecoder                                                                                                                       │
                    │   349 │   if object_hook is not None:                                                                                                                 │
                    │                                                                                                                                                       │
                    │ /usr/lib/python3.10/json/decoder.py:337 in decode                                                                                                     │
                    │                                                                                                                                                       │
                    │   334 │   │   containing a JSON document).                                                                                                            │
                    │   335 │   │                                                                                                                                           │
                    │   336 │   │   """                                                                                                                                     │
                    │ ❱ 337 │   │   obj, end = self.raw_decode(s, idx=_w(s, 0).end())                                                                                       │
                    │   338 │   │   end = _w(s, end).end()                                                                                                                  │
                    │   339 │   │   if end != len(s):                                                                                                                       │
                    │   340 │   │   │   raise JSONDecodeError("Extra data", s, end)                                                                                         │
                    │                                                                                                                                                       │
                    │ /usr/lib/python3.10/json/decoder.py:355 in raw_decode                                                                                                 │
                    │                                                                                                                                                       │
                    │   352 │   │   try:                                                                                                                                    │
                    │   353 │   │   │   obj, end = self.scan_once(s, idx)                                                                                                   │
                    │   354 │   │   except StopIteration as err:                                                                                                            │
                    │ ❱ 355 │   │   │   raise JSONDecodeError("Expecting value", s, err.value) from None                                                                    │
                    │   356 │   │   return obj, end                                                                                                                         │
                    │   357                                                                                                                                                 │
                    ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
                    JSONDecodeError: Expecting value: line 1 column 1 (char 0)

.example.env не забыл переименовать в .env? Или может не заполнил апи ключ или значения кука?

bropines commented 9 months ago

image А вот хз. Как я понял мне нужно открыть страницу с апи и там где выдает ключ, чекнуть sessionID

bropines commented 9 months ago

Кароче. Небольшие исследования.

  1. Session id - Значение вставляем заместо XXXX. Не работает? Попробуй со второго аккаунта
  2. Для сборки на моей версии NodeJS надо было сделать:

    Установка пакетов:

    npm i

    Решение конфликтов пакетов:

    npm audit fix

    Решение решения конфликтов пакетов:

    npm audit fix --force