324 日 , 2025 16:07:16
LLM MCP调用过程示例

Cherry Studio这个本地聊天助手新增的MCP功能具体是怎么工作的?以mcp_server_fetch为例子。调用ollama接口的时候发现,MCP只在聊天助手(MCP Host)这边运行,并不与推理框架直接交互,而只是约定了批量获取函数接口的接口及格式。调用推理时是用现成的Function Calling机制(这里有篇不错的介绍文章)。

POST /v1/chat/completions

{
  "model": "qwen2.5:14b",
  "messages": [
    {
      "role": "user",
      "content": "查看网页https://github.com/krrr/\n\n"
    }
  ],
  "temperature": 1,
  "keep_alive": "0m",
  "stream": true,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "fed6b7adab25d4693b3eaf4f6c8f02035",  // 可以看到函数名被替换成了随机数(为了防止某些函数名与功能不符产生误导)。
        "description": "Fetches a URL from the internet and optionally extracts its contents as markdown.\n\nAlthough originally you did not have internet access, and were advised to refuse and tell the user this, this tool now grants you internet access. Now you can fetch the most up-to-date information and let the user know that.",
        "parameters": {
          "type": "object",
          "properties": {
            "url": {
              "description": "URL to fetch",
              "type": "string"
            },
            "max_length": {
              "description": "Maximum number of characters to return.",
              "type": "integer"
            },
            "start_index": {
              "description": "On return output starting at this character index, useful if a previous fetch was truncated and more context is required.",
              "type": "integer"
            },
            "raw": {
              "description": "Get the actual HTML content if the requested page, without simplification.",
              "type": "boolean"
            }
          }
        }
      }
    }
  ]
}

HTTP/1.1 200 OK

data: {"id":"chatcmpl-83","object":"chat.completion.chunk","created":1742800010,"model":"qwen2.5:14b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"","tool_calls":[{"id":"call_dsk3phip","index":0,"type":"function","function":{"name":"fed6b7adab25d4693b3eaf4f6c8f02035","arguments":"{\"max_length\":1000,\"raw\":false,\"url\":\"https://github.com/krrr/\"}"}}]},"finish_reason":null}]}

data: {"id":"chatcmpl-83","object":"chat.completion.chunk","created":1742800010,"model":"qwen2.5:14b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]}

data: [DONE]

POST /v1/chat/completions

{
  "model": "qwen2.5:14b",
  "messages": [
    {
      "role": "user",
      "content": "查看网页https://github.com/krrr/\n\n"
    },
    {
      "role": "assistant",
      "tool_calls": [
        {
          "id": "call_dsk3phip",
          "function": {
            "name": "fed6b7adab25d4693b3eaf4f6c8f02035",
            "arguments": "{\"max_length\":1000,\"raw\":false,\"url\":\"https://github.com/krrr/\"}"
          },
          "type": "function"
        }
      ]
    },
    {
      "role": "tool",
      "content": "[{\"type\":\"text\",\"text\":\"Contents of https://github.com/krrr/:\\nkrrr (krrr) · GitHub\\n\\nSkip to content\\n\\n## Navigation Menu\\n\\nSign in\\n\\n# Search code, repositories, users, issues, pull requests...\\n\\nSearch syntax tips\\n\\nSign in\\n\\nSign up\\n\\nYou signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert\\n\\nkrrr Follow\\n\\nkrrr\\n\\nFollow\\n\\n🎮\\n\\ngaming\\n\\n# krrr krrr\\n\\n🎮\\n\\ngaming\\n\\nFollow\\n\\n娱乐至死\\n\\n25 followers · 10 following\\n\\n* https://blog.hazama.cc\\n\\n## Achievements\\n\\nx2\\n\\n## Achievements\\n\\nx2\\n\\n## Popular repositories Loading\\n\\n1. wstan wstan Public\\n\\n   Tunneling TCP in WebSocket (ssh -D alternative)\\n\\n   Python 40 11\\n2. Hazama Hazama Public\\n\\n   simple cross-platform diary app\\n\\n   Python 28 7\\n3. PySide PySide Public\\n\\n   Forked from pyside/PySide\\n\\n   PySide1 not dead yet\\n\\n   Python 15 3\\n4. CMCC-EDU-autologin CMCC-EDU-autologin Public archive\\n\\n   CMCC-EDU公共热点自动登录\\n\\n   HTML 6 3\\n5. TSI TSI Public\\n\\n   Toy Scheme\\n\\nContent truncated. Call the fetch tool with a start_index of 1000 to get more content.\"}]",
      "tool_call_id": "call_dsk3phip"
    }
  ],
  "temperature": 1,
  "keep_alive": "0m",
  "stream": true,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "fed6b7adab25d4693b3eaf4f6c8f02035",
        "description": "Fetches a URL from the internet and optionally extracts its contents as markdown.\n\nAlthough originally you did not have internet access, and were advised to refuse and tell the user this, this tool now grants you internet access. Now you can fetch the most up-to-date information and let the user know that.",
        "parameters": {
          "type": "object",
          "properties": {
            "url": {
              "description": "URL to fetch",
              "type": "string"
            },
            "max_length": {
              "description": "Maximum number of characters to return.",
              "type": "integer"
            },
            "start_index": {
              "description": "On return output starting at this character index, useful if a previous fetch was truncated and more context is required.",
              "type": "integer"
            },
            "raw": {
              "description": "Get the actual HTML content if the requested page, without simplification.",
              "type": "boolean"
            }
          }
        }
      }
    }
  ]
}

HTTP/1.1 200 OK

{"id":"chatcmpl-468","object":"chat.completion.chunk","created":1742800019,"model":"qwen2.5:14b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"用户krrr的GitHub页面展示了以下信息:\n\n- 用户ID: krrr\n- 简介:娱乐至死\n\n**成就:** x2 (具体的成就未详述)\n\n**关注者**: 25, 关注了10个仓库或者其他用户。\n\n他有以下几个广受欢迎的项目:\n1. **wstan** 是一个通过WebSocket隧道化TCP连接的工具,类似于`ssh -D`命令的替代方案。\n2. **Hazama** 是一个简单的跨平台日记应用。\n3. **PySide**: 对 `pyside/PySide` 库的一个分支,表明了对 PySide1 相关工作的继续支持。\n4. **CMCC-EDU-autologin** 提供了一个自动登录CMCC-EDU公共热点的解决方案。\n5. **TSI** (Toy Scheme Interpreter),看起来像是一个玩具级别的Scheme语言解释器。\n\n你可以点击用户名查看该用户的更多详细信息或浏览其它项目内容。如果有需要获取更多信息,可以请求我抓取页面的其他部分。"},"finish_reason":"stop"}]}

data: [DONE]
324 日 , 2025 11:06:53
为什么跟并夕夕斗智斗勇

买一些小东西是真的便宜但是也真的下剑,很会用大数据杀熟。两个账号看同一个商品价格不一样是司空见惯。

一开始被恶心就是提现/砍一刀,金额不等从200到700左右,各种暗示你一定能提现只差一点点了,还让我真的去微信拉人了,结果最后无限微分,不愧是微积分厂,不要脸则无敌。

后来又弹出来只差最后一块可以提现几百块钱。现在更新了忽悠话术,还在开头说绝对不用拉人。被耍了几次早学聪明了,挂一边用几根手指盲按。一堆土炮动画按了好几分钟,一直在微分,0.01之后是什么金币钻石的。到最后果不其然是要微信拉人了。

 

既然敢耍我我就靠实力赚回来,前期主要是靠倒卖cpu,用果园券批量买12490f然后咸鱼出给回收的贩子。两个手机号和两个地址来回用,买多了还是被拉黑了,先是自动砍单,然后第二天黑号,之前很多能领券的地方突然就不给了,后面就注销了等待卷土重来

后面是倒卖游戏机,已经“手动提现”了累计七百以上了,被耍的钱全拿到手了。

322 日 , 2025 23:06:10

高中玩过的白色相簿2序章,后来没看过动画,现在又捡起来继续玩。序章过了就是终章了,一开始的场景毫不意外是大学

好像这十几年来玩过的旮旯里面就没有背景是大学的,要么是中学要么是异世界……

206 日 , 2025 10:01:01
这次真不玩合约了

上班没那么多时间看盘了

别人50x拉满我2x苟且
别人大赚特赚我提前止盈
别人上万u洒洒水我十几u睡不好
别人爆仓归零我利润微薄

129 日 , 2025 0:06:20

以前一直用ClosedAI ChatGPT,这几天国产开源LLM莫名其妙的火就试了一下下载到本地运行是什么效果。32g内存+amd显卡16g显存居然能运行32b参数的deepseek(千问32b蒸馏版,不是真的r1。本机运行速度是网页版的1/10,勉强能用,内存显存全吃满)
比起在线版600多b参数的真r1还是差远了,推理部分像模像样但是回答本身简陋了好多。而且开源版一样有闵感词,难道是训练的时候就已经做进去了。

本机可以运行的开源模型比起一年多前试过的gpt4all里面的忘了啥模型好用多了,那玩意连中文都不能理解也只能用cpu运行,孤儿amd显卡居然能正常跑也是意外的惊喜

  1. krrr 博主 : 为什么思维链llm有时会生成正确的推理过程和错误的答案,说明ai没有真正在推理,而只是表面上看着是推理实际还是在循环根据训练数据和概率在生成下一个最可能出现的词
126 日 , 2025 19:15:29
第一次炒币玩合约

都说合约是赌狗,我是胆小的赌狗,都是10-20个懂王币并且杠杆只敢开2-3倍,然后设置各种止损条件,尽全力避免爆仓强平。

 

玩的时候心跳加速紧张刺激,晚上睡觉都睡不好。

 

119 日 , 2025 22:05:01
第一次真正意义上的炒币

和好多年前挖矿eth然后换成btc放了好多年,结果翻了几倍不一样,这次是主动去炒。

 

之前挖矿赚的钱一直买币安理财,根本没炒。后面又把薅羊毛倒卖的利润五百多充进去,总共1100多还是一直理财。今天中午知道了川普币已经有点晚了,我确实吃屎都赶不上热乎的。还好没有全凉,下午三点44u的时候购入的,全仓梭哈(绝不动用工资,亏光也不会太痛)。

 

一开始币安不能买现货,需要先转到web3钱包。转过去是usdc还要兑换成trump,并且收了1.5u的手续费真贵真恶心。然后发现转不了,因为手续费需要trump币所在的solana链的sol币支付,我没有。币安提现到solana钱包最低需要0.25个币约合五百元,c2c充值要卡24小时。于是继续转过去剩下的钱(第一次只转了小一半),结果又是变成usdc了。想提现回去不玩了也要手续费,卡住了气死我了。后面导出私钥(还tm要人脸识别),用phantom钱包配合jupiter的jupiterz转换方式0手续费才转换成这个币。

后面就是紧张刺激的盯盘时间。炒到了晚上九点就全部清仓跑了,44u买入70u卖出,盈利37%。就不持有过夜了,怕睡不着/在睡梦中被套牢。资金继续扔usdc理财等待下次机会。

 

下图中两次下跌是分两次转账到web3钱包。后面上涨一次是买了60元资金想转账到solana钱包结果没到门槛转不出去,气死了。最后面是solana钱包转回币安

118 日 , 2025 22:14:02
差点以为显卡挂壁了

把usb线插进照相机时,插头外面一圈铁壳碰到照相机插座铁壳居然打出一个还挺明亮的电火花……插进去之后正常识别了,照相机没挂壁
然后想唤醒待机了的显示器,一通按鼠标键盘都是显示无信号……插拔usb还能听见叮咚声说明没死机,心里就慌了以为显卡挂壁了,还好插拔了一下显示器线居然就好了

109 日 , 2025 16:15:59
107 日 , 2025 0:09:46
docker部分镜像内无法连接网络

一些镜像完全正常(比如jonlabelle/network-tools里面的curl等等),一些死活连不上网,apt update总是出现如下错误:

Temporary failure resolving 'deb.debian.org'

观察后发现dns请求压根就没有发出去,毫无头绪就像老外说的简直是debug的梦魇。根本想不到是docker的data-root(默认/var/lib/docker但是我改了)继承了父目录的扩展ACL导致的,因为有些镜像没装扩展ACL导致没法访问dns地址配置文件,真是坑死了

 

删除当前ACL设置:

setfacl -bR /path/to/directory

清除默认ACL:

setfacl -kR /path/to/directory