Hermes + Qwen 的配置方法

概述

由于 Hermes 和 Qwen 有点八字不合,所以需要加入代理去做请求的转换处理

代理脚本

js 复制代码
const express = require('express');
const axios = require('axios');

const app = express();
const PORT = 8081;
const ALIBABA_API_KEY = 'sk-60cd20c34e2446c8a5985d1f86017333';
const ALIBABA_BASE_URL = 'https://dashscope.aliyuncs.com/compatible-mode/v1';

app.use(express.json());

app.post('/v1/chat/completions', async (req, res) => {
    const isStream = req.body.stream === true;
    
    try {
        const alibabaRequest = {
            model: req.body.model || 'qwen3.6-plus',
            messages: req.body.messages,
            temperature: req.body.temperature ?? 0.7,
            max_tokens: req.body.max_tokens ?? 2000,
            stream: isStream  // 透传 stream 参数
        };
        
        const response = await axios({
            method: 'POST',
            url: `${ALIBABA_BASE_URL}/chat/completions`,
            headers: {
                'Content-Type': 'application/json',
                'Authorization': `Bearer ${ALIBABA_API_KEY}`
            },
            data: alibabaRequest,
            responseType: isStream ? 'stream' : 'json'
        });
        
        if (isStream) {
            // 流式响应:直接转发
            res.setHeader('Content-Type', 'text/event-stream');
            res.setHeader('Cache-Control', 'no-cache');
            res.setHeader('Connection', 'keep-alive');
            response.data.pipe(res);
        } else {
            // 非流式响应
            res.json(response.data);
        }
        
    } catch (error) {
        console.error('Error:', error.message);
        res.status(500).json({ error: error.message });
    }
});

app.listen(PORT, () => {
    console.log(`Proxy running on http://localhost:${PORT}`);
});

运行代理

复制代码
node .\proxy.js

运行 hermes

复制代码
hermes

Windows 下的特别处理

建议在 PowerShell 下执行

hermes chat -q "who are you"

hermes 常用指令

arduino 复制代码
hermes config set model.base_url http://localhost:8080/v1
hermes config set model.provider custom
hermes config set model.api_key 你的apikey
hermes config set model.default qwen3.6-plus

hermes config set model.default qwen3-coder-next
相关推荐
sweet丶8 小时前
移动端轻量级AI Agent自动化UI验证:sim-use
ai编程
东小西8 小时前
第7篇:《工具的USB接口:我把Function Calling升级成了MCP》
openai·ai编程
腻害兔9 小时前
【若依项目-产品经理视角】RuoYi-Vue-Pro 源码拆解:CRM 客户关系模块深度解析——从线索到回款,一套完整的 B2B 销售闭环是怎么搭的?
java·前端·javascript·vue.js·产品经理·ai编程
大数据点灯人10 小时前
【AI编程】Vibe Coding 模型选型:越贵越好吗?效果/速度/成本平衡指南
编程·ai编程·claude·codex·vibe coding
oort12310 小时前
吃上了自家的细糠,还挺丝滑,用起来手感还行,OortCloud发布新版AI编程平台,下载 OortCodex,Token多,免费薅
大数据·开发语言·人工智能·ai编程
小虎AI生活11 小时前
WorkBuddy 自动化实战,TTS 配音从安装到跑通
ai编程
小虎AI生活12 小时前
workbuddy 短视频获客的终极形态,不是做内容,是建工厂
ai编程
钱六两13 小时前
#5、Spring AI Tool Calling 深度解读(从概念>原理>定义工具>使用工具>核心接口剖析)
ai编程
AI分享猿14 小时前
重度长上下文开发怎么选?先看缓存是否吃额度
缓存·ai编程
亦暖筑序14 小时前
AgentScope-Java 入门:用 Middleware 审计 Agent 调用
java·ai编程·agentscope