2024年10月12日星期六

Override 搭配 DeepSeek Coder 详细搭建过程,Docker、本地编译方式

 文章引用:https://linux.do/t/topic/160633

部署方式

使用 docker、本地搭建,Vscode、JetBrains 等,Chat、代码补全都正常使用

克隆项目

git clone https://github.com/linux-do/override.git

docker compose

配置文件路径:我的位置是 /data/override/config.json

  1. 将 Override 配置写入文件中

    vim /data/override/config.json
  2. 修改docker-compose.yaml 的配置文件路径

    services:
      override-app:
        image: linux-do/override:latest
        container_name: override-app
        restart: always
        build:
            context: .
            dockerfile: Dockerfile
        volumes:
          - /data/override/config.json:/app/config.json
        ports:
    		"8181:8181"
  3. 部署项目

    docker compose up -d docker compose ps

本地编译

支持所有平台 (Windows、Linux、Mac),下面使用Windows说明

  1. 准备工作,系统需要安装 golang >= 1.21 (低于该版本需要修改 go.mod)
  2. 克隆 override 到本地
  3. 编译 override
    cd override go mod tidy go build .
  4. 编译完成后,会在override目录下生成一个可执行文件 override.exe
  5. 新建配置文件 config.json,放在override目录下
  6. 双击启动 override.exe 即可

Override 配置

auth_token 貌似有些问题,请求为404。有成功的大佬可以留言帮助一下我。

{ "bind": "0.0.0.0:8181", "proxy_url": "", "timeout": 600, "codex_api_base": "https://api.deepseek.com/beta/v1", "codex_api_key": "sk-xxxx", "codex_api_organization": "", "codex_api_project": "", "codex_max_tokens": 500, "code_instruct_model": "deepseek-coder", "chat_api_base": "https://api.deepseek.com/beta/v1", "chat_api_key": "sk-xxx", "chat_api_organization": "", "chat_api_project": "", "chat_max_tokens": 4096, "chat_model_default": "deepseek-coder", "chat_model_map": {}, "chat_locale": "zh_CN", "auth_token": "" }

Vscode Copilot配置

"github.copilot.advanced": { "debug.overrideCAPIUrl": "http://ip:端口/v1", "debug.overrideProxyUrl": "http://ip:端口", "debug.chatOverrideProxyUrl": "http://ip:端口/v1/chat/completions", "authProvider": "github-enterprise" }, "github-enterprise.uri": "https://cocopilot.org",

JetBrains 注意事项

注意:Github Copilot 插件版本为 <=1.5.8.5775

方式一:ja-netfilter 配合 env.jar 插件替换环境变量(推荐)

env.conf 配置如下:

[ENV] PREFIX,AGENT_DEBUG_OVERRIDE_CAPI_URL=http://你的ip:8181/v1 PREFIX,AGENT_DEBUG_OVERRIDE_PROXY_URL=http://你的ip:8181 PREFIX,GITHUB_COPILOT_OVERRIDE_CAPI_URL=http://你的ip:8181/v1 PREFIX,GITHUB_COPILOT_OVERRIDE_PROXY_URL=http://你的ip:8181
 方式二:脚本替换环境变量(不推荐)


3. 登录Copilot插件:

复制并访问Github


浏览器中直接粘贴刚刚的代码

点击Continue即可跳转Linux Do的授权页面,点击授权就可以登录成功。
同样的,Copilot Chat 插件也会自动提示,再按照上面的步骤登录一遍即可。然后就可以和你的DeepSeek愉快的玩耍了。

2024年10月8日星期二

如何在openwrt中使用Nginx并支持stream

 1、编译openwrt的时候,选择nginx-full,还要选择 nginx-mod-stream。

2、编译完成后。需要编辑openwrt的/etc/config/nginx文件,设置:

config main global
option uci_enable 'false'
这样,就不如nginx由uci控制。实现和ubuntu的nginx相同的使用方式了。
3、在/etc/nginx/下新增nginx.conf文件,并编辑内容:
load_module /usr/lib/nginx/modules/ngx_stream_module.so;
events {
    worker_connections 1024;
}
stream {
    upstream proxy_backend {
        server 127.0.0.1:80;

    }

    # 处理 UDP 流量
    server {
        listen 12345 udp;
        proxy_pass proxy_backend;
    }

    # 处理 TCP 流量
    server {
        listen 12345;  # 不需要 "tcp",默认是 TCP
        proxy_pass proxy_backend;
    }
}
上面这条load_module /usr/lib/nginx/modules/ngx_stream_module.so;是一定需要的。可以用ls /usr/lib/nginx/modules/ngx_stream_module.so检查文件是否存在。
4、配置好了,通过:
/etc/init.d/nginx reload
/etc/init.d/nginx restart
进行重启。



安装 PaddleOCR的方法

  安装飞桨版本:https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/windows-pip.html 命令:  python -m pip...