Hk-Gosuto / ChatGPT-Next-Web-LangChain

一键拥有你自己的 ChatGPT 网页服务。 One-Click to deploy your own ChatGPT web UI.(基于 langchain 实现的插件版本 Plugin version implemented based on langchain)
https://n3xt.chat
MIT License
1.05k stars 391 forks source link

[Bug] arm64本地部署下首次加载非常缓慢 #249

Open A2Sumie opened 2 months ago

A2Sumie commented 2 months ago

Bug Description

之前什么版本不太清楚但是就是提了#236后(3月25日)那个版本在继续用,那时候除了现已解决的firefox问题使用基本正常 今天更新之后之后首次加载要2分钟以上,然后各种地方都时不时卡住,见日志 再就是yarn install时印象里没有这么多warning yarn build后没什么变化

Steps to Reproduce

OPENAI_API_KEY=XXXX
CODE=XXXX
CHOOSE_SEARCH_ENGINE=google
NEXT_PUBLIC_ENABLE_NODEJS_PLUGIN=1
R2_ACCOUNT_ID=XXXX
R2_ACCESS_KEY_ID=XXXX
R2_SECRET_ACCESS_KEY=XXXX
R2_BUCKET=igpt
WOLFRAM_ALPHA_APP_ID=XXXX
ENABLE_RAG=1
QDRANT_URL=XXXX
QDRANT_API_KEY=XXXX

在一台nanopi r5s,debian11,环境变量大概如上的条件下本地部署,首次访问的加载速度以及部份操作难以接受的慢 与浏览器似乎无关

Expected Behavior

和曾经版本一样正常响应

Screenshots

No response

Deployment Method

Desktop OS

No response

Desktop Browser

No response

Desktop Browser Version

No response

Smartphone Device

No response

Smartphone OS

No response

Smartphone Browser

No response

Smartphone Browser Version

No response

Additional Logs

pi@NanoPi-R5S:~/gpt/cgpt$ yarn install
yarn install v1.22.21
[1/4] Resolving packages...
warning Resolution field "openai@4.28.4" is incompatible with requested version "openai@^4.32.1"
warning Resolution field "openai@4.28.4" is incompatible with requested version "openai@^4.32.1"
[2/4] Fetching packages...
warning @qdrant/js-client-rest@1.8.2: The engine "pnpm" appears to be invalid.
warning @qdrant/openapi-typescript-fetch@1.2.6: The engine "pnpm" appears to be invalid.
warning sharp@0.33.3: The engine "libvips" appears to be invalid.
warning @img/sharp-darwin-arm64@0.33.3: The engine "pnpm" appears to be invalid.
warning @img/sharp-darwin-arm64@0.33.3: The engine "glibc" appears to be invalid.
warning @img/sharp-darwin-x64@0.33.3: The engine "pnpm" appears to be invalid.
warning @img/sharp-darwin-x64@0.33.3: The engine "glibc" appears to be invalid.
warning @img/sharp-libvips-darwin-arm64@1.0.2: The engine "pnpm" appears to be invalid.
warning @img/sharp-libvips-darwin-arm64@1.0.2: The engine "macos" appears to be invalid.
warning @img/sharp-libvips-darwin-x64@1.0.2: The engine "pnpm" appears to be invalid.
warning @img/sharp-libvips-darwin-x64@1.0.2: The engine "macos" appears to be invalid.
warning @img/sharp-libvips-linux-arm@1.0.2: The engine "pnpm" appears to be invalid.
warning @img/sharp-libvips-linux-arm@1.0.2: The engine "glibc" appears to be invalid.
warning @img/sharp-libvips-linux-arm64@1.0.2: The engine "pnpm" appears to be invalid.
warning @img/sharp-libvips-linux-arm64@1.0.2: The engine "glibc" appears to be invalid.
warning @img/sharp-libvips-linux-s390x@1.0.2: The engine "pnpm" appears to be invalid.
warning @img/sharp-libvips-linux-s390x@1.0.2: The engine "glibc" appears to be invalid.
warning @img/sharp-libvips-linux-x64@1.0.2: The engine "pnpm" appears to be invalid.
warning @img/sharp-libvips-linux-x64@1.0.2: The engine "glibc" appears to be invalid.
warning @img/sharp-libvips-linuxmusl-arm64@1.0.2: The engine "pnpm" appears to be invalid.
warning @img/sharp-libvips-linuxmusl-arm64@1.0.2: The engine "musl" appears to be invalid.
warning @img/sharp-libvips-linuxmusl-x64@1.0.2: The engine "pnpm" appears to be invalid.
warning @img/sharp-libvips-linuxmusl-x64@1.0.2: The engine "musl" appears to be invalid.
warning @img/sharp-linux-arm@0.33.3: The engine "pnpm" appears to be invalid.
warning @img/sharp-linux-arm@0.33.3: The engine "glibc" appears to be invalid.
warning @img/sharp-linux-arm64@0.33.3: The engine "pnpm" appears to be invalid.
warning @img/sharp-linux-arm64@0.33.3: The engine "glibc" appears to be invalid.
warning @img/sharp-linux-s390x@0.33.3: The engine "pnpm" appears to be invalid.
warning @img/sharp-linux-s390x@0.33.3: The engine "glibc" appears to be invalid.
warning @img/sharp-linux-x64@0.33.3: The engine "pnpm" appears to be invalid.
warning @img/sharp-linux-x64@0.33.3: The engine "glibc" appears to be invalid.
warning @img/sharp-linuxmusl-arm64@0.33.3: The engine "pnpm" appears to be invalid.
warning @img/sharp-linuxmusl-arm64@0.33.3: The engine "musl" appears to be invalid.
warning @img/sharp-linuxmusl-x64@0.33.3: The engine "pnpm" appears to be invalid.
warning @img/sharp-linuxmusl-x64@0.33.3: The engine "musl" appears to be invalid.
warning @img/sharp-wasm32@0.33.3: The engine "pnpm" appears to be invalid.
warning @img/sharp-win32-ia32@0.33.3: The engine "pnpm" appears to be invalid.
warning @img/sharp-win32-x64@0.33.3: The engine "pnpm" appears to be invalid.
[3/4] Linking dependencies...
warning "epub2 > crlf-normalize > ts-type@3.0.1" has unmet peer dependency "ts-toolbelt@^9.6.0".
[4/4] Building fresh packages...
success Saved lockfile.
$ husky install
husky - Git hooks installed
Done in 238.76s.
pi@NanoPi-R5S:~/gpt/cgpt$ yarn dev
yarn run v1.22.21
$ next dev
[Next] build mode standalone
[Next] build with chunk:  true
[Next] build mode standalone
[Next] build with chunk:  true
  \u25b2 Next.js 13.5.6
  - Local:        http://localhost:3000
  - Environments: .env
  - Experiments (use at your own risk):
     · forceSwcTransforms

 \u2713 Ready in 7.7s
 \u25cb Compiling /page ...
 \u2713 Compiled /page in 142s (4919 modules)
[Server Config] using 1 of 1 api key
[Server Config] using 1 of 1 api key
 \u25cb Compiling /api/config/route ...
 \u2713 Compiled /api/config/route in 6.1s (122 modules)
[Server Config] using 1 of 1 api key
Issues-translate-bot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically.


Title: [Bug] The first loading under arm64 is very slow

A2Sumie commented 2 months ago

尝试实际进行对话,速度也是非常糟糕,不过仅限首次

 \u25cb Compiling /api/langchain/tool/agent/nodejs/route ...
 \u2713 Compiled /api/langchain/tool/agent/nodejs/route in 42.4s (3202 modules)
[WARNING]: Importing from "langchain/tools/calculator" is deprecated.

Instead, please add the "@langchain/community" package to your project with e.g.

    $ npm install @langchain/community

and import from "@langchain/community/tools/calculator".

This will be mandatory after the next "langchain" minor version bump to 0.2.
[Server Config] using 1 of 1 api key
[Auth] allowed hashed codes:  []
[Auth] got access code: 
[Auth] hashed access code: XXXXXX
[User IP]  ::ffff:100.113.250.96
[Time]  4/13/2024, 4:33:23 PM
[Auth] use user api key
[Server Config] using 1 of 1 api key
[Server Config] using 1 of 1 api key
[baseUrl] https://api.openai.com/v1
[Server Config] using 1 of 1 api key
[Server Config] using 1 of 1 api key
[baseUrl] https://api.openai.com/v1
A2Sumie commented 2 months ago

yarn build后速度无改善

yarn build
yarn build
yarn run v1.22.21
$ cross-env BUILD_MODE=standalone next build
[Next] build mode standalone
[Next] build with chunk:  true
Warning: For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'npm i sharp', and Next.js will use it automatically for Image Optimization.
Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
 \u2713 Creating an optimized production build    
 \u2713 Compiled successfully

./app/components/chat.tsx
537:6  Warning: React Hook useEffect has missing dependencies: 'isEnableRAG' and 'props'. Either include them or remove the dependency array. However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the useEffect call and refer to those specific props inside useEffect.  react-hooks/exhaustive-deps
951:6  Warning: React Hook useEffect has missing dependencies: 'chatStore', 'config.modelConfig', 'config.sttConfig', and 'onRecognitionEnd'. Either include them or remove the dependency array.  react-hooks/exhaustive-deps
1143:6  Warning: React Hook useMemo has an unnecessary dependency: 'isLoading'. Either exclude it or remove the dependency array.  react-hooks/exhaustive-deps
1691:23  Warning: Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element  @next/next/no-img-element
1708:29  Warning: Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element  @next/next/no-img-element

./app/components/search-bar.tsx
70:5  Warning: React Hook useMemo has a missing dependency: 'message'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps
70:6  Warning: React Hook useMemo has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.  react-hooks/exhaustive-deps
164:6  Warning: React Hook useCallback has a missing dependency: 'input'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps
209:6  Warning: React Hook useEffect has a missing dependency: 'setIsSearching'. Either include it or remove the dependency array. If 'setIsSearching' changes too often, find the parent component that defines it and wrap that definition in useCallback.  react-hooks/exhaustive-deps

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
 \u2713 Linting and checking validity of types    
 \u26a0 Using edge runtime on a page currently disables static generation for that page
   Collecting page data  .[Server Config] using 1 of 1 api key
   Collecting page data  ..[Server Config] using 1 of 1 api key
   Collecting page data  ..[Server Config] using 1 of 1 api key
   Collecting page data  ...[Server Config] using 1 of 1 api key
   Collecting page data  ..[Server Config] using 1 of 1 api key
   Collecting page data  ...[Server Config] using 1 of 1 api key
[Server Config] using 1 of 1 api key
 \u2713 Collecting page data    
   Generating static pages (4/8)  [==  ] 
[Server Config] using 1 of 1 api key
 \u2713 Generating static pages (8/8) 
 \u2713 Collecting build traces    
 \u2713 Finalizing page optimization    

Route (app)                              Size     First Load JS
\u250c \u25cb /                                    380 kB          462 kB
\u251c \u25cb /_not-found                          882 B          82.9 kB
\u251c \u2107 /api/anthropic/[...path]             0 B                0 B
\u251c \u2107 /api/config                          0 B                0 B
\u251c \u2107 /api/cors                            0 B                0 B
\u251c \u03bb /api/file/[...path]                  0 B                0 B
\u251c \u03bb /api/file/upload                     0 B                0 B
\u251c \u2107 /api/google/[...path]                0 B                0 B
\u251c \u03bb /api/langchain/rag/search            0 B                0 B
\u251c \u03bb /api/langchain/rag/store             0 B                0 B
\u251c \u2107 /api/langchain/tool/agent/edge       0 B                0 B
\u251c \u03bb /api/langchain/tool/agent/nodejs     0 B                0 B
\u251c \u2107 /api/openai/[...path]                0 B                0 B
\u251c \u2107 /api/upstash/[action]/[...key]       0 B                0 B
\u2514 \u2107 /api/webdav/[...path]                0 B                0 B
+ First Load JS shared by all            82 kB
  \u251c chunks/2472-a3c580a96754bcde.js      27.6 kB
  \u251c chunks/fd9d1056-f2f795bbdbec88ac.js  51.1 kB
  \u251c chunks/main-app-5dbffefed26bdb5a.js  237 B
  \u2514 chunks/webpack-5d1650101b090eb9.js   3.09 kB

\u2107  (Streaming)  server-side renders with streaming (uses React 18 SSR streaming or Server Components)
\u03bb  (Server)     server-side renders at runtime (uses getInitialProps or getServerSideProps)
\u25cb  (Static)     automatically rendered as static HTML (uses no initial props)

Done in 708.17s.
pi@NanoPi-R5S:~/gpt/cgpt$ yarn dev
yarn run v1.22.21
$ next dev
[Next] build mode standalone
[Next] build with chunk:  true
[Next] build mode standalone
[Next] build with chunk:  true
  \u25b2 Next.js 13.5.6
  - Local:        http://localhost:3000
  - Environments: .env
  - Experiments (use at your own risk):
     · forceSwcTransforms

 \u2713 Ready in 14.8s
 \u25cb Compiling /page ...
 \u2713 Compiled /page in 141.1s (4919 modules)
[Server Config] using 1 of 1 api key
[Server Config] using 1 of 1 api key
 \u25cb Compiling /api/config/route ...
 \u2713 Compiled /api/config/route in 5.8s (122 modules)
[Server Config] using 1 of 1 api key
Hk-Gosuto commented 2 months ago

试一下原版是否正常

Issues-translate-bot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically.


Try the original version to see if it is normal

A2Sumie commented 2 months ago

试一下原版是否正常

确实原版也一样慢的不行了,只能先凑合用了

Issues-translate-bot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically.


Try to see if the original version is normal

Indeed, the original version is also extremely slow, so I can only make do with it for now.

Hk-Gosuto commented 2 months ago

可以提 issues 给上游仓库,他们修好后我会 merge。

Issues-translate-bot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically.


You can submit issues to the upstream warehouse, and I will merge them after they fix them.