最近也是deepseek大火,小破站流量漫天不想刷都不行。刷到了很多次给机器人加上ai,也是随着deepseek又大火了一把,咱也要跟着潮流就有了这期blog貌似鸽了很久,简述一下博主的体验

0. 部署

0基础部署把算是,可以看看下面的视频教程,大佬很上心,群也很活跃

5分钟部署AI聊天QQ机器人,有手就会,小白狂喜,学习大模型应用的最佳实践,畅通使用全网热门模型

文字版教程

1. 使用

咱也是尝试着把QQ以及微信两个应用都部署了一遍,然后接入了deepseek大模型

什么,你没有在线大模型?

👉看这里,硅基流动14软妹币API

👉再看这里,启航API食用

虽然微信端用的Linux但是也是无脑下一步。

(忽略这个猫娘插件),有比较方便的命令操作,同样也有webUI后台,后台能够直观的看到数据,和对一些参数进行设置,以及安装插件

来到QQ端,其实一样的都是,毕竟都是 LangBot 平台。还有一些插件(略显简陋)。

当然最重要的是ai聊天对话,噗,笑了(被OpenAI策反的deepseek)

2. 开发

这两天一直忙着优化插件和开发插件,选择平台的一大原因应该就是开发插件特别方便,都是调用大佬做好的插件。甚至不需要你特别精通比如我。通过与AI反复交流就可以得到一个满意的插件。比如下面一个简单的Github解析

from pkg.plugin.context import register, handler, llm_func, BasePlugin, APIHost, EventContext
from pkg.plugin.events import *  # 导入事件类
import re
import requests
from pkg.platform.types import *

'''
当收到GitHub仓库链接时,对GitHub链接解析
'''
# 注册插件
@register(name='GitAnalysis', description='当收到GitHub仓库链接时,对GitHub链接解析', version='0.17', author="sheetung")
class GitHubAnalysisPlugin(BasePlugin):
    # 插件加载时触发
    def __init__(self, host: APIHost):
        pass

    @handler(PersonMessageReceived)
    @handler(GroupMessageReceived)
    async def group_normal_message_received(self, ctx: EventContext):
        msg = str(ctx.event.message_chain).strip()
        # 如果msg含有https://github.com/字段则截取仓库信息
        github_match = re.search(r'https://github.com/([\w-]+)/([\w-]+)', msg)
        if github_match:
            owner = github_match.group(1)
            repo = github_match.group(2)
            # 发送仓库名称、描述、仓库链接、星标数、分叉数等信息
            headers = {
                'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36'
            }
            # 获取仓库基本信息
            repo_response = requests.get(f"https://api.github.com/repos/{owner}/{repo}", headers=headers)
            repo_data = repo_response.json()

            # 获取开放的 issue 数量
            issues_response = requests.get(f"https://api.github.com/repos/{owner}/{repo}/issues?state=open", headers=headers)
            open_issues = len(issues_response.json())

            if repo_response.status_code == 200:
                repo_name = repo_data['name']
                repo_description = repo_data['description'] if repo_data['description'] else "暂无描述"
                repo_url = repo_data['html_url']
                stars = repo_data['stargazers_count']
                forks = repo_data['forks_count']

                image_url = ""
                # 构建要发送的信息
                message = []
                if image_url:
                    message.append(Image(url=image_url))
                message.extend([
                    f"仓库名称:{repo_name}\n",
                    f"仓库描述:{repo_description}\n",
                    f"仓库链接:{repo_url}\n",
                    f"starts:{stars}\n",
                    f"forks :{forks}\n",
                    f"issue :{open_issues}\n"
                ])

                # 发送信息
                await ctx.send_message(ctx.event.launcher_type, str(ctx.event.launcher_id), MessageChain(message))
                ctx.prevent_default()
                ctx.prevent_postorder()
            else:
                await ctx.send_message(ctx.event.launcher_type, str(ctx.event.launcher_id), ["仓库信息获取失败"])
                ctx.prevent_default()
                ctx.prevent_postorder()
    
    # 插件卸载时触发
    def __del__(self):
        pass

3. 后记

通过QQ登录不好的一点就是容易掉线