Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] dockerfile部署后,agent无法加载。 #3395

Closed
yincangshiwei opened this issue Aug 4, 2024 · 37 comments
Closed

[Bug] dockerfile部署后,agent无法加载。 #3395

yincangshiwei opened this issue Aug 4, 2024 · 37 comments
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@yincangshiwei
Copy link

📦 Environment

Docker

📌 Version

1.8.2

💻 Operating System

Other Linux

🌐 Browser

Chrome, Edge, Safari, Firefox

🐛 Bug Description

使用最新的dockerfile打包部署后,agent无法加载出来。估计是PROXYCHAINS不适配我这个环境,这玩意能否去掉。
image

📷 Recurrence Steps

No response

🚦 Expected Behavior

No response

📝 Additional Information

No response

@yincangshiwei yincangshiwei added the 🐛 Bug Something isn't working | 缺陷 label Aug 4, 2024
@github-project-automation github-project-automation bot moved this to Roadmap - Chat 1.x in Lobe Chat Routine Aug 4, 2024
@lobehubbot
Copy link
Member

👀 @yincangshiwei

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。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@yincangshiwei
Copy link
Author

果然是PROXYCHAINS问题,我去掉就没事。

@lobehubbot
Copy link
Member

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


Sure enough, it is a PROXYCHAINS problem. If I remove it, it will be fine.

@arvinxx
Copy link
Contributor

arvinxx commented Aug 4, 2024

@hezhijie0327 来帮忙看看这个 case?

@lobehubbot
Copy link
Member

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


@hezhijie0327 Come and help with this case?

@hezhijie0327
Copy link
Contributor

@yincangshiwei docker 部署命令能提供下嘛,如 docker run -it --rm --name lobe-chat -e PROXY_URL="http://127.0.0.1:7890" lobehub/lobe-chat:latest

image
image

我本地跑了下没啥问题,建议检查下:

  1. 代理配置:docker exec -it lobe-chat cat /etc/proxychains/proxychains.conf
    image
  2. DNS 记录:docker exec -it lobe-chat nslookup chat-agents.lobehub.com
    image

@lobehubbot
Copy link
Member

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


@yincangshiwei Can you provide the docker deployment command, such as docker run -it --rm --name lobe-chat -e PROXY_URL="http://127.0.0.1:7890" lobehub/lobe-chat:latest

image
image

I ran it locally and there was no problem. I suggest you check:

  1. Proxy configuration: docker exec -it lobe-chat cat /etc/proxychains/proxychains.conf
    image
  2. DNS record: docker exec -it lobe-chat nslookup chat-agents.lobehub.com
    image

@hugoyue
Copy link

hugoyue commented Aug 5, 2024

docker 官方镜像,运行测试一切正常 。

@lobehubbot
Copy link
Member

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


Docker official image, everything is normal when running the test.

@yincangshiwei
Copy link
Author

@yincangshiwei docker 部署命令能提供下嘛,如 docker run -it --rm --name lobe-chat -e PROXY_URL="http://127.0.0.1:7890" lobehub/lobe-chat:latest

image image

我本地跑了下没啥问题,建议检查下:

  1. 代理配置:docker exec -it lobe-chat cat /etc/proxychains/proxychains.conf
    image
  2. DNS 记录:docker exec -it lobe-chat nslookup chat-agents.lobehub.com
    image

我环境所在是云函数

@lobehubbot
Copy link
Member

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


@yincangshiwei docker 部署命令能提供下嘛,如 docker run -it --rm --name lobe-chat -e PROXY_URL="http://127.0.0.1:7890" lobehub/lobe-chat:latest

![image](https://private-user-images.githubusercontent.com/58100052/354930646-6bc6a5de-9486-44d0-acf6-0f526ffc6bd8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..1 iZm7y39p1n1-qoFGH32HCw09NXcrZ97wIK1v6q8KOM)![image]( https://private-user-images.githubusercontent.com/58100052/354930674-0a59d543-84cc-4d89-9782-a7c18f0f2b0e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..wh7R9N10eNIJ SgWItw5SEuxvoXqsc9mM_lJ1dxqlPbU)

我本地跑了下没啥问题,建议检查下:

  1. 代理配置:docker exec -it lobby-chat cat /etc/proxychains/proxychains.conf
    ![image](https://private-user-images.githubusercontent.com/58100052/354930993-62745239-6884-4e77-b6e3-f2a582a4e885.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 .eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI4MjQ4NDIsIm5iZiI6MTcyMjgyNDU0MiwicGF0aCI6Ii81OD EwMDA1Mi8zNTQ5MzA5OTMtNjI3NDUyMzktNjg4NC00ZTc3LWI2ZTMtZjJhNTgyYTRlODg1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ 09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA1VDAyMjIyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2l nbmF0dXJlPTEzZGIwMTYyOGRiMTAzNTE2MDA5ZGFjOWI3NDZiNzI0N2UyZGE5YzI5MGQ0NGY4OTgyYmI2Yzk5N2FhNGEyYTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma 2V5X2lkPTAmcmVwb19pZD0wIn0.c8SQ3lDJyUBFzfGpyiWYGet5huuKG-6CIC5dMHEdhHI)
  2. DNS 记录:docker exec -it lobe-chat nslookup chat-agents.lobehub.com
    ![image](https://private-user-images.githubusercontent.com/58100052/354930978-d81b8832-03b7-4044-96e7-62ab9847e5ce.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ey Jpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI4MjQ4NDIsIm5iZiI6MTcyMjgyNDU0MiwicGF0aCI6Ii81ODEw MDA1Mi8zNTQ5MzA5NzgtZDgxYjg4MzItMDNiNy00MDQ0LTk2ZTctNjJhYjk4NDdlNWNlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ 09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA1VDAyMjIyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2l nbmF0dXJlPTU0Yjg0OTJiYTMyMzZiMjE0MDBkMzIzMzNiYjliYTRlZmRiODhkMzI0OTQ2YjQ5OWJiZjFjZTY2OTVkMzc0NDQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX 2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.1_OFye7jsN3kXtsa77QNodmFSG7AENsaMBzQxaxaoAM)

我环境所在是云函数

@hezhijie0327
Copy link
Contributor

是腾讯还是阿里云的?

我简单的看了下两个平台的配置,你是通过 VPC 走内网隧道进你的 VPS 中的代理?要么看下 VPS 上 HTTP 或者 Socks 的防火墙开了不,我过会儿如果有空我实际试试

image
image

@lobehubbot
Copy link
Member

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


Is it from Tencent or Alibaba Cloud?

I briefly looked at the configurations of the two platforms. Are you using an intranet tunnel through VPC to access the proxy in your VPS? Either check whether the HTTP or Socks firewall on the VPS is turned on. I will try it later if I have time.

image
image

@yincangshiwei
Copy link
Author

腾讯,是要开启WebSocket?

@lobehubbot
Copy link
Member

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


Tencent, do you want to enable WebSocket?

@hezhijie0327
Copy link
Contributor

假设你的代理客户端安装的位置在腾讯云的 VPS 下且在与云函数位于同一个 VPC 下的话,你可以试试在环境变量中填入 PROXY_URL 然后把 “私有网络” 勾上,然后在部署代理客户端的服务器上放行相关端口,如(ufw allow 7890/tcp
image
image

BTW, 你可以提供下PROXY_URL不,我感觉你可能是在自己电脑上安装了代理客户端,然后在云函数中的环境变量PROXY_URL中填入了电脑本机的IP

anyway 这个目前看来应该不是镜像的问题

@yincangshiwei
Copy link
Author

假设你的代理客户端安装的位置在腾讯云的 VPS 下且在与云函数位于同一个 VPC 下的话,你可以试试在环境变量中填入 PROXY_URL 然后把 “私有网络” 勾上,然后在部署代理客户端的服务器上放行相关端口,如(ufw allow 7890/tcpimage image

BTW, 你可以提供下PROXY_URL不,我感觉你可能是在自己电脑上安装了代理客户端,然后在云函数中的环境变量PROXY_URL中填入了电脑本机的IP

anyway 这个目前看来应该不是镜像的问题

我就是用不上这个代理客户端。所以没填PROXY_URL,正常我用不上代理客户端,不填PROXY_URL就能正常使用才对。

@lobehubbot
Copy link
Member

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


Assuming that your proxy client is installed under Tencent Cloud's VPS and is under the same VPC as the cloud function, you can try filling in PROXY_URL in the environment variable and check "Private Network", and then Release the relevant ports on the server where the proxy client is deployed, such as (ufw allow 7890/tcp) ![image](https://private-user-images.githubusercontent.com/58100052/354975765-277ff5f1-c7f4-4234-9823 -74c6efc985fb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..jaPXDtF9hNdmQgL6v2kksyPZlD3BpbsOZ-72B4Yf0ok) ![image](https://private-user-images.githubusercontent.com/5810005 2/354975474-ac3b30b8-1c69-4db7-a9ff-7c89a6a43b61.png?jwt =eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..VA2kz9pbjHgAqS3Yt0SfwKPn6_dOf_paKd_ACldg5Zs)

BTW, can you provide PROXY_URL? No, I think you may have installed the proxy client on your computer, and then filled in the computer's local IP in the environment variable PROXY_URL in the cloud function.

Anyway, it seems that this is not a mirroring problem at the moment.

I just can't use this proxy client. So I didn't fill in the PROXY_URL. Normally I can't use the proxy client. I can use it normally without filling in the PROXY_URL.

@hezhijie0327
Copy link
Contributor

设计中 PROXY_URL 为空即不添加 Proxychains 参数

PROXYCHAINS="proxychains -q"; \

${PROXYCHAINS} node "/app/server.js";

有一种可能是 云函数 平台 不支持当前 Dockerfile CMD 格式,可能需要将现有的放入单独的 docker-entrypoint.sh

@lobehubbot
Copy link
Member

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


In the design, PROXY_URL is empty, which means no Proxychains parameter is added.

PROXYCHAINS="proxychains -q"; \

${PROXYCHAINS} node "/app/server.js";

There is a possibility that the Cloud Function platform does not support the current Dockerfile CMD format, and the existing one may need to be put into a separate docker-entrypoint.sh?

@yincangshiwei
Copy link
Author

设计中 PROXY_URL 为空即不添加 Proxychains 参数

PROXYCHAINS="proxychains -q"; \

${PROXYCHAINS} node "/app/server.js";

有一种可能是 云函数 平台 不支持当前 Dockerfile CMD 格式,可能需要将现有的放入单独的 docker-entrypoint.sh

我是改成了:CMD ["node", "/app/server.js"],没用 ${PROXYCHAINS} node "/app/server.js";

@lobehubbot
Copy link
Member

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


In the design, PROXY_URL is empty, which means no Proxychains parameter is added.

PROXYCHAINS="proxychains -q"; \

${PROXYCHAINS} node "/app/server.js";

There is a possibility that the Cloud Function platform does not support the current Dockerfile CMD format, and the existing one may need to be put into a separate docker-entrypoint.sh?

I changed it to: CMD ["node", "/app/server.js"], which is useless ${PROXYCHAINS} node "/app/server.js";

@hezhijie0327
Copy link
Contributor

你是在云函数上改的还是更改了 Dockerfile?我去腾讯云上搞个实例试试
image
image
image

@lobehubbot
Copy link
Member

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


Did you change it on the cloud function or the Dockerfile? I'll try to get an instance on Tencent Cloud.
image
image
image

@hezhijie0327
Copy link
Contributor

这个强制下载没搞明白,但是从 CURL fetch 的结果,在不配置任何环境变量时,官方镜像也能直接使用
image

CURL 结果
image
image

image
image

@lobehubbot
Copy link
Member

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


I don’t understand this forced download, but from the results of CURL fetch, the official image can be used directly without configuring any environment variables.
image

CURL results
image
image

image
image

@hezhijie0327
Copy link
Contributor

补一个原始 issue /api/market?locale=zh-CN 的结果
image

@lobehubbot
Copy link
Member

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


Supplement the result of the original issue /api/market?locale=zh-CN
image

@yincangshiwei
Copy link
Author

你是在云函数上改的还是更改了 Dockerfile?我去腾讯云上搞个实例试试 image image image

改dockerfile。你没网关访问不了的,要开个网关并且配置自定义域名。

@lobehubbot
Copy link
Member

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


Did you change it on the cloud function or the Dockerfile? I'll try an instance on Tencent Cloud![image](https://private-user-images.githubusercontent.com/58100052/354991413-e4e6d585-a647-4e20-b5d6-ce3b7ff0bc90.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ 9.. 6rl6vyGGp7iPkWgnAawYbJJIs4W1rEWS9I_CSjj3-_M) ![image](https://private-user-images.githubusercontent.com/58100052/354991517-a5aeac18-363a-4a37-bf87-68e07664bd03.png?jwt= eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..bVMbucm2IOHRI645lydpih_T_04sA7pxZ4lpHARxgzY) ![image] (https://private-user-images.githubusercontent.com/58100052/354991559-99d79550-ed46-4516-8939-cf926cf4f392.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..tg2MJwtUxGtx utcv_dcwl-gDdqFq3YDU6rnap2BBeTo)

Change dockerfile. If you can't access it without a gateway, you need to open a gateway and configure a custom domain name.

@hezhijie0327
Copy link
Contributor

如果是自定义域名的话,我这暂时做不了测试了,但是从fetch 下来的文件看,界面功能都是正常的且未复现 Agent 的 500 错误
image

按照腾讯云文档中的操作是可用的:

dokcer pull lobehub/lobe-chat:latest

docker tag lobehub/lobe-chat:latest ${实例名称}.tencentcloudcr.com/${命名空间}/${名称}:[tag]

docker push ${实例名称}.tencentcloudcr.com/${命名空间}/${名称}:[tag]

@yincangshiwei
Copy link
Author

yincangshiwei commented Aug 5, 2024

${PROXYCHAINS} node "/app/server.js";

它主要问题是,使用${PROXYCHAINS} node "/app/server.js"; 是有问题的,我改成CMD ["node", "/app/server.js"]是没问题。所以如果说,没存在proxy url的话,干脆就不要PROXYCHAINS。

@lobehubbot
Copy link
Member

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


${PROXYCHAINS} node "/app/server.js";

The main problem is that there is a problem with using ${PROXYCHAINS} node "/app/server.js";. I changed it to CMD ["node", "/app/server.js"] and there is no problem.

@hezhijie0327
Copy link
Contributor

主要是现在判定就是不引入啊...

PROXY_URL 为空,则 ${PROXYCHAINS} 为空,即 ${PROXYCHAINS} node "/app/server.js" 等同于 node "/app/server.js"

而且官方镜像,我在云函数平台(上海区域)中运行都正常的... 你要么先试试下面这个方法

dokcer pull lobehub/lobe-chat:latest

docker tag lobehub/lobe-chat:latest ${实例名称}.tencentcloudcr.com/${命名空间}/${名称}:[tag]

docker push ${实例名称}.tencentcloudcr.com/${命名空间}/${名称}:[tag]

你如果有顾虑你改成这个看看,逻辑等同:

CMD \
    if [ -n "$PROXY_URL" ]; then \
        # Set regex for IPv4
        IP_REGEX="^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$"; \
        # Parse the proxy URL
        host_with_port="${PROXY_URL#*//}"; \
        host="${host_with_port%%:*}"; \
        port="${PROXY_URL##*:}"; \
        protocol="${PROXY_URL%%://*}"; \
        # Resolve to IP address if the host is a domain
        if ! [[ "$host" =~ "$IP_REGEX" ]]; then \
            nslookup=$(nslookup -q="A" "$host" | tail -n +3 | grep 'Address:'); \
            if [ -n "$nslookup" ]; then \
                host=$(echo "$nslookup" | tail -n 1 | awk '{print $2}'); \
            fi; \
        fi; \
        # Generate proxychains configuration file
        printf "%s\n" \
            'localnet 127.0.0.0/255.0.0.0' \
            'localnet ::1/128' \
            'proxy_dns' \
            'remote_dns_subnet 224' \
            'strict_chain' \
            'tcp_connect_time_out 8000' \
            'tcp_read_time_out 15000' \
            '[ProxyList]' \
            "$protocol $host $port" \
        > "/etc/proxychains/proxychains.conf"; \
        proxychains -q node "/app/server.js"; \
    else \
        node "/app/server.js"; \
    fi;

@lobehubbot
Copy link
Member

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


The main reason is that it is now decided not to introduce it...

When PROXY_URL is empty, ${PROXYCHAINS} is empty, that is, ${PROXYCHAINS} node "/app/server.js" is equivalent to node "/app/server.js"

And the official image, I run it normally in the cloud function platform (Shanghai area)... You can either try the following method first

dokcer pull lobehub/lobe-chat:latest

docker tag lobehub/lobe-chat:latest ${instance name}.tencentcloudcr.com/${namespace}/${name}:[tag]

docker push ${instance name}.tencentcloudcr.com/${namespace}/${name}:[tag]

If you have concerns, you can change it to this and have a look. The logic is equivalent to:

CMD\
    if [ -n "$PROXY_URL" ]; then \
        # Set regex for IPv4
        IP_REGEX="^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5] |2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$"; \
        # Parse the proxy URL
        host_with_port="${PROXY_URL#*//}"; \
        host="${host_with_port%%:*}"; \
        port="${PROXY_URL##*:}"; \
        protocol="${PROXY_URL%%://*}"; \
        # Resolve to IP address if the host is a domain
        if ! [[ "$host" =~ "$IP_REGEX" ]]; then \
            nslookup=$(nslookup -q="A" "$host" | tail -n +3 | grep 'Address:'); \
            if [ -n "$nslookup" ]; then \
                host=$(echo "$nslookup" | tail -n 1 | awk '{print $2}'); \
            fi;\
        fi;\
        #Generate proxychains configuration file
        printf "%s\n" \
            'localnet 127.0.0.0/255.0.0.0' \
            'localnet ::1/128' \
            'proxy_dns' \
            'remote_dns_subnet 224' \
            'strict_chain' \
            'tcp_connect_time_out 8000' \
            'tcp_read_time_out 15000' \
            '[ProxyList]' \
            "$protocol $host $port" \
        > "/etc/proxychains/proxychains.conf"; \
        proxychains -q node "/app/server.js"; \
    else \
        node "/app/server.js"; \
    fi;

@hezhijie0327
Copy link
Contributor

hezhijie0327 commented Aug 5, 2024

我拿 Cloudflare Workers 写了个让云函数的页面加载的脚本,页面加载和 agent 也正常
image
image

addEventListener( "fetch", ( event ) =>
{
    event.respondWith( handleRequest( event.request ) )
} )

async function handleRequest ( request )
{
    let url = request.url.substr( 8 )
    url = url.substr( url.indexOf( "/" ) + 1 )

    var response = await fetch( "https://1301052320-9mcj2911qu-sh.scf.tencentcs.com/" + url )

    // get headers, then delete Content-Disposition: attachment
    let headers = new Headers( response.headers )
    headers.delete( "Content-Disposition" )

    return new Response( response.body, {
        status: response.status,
        headers: headers
    } )
}

@github-project-automation github-project-automation bot moved this from Roadmap - Chat 1.x to Done in Lobe Chat Routine Aug 5, 2024
@lobehubbot
Copy link
Member

@yincangshiwei

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷
Projects
Archived in project
Development

No branches or pull requests

5 participants