lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
41.98k stars 9.46k forks source link

能否提供PROXY_URL 配置 #985

Closed zt199510 closed 1 month ago

zt199510 commented 8 months ago

🥰 需求描述

当前的OPENAI_PROXY_URL 可能需要自己去部署一个代理服务,感觉有点多余 ,直接提供PROXY_URL会更方便一点

🧐 解决方案

直接提供PROXY_URL 配置

📝 补充信息

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


🥰 Description of requirements

The current OPENAI_PROXY_URL requires you to deploy a proxy service yourself, which feels a bit redundant. It would be more convenient to provide PROXY_URL directly.

🧐 Solution

Provide PROXY_URL configuration directly

📝 Supplementary information

None

lobehubbot commented 8 months ago

👀 @zt199510

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

TonyBlur commented 8 months ago

这个在设置里有啊Screenshot_2024-01-14-12-08-53-625_com.microsoft.emmx-edit.jpg

zt199510 commented 8 months ago

这个在设置里有啊Screenshot_2024-01-14-12-08-53-625_com.microsoft.emmx-edit.jpg

这个需要你自己再去部署一个代理服务器 然后填写地址 直接使用Proxy_URL 就不需要

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This is in the settings! [Screenshot_2024-01-14-12-08-53-625_com.microsoft.emmx-edit.jpg](https://private-user-images.githubusercontent.com/101348912/296529251- d884a89c-b568-45c3-80fb-f0c181bebee2.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb25 0ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDUyMTk2MTQsIm5iZiI6MTcwNTIxOTMxNCwicGF0aCI6Ii8xMDEzNDg5MTIvMjk2NTI5MjUxLWQ4ODRhODljLWI1NjgtNDVjMy04MGZiLWYwYzE4MWJ lYmVlMi5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwMTE0JTJGdXMtZWFzdC0xJTJGczMlMk Zhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDExNFQwODAxNTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xZTkyZTE4MDkwNjc2NTU4MGFkM2YwNmEzNDYzYjM4OGYzMm IwYzI3OWI0ZWQzMWQ2NTY3ZWIyMjVhYTQ5OGM5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.3ETB1ksBUFqTD62f-kqw2Nb572No77 ivzeQxUHWsTrI)

This requires you to deploy a proxy server yourself and fill in the address. It is not necessary to use Proxy_URL directly.

TonyBlur commented 8 months ago

这个在设置里有啊Screenshot_2024-01-14-12-08-53-625_com.microsoft.emmx-edit.jpg

这个需要你自己再去部署一个代理服务器 然后填写地址 直接使用Proxy_URL 就不需要

不用自己部署啊,你直接在这里输入代理API的地址和key就能用

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This is in the settings! [Screenshot_2024-01-14-12-08-53-625_com.microsoft.emmx-edit.jpg](https://private-user-images.githubusercontent.com/101348912/296529251 -d884a89c-b568-45c3-80fb-f0c181bebee2.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb25 0ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDUyMTk2MTQsIm5iZiI6MTcwNTIxOTMxNCwicGF0aCI6Ii8xMDEzNDg5MTIvMjk2NTI5MjUxLWQ4ODRhODljLWI1NjgtNDVjMy04MGZiLWYwYzE4MWJ lYmVlMi5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwMTE0JTJGdXMtZWFzdC0xJTJGczMlMk Zhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDExNFQwODAxNTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xZTkyZTE4MDkwNjc2NTU4MGFkM2YwNmEzNDYzYjM4OGYzMm IwYzI3OWI0ZWQzMWQ2NTY3ZWIyMjVhYTQ5OGM5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.3ETB1ksBUFqTD62f-kqw2Nb572No77 ivzeQxUHWsTrI)

This requires you to deploy a proxy server yourself and fill in the address. It is not necessary to use Proxy_URL directly.

You don’t need to deploy it yourself. You can directly enter the address and key of the proxy API here to use it.

piwawa commented 8 months ago

这个在设置里有啊Screenshot_2024-01-14-12-08-53-625_com.microsoft.emmx-edit.jpg

这个需要你自己再去部署一个代理服务器 然后填写地址 直接使用Proxy_URL 就不需要

不用自己部署啊,你直接在这里输入代理API的地址和key就能用

他要的是走本地代理,就是翻墙,比如 v2ray 的10809端口

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This is in the settings! [Screenshot_2024-01-14-12-08-53-625_com.microsoft.emmx-edit.jpg](https://private-user-images.githubusercontent.com/101348912/ 296529251-d884a89c-b568-45c3-80fb-f0c181bebee2.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1Y nVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDUyMTk2MTQsIm5iZiI6MTcwNTIxOTMxNCwicGF0aCI6Ii8xMDEzNDg5MTIvMjk2NTI5MjUxLWQ4ODRhODljLWI1NjgtNDVjMy04MGZi LWYwYzE4MWJlYmVlMi5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwMTE0JTJGdXMtZWFzdC0 xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDExNFQwODAxNTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xZTkyZTE4MDkwNjc2NTU4MGFkM2YwNmEzNDY zYjM4OGYzMmIwYzI3OWI0ZWQzMWQ2NTY3ZWIyMjVhYTQ5OGM5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.3ETB1ksBUFqTD62f-kq w2Nb572No77ivzeQxUHWsTrI)

This requires you to deploy a proxy server yourself and fill in the address. It is not necessary to use Proxy_URL directly.

You don’t need to deploy it yourself. You can directly enter the address and key of the proxy API here to use it.

What he wants is to use a local proxy, which is to bypass the wall, such as v2ray's 10809 port

zhuozhiyongde commented 8 months ago

参见 https://github.com/lobehub/lobe-chat/issues/524

你可以使用上述问题中提到的 Vercel 透明代理来解决这个问题。

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


See https://github.com/lobehub/lobe-chat/issues/524

You can solve this problem by using the Vercel transparent proxy mentioned in the above question.

arvinxx commented 8 months ago

这次在做多 Provider 方案时,发现 proxy 是必须的 (Google Gemini 的 sdk 不支持 baseURL)

因此会支持上 HTTP_PROXY_URL 环境变量来提供本地代理:https://github.com/lobehub/lobe-chat/pull/1173

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This time when doing a multi-provider solution, I found that proxy is necessary.

Therefore, the HTTP_PROXY_URL environment variable will be supported to provide a local proxy.

zhuozhiyongde commented 8 months ago

这次在做多 Provider 方案时,发现 proxy 是必须的。

因此会支持上 HTTP_PROXY_URL 环境变量来提供本地代理:#1173

好耶

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This time when doing a multi-provider solution, I found that proxy is necessary.

Therefore, the HTTP_PROXY_URL environment variable will be supported to provide a local proxy: #1173

Great

shorexilin commented 7 months ago

这次在做多 Provider 方案时,发现 proxy 是必须的 (Google Gemini 的 sdk 不支持 baseURL)

因此会支持上 HTTP_PROXY_URL 环境变量来提供本地代理:#1173

请问下在哪个版本会支持这个环境变量啊?

lobehubbot commented 7 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This time when doing a multi-provider solution, I found that proxy is necessary (Google Gemini’s sdk does not support baseURL)

Therefore, the HTTP_PROXY_URL environment variable will be supported to provide a local proxy: #1173

May I ask which version supports this environment variable?

piwawa commented 6 months ago

这次在做多 Provider 方案时,发现 proxy 是必须的 (Google Gemini 的 sdk 不支持 baseURL)

因此会支持上 HTTP_PROXY_URL 环境变量来提供本地代理:#1173

这个 env 是不是现在还没加上?

lobehubbot commented 6 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This time when doing a multi-provider solution, I found that proxy is necessary (Google Gemini’s sdk does not support baseURL)

Therefore, the HTTP_PROXY_URL environment variable will be supported to provide a local proxy: #1173

Is this env not added yet?

arvinxx commented 6 months ago

@piwawa 对,功能其实实现了,但是没实装: https://github.com/lobehub/lobe-chat/blob/main/src/app/api/chat/google/route.ts#L3-L14

原因是这个配置只能在 Node 环境下跑,一旦开启以后就没法切到 Edge Runtime 了,这会导致vercel 部署的体验受到很大的影响。 cc @coulsontl @shorexilin @zhuozhiyongde

lobehubbot commented 6 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@piwawa Yes, the function is actually implemented, but it is not installed: https://github.com/lobehub/lobe-chat/blob/main/src/app/api/chat/google/route.ts#L3-L14

The reason is that this configuration can only be run in the Node environment. Once it is turned on, it cannot be switched to Edge Runtime, which will greatly affect the vercel deployment experience.

piwawa commented 6 months ago

@piwawa 对,功能其实实现了,但是没实装: https://github.com/lobehub/lobe-chat/blob/main/src/app/api/chat/google/route.ts#L3-L14

原因是这个配置只能在 Node 环境下跑,一旦开启以后就没法切到 Edge Runtime 了,这会导致vercel 部署的体验受到很大的影响。 cc @coulsontl @shorexilin @zhuozhiyongde

更新之后一直没法调用api,我这个api是oneapi部署的,用chatgpt-next-web和本地调用 (不翻墙) 都没问题,就这个lobe不行,加 /v1 和不加都报错,能看下问题原因吗?

image image

 ⨯ Error: fetch failed
    at context.fetch (/app/node_modules/.pnpm/next@14.1.1_@babel+core@7.23.6_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/web/sandbox/context.js:272:38)
    at r (/app/.next/server/edge-chunks/699.js:5589:76)
    at doOriginalFetch (/app/.next/server/edge-chunks/699.js:8034:24)
    at /app/.next/server/edge-chunks/699.js:8159:20
    at /app/.next/server/edge-chunks/699.js:8409:36
    at NoopContextManager.with (/app/.next/server/edge-chunks/699.js:732:30)
    at ContextAPI.with (/app/.next/server/edge-chunks/699.js:402:58)
    at NoopTracer.startActiveSpan (/app/.next/server/edge-chunks/699.js:1325:34)
    at ProxyTracer.startActiveSpan (/app/.next/server/edge-chunks/699.js:1365:36)
    at /app/.next/server/edge-chunks/699.js:8398:103 {
  cause: ConnectTimeoutError: Connect Timeout Error
      at onConnectTimeout (eval at requireWithFakeGlobalScope (/app/node_modules/.pnpm/next@14.1.1_@babel+core@7.23.6_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/edge-runtime/index.js:1:657096), <anonymous>:9145:28)
      at eval (eval at requireWithFakeGlobalScope (/app/node_modules/.pnpm/next@14.1.1_@babel+core@7.23.6_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/edge-runtime/index.js:1:657096), <anonymous>:9101:50)
      at Immediate.eval [as _onImmediate] (eval at requireWithFakeGlobalScope (/app/node_modules/.pnpm/next@14.1.1_@babel+core@7.23.6_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/edge-runtime/index.js:1:657096), <anonymous>:9133:13)
      at process.processImmediate (node:internal/timers:478:21)
      at process.callbackTrampoline (node:internal/async_hooks:130:17) {
    code: 'UND_ERR_CONNECT_TIMEOUT'
  }
}
 ⨯ Error: fetch failed
    at context.fetch (/app/node_modules/.pnpm/next@14.1.1_@babel+core@7.23.6_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/web/sandbox/context.js:272:38)
    at r (/app/.next/server/edge-chunks/699.js:5589:76)
    at doOriginalFetch (/app/.next/server/edge-chunks/699.js:8034:24)
    at /app/.next/server/edge-chunks/699.js:8159:20
    at /app/.next/server/edge-chunks/699.js:8409:36
    at NoopContextManager.with (/app/.next/server/edge-chunks/699.js:732:30)
    at ContextAPI.with (/app/.next/server/edge-chunks/699.js:402:58)
    at NoopTracer.startActiveSpan (/app/.next/server/edge-chunks/699.js:1325:34)
    at ProxyTracer.startActiveSpan (/app/.next/server/edge-chunks/699.js:1365:36)
    at /app/.next/server/edge-chunks/699.js:8398:103 {
  cause: ConnectTimeoutError: Connect Timeout Error
      at onConnectTimeout (eval at requireWithFakeGlobalScope (/app/node_modules/.pnpm/next@14.1.1_@babel+core@7.23.6_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/edge-runtime/index.js:1:657096), <anonymous>:9145:28)
      at eval (eval at requireWithFakeGlobalScope (/app/node_modules/.pnpm/next@14.1.1_@babel+core@7.23.6_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/edge-runtime/index.js:1:657096), <anonymous>:9101:50)
      at Immediate.eval [as _onImmediate] (eval at requireWithFakeGlobalScope (/app/node_modules/.pnpm/next@14.1.1_@babel+core@7.23.6_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/edge-runtime/index.js:1:657096), <anonymous>:9133:13)
      at process.processImmediate (node:internal/timers:478:21)
      at process.callbackTrampoline (node:internal/async_hooks:130:17) {
    code: 'UND_ERR_CONNECT_TIMEOUT'
  }
}
arvinxx commented 6 months ago

@piwawa 你 Discord 上私戳我帮你看看

lobehubbot commented 6 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@piwawa PM me privately on Discord and let me check it out for you

lobehubbot commented 6 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


HTTP_PROXY_URL

@arvinxx Boss, when will this ability be available?

@arvinxx Can you decide whether to open this code based on the channel when packaging?

lobehubbot commented 6 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@piwawa Yes, the function is actually implemented, but it is not installed: https://github.com/lobehub/lobe-chat/blob/main/src/app/api/chat/google/route.ts#L3-L14

The reason is that this configuration can only be run in the Node environment. Once enabled, you cannot switch to Edge Runtime, which will greatly affect the vercel deployment experience. cc @coulsontl @shorexilin @zhuozhiyongde

@arvinxx Can you decide whether to open this code based on the channel when packaging?

CXwudi commented 6 months ago

既然lobe-chat是个纯前端应用,那是不是不管什么部署方式,只要浏览器翻出去了就行,而这只需要打开系统代理即可

lobehubbot commented 6 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Since lobe-chat is a pure front-end application, no matter what the deployment method is, as long as the browser is opened, it only needs to open the system proxy.

Arbitraryfate commented 5 months ago

请问PROXY_URL是否支持ipv6网址?

lobehubbot commented 5 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Does PROXY_URL support ipv6 URL?

lobehubbot commented 1 month ago

✅ @zt199510

This issue is closed, If you have any questions, you can comment and reply.\ 此问题已经关闭。如果您有任何问题,可以留言并回复。

lobehubbot commented 1 month ago

:tada: This issue has been resolved in version 1.8.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: