开发者社区 > 通义灵码 > AI编码助手 > 正文

代理网络无法使用灵码,显示账号无权限

已解决

使用环境

软件环境

软件类型软件版本
操作系统Ubuntu 22.04.3 LTS
IDEPyCharm 2023.3.2 (Professional Edition)
灵码版本1.0.10

代理配置

图形化界面代理

图形化界面使用自动代理
image.png

命令行代理

命令行使用http代理
image.png

IDE代理

pycharm使用自动代理
image.png

问题描述

公司网络不能直接连接外网,需要使用代理,但是配置代理后虽然可以登录,但是显示无权限:
image.png

已经测试过但无效方法

使用具有http代理环境变量的终端启动灵码

启动命令:

/home/qianyk/.lingma/bin/1.0.17/x86_64_linux/Lingma start

使用带有环境变量的命令启动灵码

http_proxy=http://proxy.neusoft.com:8080;https_proxy=http://proxy.neusoft.com:8080;/home/qianyk/.lingma/bin/1.0.17/x86_64_linux/Lingma start

日志已经显示识别到了代理,但连接仍然失败

2023-12-28T09:21:15.368+0800 INFO ===== Starting lingma service =====
2023-12-28T09:21:15.369+0800 INFO Init local db success.
2023-12-28T09:21:15.369+0800 INFO start chat sessions clear timer.
2023-12-28T09:21:15.369+0800 INFO Lingma 1.0.17 running on linux(amd64) at /home/qianyk/.lingma
2023-12-28T09:21:15.369+0800 INFO Detect system proxy: http://proxy.neusoft.com:8080
2023-12-28T09:21:15.369+0800 INFO Use system proxy. url: http://proxy.neusoft.com:8080
2023-12-28T09:21:15.369+0800 INFO Info lock obtained
2023-12-28T09:21:15.369+0800 INFO Checking update ...
2023-12-28T09:21:15.369+0800 INFO Preparing inference environment
2023-12-28T09:21:15.369+0800 INFO Inference environment is ready
2023-12-28T09:21:15.369+0800 INFO Starting local java inference service
2023-12-28T09:21:15.369+0800 WARN Cannot start default local service: path error: model file doesn't exist at: /home/qianyk/.lingma/model/0.1.0/java.model
2023-12-28T09:21:15.369+0800 INFO Skip update model, current version: 0.1.0
2023-12-28T09:21:15.369+0800 INFO Succeed to update Cosy model
2023-12-28T09:21:15.493+0800 INFO Succeed to create inference environment
2023-12-28T09:21:15.494+0800 INFO Succeed to update inference env
2023-12-28T09:21:25.396+0800 WARN Failed to parse heartbeat response
2023-12-28T09:21:25.396+0800 INFO Server is ready at: 36510 / 37510
2023-12-28T09:21:28.736+0800 INFO Client 0xc00018c110 is registered
2023-12-28T09:21:28.740+0800 INFO initializing client: 0xc00018c110
2023-12-28T09:21:28.740+0800 INFO Registering IntelliJ IDEA 2023.3.2
2023-12-28T09:21:28.740+0800 INFO Server initialized, time cost: 140.42µs
2023-12-28T09:21:28.740+0800 INFO skip gitignore file: .gitignore doesn't exist
2023-12-28T09:21:28.740+0800 INFO start to index files in workspace: /ntfs1/code-qyk/server-script
2023-12-28T09:21:29.024+0800 INFO index python count:100 nochange:0 walk cost:279
2023-12-28T09:21:29.026+0800 INFO index misc meta count:2 walk cost:0
2023-12-28T09:21:29.026+0800 INFO indexer walk files count:50 ignore:4 walk cost:286
2023-12-28T09:21:35.327+0800 INFO Logging via web
2023-12-28T09:21:35.327+0800 INFO Opening browser to login
2023-12-28T09:21:38.745+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": dial tcp 101.200.166.242:443: i/o timeout (Client.Timeout exceeded while awaiting headers)
2023-12-28T09:21:45.859+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2023-12-28T09:21:45.862+0800 INFO Broadcast 1 clients, 1 success
2023-12-28T09:21:45.862+0800 INFO GET 200 /auth/callback?state=98894121b55448dda16858891b0998b2&auth=uOJf%23%2Cnsc*%29_V%40%23%5EGOjbup%24%24V%5ENIVM%26kjRp%5El%40TYj%5E%26%5EoOC%29V%40VklRBIj%5EpwV%5Ez%25VMNIVfn%25 use time 10.007281176s content-length 1736
2023-12-28T09:21:45.923+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/index.css use time 289.479µs content-length 30585
2023-12-28T09:21:45.925+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/index.js use time 1.883694ms content-length 204069
2023-12-28T09:21:45.926+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/public/code/lib/7.8.3_polyfill.min.js,16.13.1_react.production.min.js,16.13.1_react-dom.production.min.js,4.0.1_redux.min.js,7.2.4_react-redux.min.js,2.3.0_redux-thunk.min.js,2.29.1_moment.min.js,2.29.1_zh-cn.js,0.21.2axios.min.js use time 2.330587ms content-length 334682
2023-12-28T09:21:45.926+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/public/yunxiao-fe/teamix-ui/1.5.27/style/style/yunxiao-v5.min.css use time 4.212442ms content-length 1276537
2023-12-28T09:21:45.927+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/public/yunxiao-fe/teamix-ui/1.5.27/dist/dist/teamix-ui.min.js use time 3.631963ms content-length 1651778
2023-12-28T09:21:46.674+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/downloads/imgextra/i3/O1CN01njVfgg1RAZ82tNnnA
!!6000000002071-55-tps-405-400.svg use time 42.714µs content-length 4515
2023-12-28T09:21:46.686+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/downloads/t/a/font_2460530_m828xxmy33a.js use time 438.96µs content-length 351231
2023-12-28T09:21:46.686+0800 INFO GET 200 /static/yunxiao-fe/cosy-client-assets/0.1.1/downloads/t/a/font_2460517_9rqa0cua6h.js use time 500.004µs content-length 155500
2023-12-28T09:21:55.331+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2023-12-28T09:21:55.871+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2023-12-28T09:21:56.832+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2023-12-28T09:21:57.372+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": dial tcp 101.200.166.242:443: i/o timeout (Client.Timeout exceeded while awaiting headers)
2023-12-28T09:21:58.396+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2023-12-28T09:21:59.898+0800 WARN Failed to send user status request: Get "https://lingma-api.tongyi.aliyun.com/algo/api/v1/user/status?id=1378287443912783": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

使用带有环境变量的命令启动pycharm

启动命令:

http_proxy=http://proxy.neusoft.com:8080;https_proxy=http://proxy.neusoft.com:8080;pycharm1

以上方法均没有效果

请问我要如何解决?

展开
收起
乾与坤 2023-12-28 09:27:12 190 0
1 条回答
写回答
取消 提交回答
  • 采纳回答

    临时解决方案1

    还是要找个能直连外网的服务器

    用iptables做端口转发转发:

    iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 101.200.166.242:443
    iptables -t nat -A POSTROUTING -p tcp -d 101.200.166.242 --dport 443 -j SNAT --to-source 192.168.5.59
    

    101.200.166.242lingma-api.tongyi.aliyun.com解析出来的IP,也就是日志里边连不上的域名。
    192.168.5.59是能连接外网的服务器地址。

    然后在自己电脑上配hosts

    加上如下一行:

    192.168.5.59 lingma-api.tongyi.aliyun.com
    

    最后重新启动灵码进程就能用了。

    临时解决方案2

    前提1:你们公司的代理不太严,支持http隧道
    前提2:你的电脑上不会有443端口监听
    前提3:你有你电脑的root权限

    这次不需要连外网的服务器,直接代理打洞

    使用ncat软件

    #!/bin/bash
    sudo ncat --sh-exec "ncat --proxy proxy.neusoft.com:8080 --proxy-type http lingma-api.tongyi.aliyun.com 443" -l 443 --keep-open >> lingma-ncat.log 2>&1 &
    

    然后依然是在自己电脑上配hosts

    加上如下一行:

    127.0.0.1 lingma-api.tongyi.aliyun.com
    

    最后重新启动灵码进程就能用了。

    2023-12-28 17:03:08
    赞同 展开评论 打赏

基于通义大模型的 AI 编码辅助工具,支持代码智能生成、单元测试生成、问题排查、研发智能问答等功能,为开发者带来高效、流畅的编码体验。

热门讨论

热门文章

相关电子书

更多
Session:更加安全、可靠的数据中心网络产品更新 立即下载
Session:极简易用的全球化网络产品更新 立即下载
Session:弹性、高可用、可观测的应用交付网络产品更新 立即下载