初学大模型部署以及案例应用(windows+wsl+dify+mysql+Ollama+Xinference)

news2025/6/4 11:50:52

大模型部署以及案例应用(windows+wsl+dify+mysql+Ollama+Xinference)

  • 1.wsl 安装
    • ①安装wsl
    • ②测试以及更新
    • ③安装Ubuntu系统
      • 查看系统以及版本
      • 安装Ubuntu系统
      • 进入Ubuntu系统
  • 2、docker安装
    • ①下载安装包
    • ②安装
    • ③docker配置
  • 3、安装dify
    • ①下载dify
    • ②安装
    • ③生成.env 配置文件
    • ④安装dify
    • ⑤打开dify
  • 4.安装ollama
    • ①下载ollama
    • ②安装ollama
    • ③搜索模型
    • ④下载模型
    • ⑤运行模型
  • 5、dify与ollama模型对接
  • ①在dify安装ollama
    • ②配置模型
  • 6、安装conda
    • ①选择对应的版本进行下载。
    • ②修改配置和环境变量
  • 7、安装配置Xinference
    • ①在cmd创建conda环境
    • ②安装相关依赖
    • ③进行安装以及启动
      • 安装
      • 启动
      • xinference启动效果:
    • ④启动模型
    • ⑤xinference与dify对接
      • 安装xinference
      • 添加模型
  • 8、插件的应用
    • 我使用的一些插件
    • 插件下载与安装
      • 也可以通过dify的marketplace直接安装,我测试下载之后安装要快很多。
  • 9、应用
    • ①生成工具
      • 创建工作流
      • dify发布为工具
      • 补充
    • ②工作流
      • 测试效果
      • 用户表结构
  • 10 总结
      • 模型里的SYSTEM 示例

1.wsl 安装

①安装wsl

控制面板–程序–打开启用或关闭windows功能-勾选“使用于Linux的Windows子系统”
打开启用或关闭windows

②测试以及更新

打开cmd,输入wsl --update,若出现“已安装最新版本的适用于 Linux 的 Windows 子系统。”,则无需更新,否则自动更新
在这里插入图片描述

③安装Ubuntu系统

查看系统以及版本

在这里插入图片描述

安装Ubuntu系统

在cmd里面输入:wsl --install -d Ubuntu-24.04 进行安装
在这里插入图片描述

进入Ubuntu系统

方式一:在Windows系统开始搜索Ubuntu-22.04,点击系统管理运行进入
方式二:在CMD里面执行 wsl -d Ubuntu-22.04 进入
在这里插入图片描述

2、docker安装

①下载安装包

去https://www.docker.com/下载exe的安装包

②安装

在CMD里面执行"D:\AI\Docker\Docker Desktop Installer.exe" install --installation-dir=“D:\Docker”,我制定了安装目录的。
在这里插入图片描述

③docker配置

docker一般需要配置两个:
一个是镜像存放位置,二是docker引擎

在这里插入图片描述
在这里插入图片描述

{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "default-runtime": "nvidia",
  "experimental": false,
  "registry-mirrors": [
    "https://docker-0.unsee.tech",
    "https://docker.1ms.run",
    "https://hub.rat.dev",
    "https://docker.1panel.live",
    "https://hub.rat.dev",
    "https://proxy.1panel.live",
    "https://ghcr.nju.edu.cn",
    "https://docker.registry.cyou",
    "https://dockercf.jsdelivr.fyi",
    "https://docker.rainbond.cc",
    "https://registry.cn-shenzhen.aliyuncs.com",
    "https://dockertest.jsdelivr.fyi",
    "https://mirror.aliyuncs.com",
    "https://mirror.baidubce.com",
    "https://docker.mirrors.ustc.edu.cn",
    "https://docker.mirrors.sjtug.sjtu.edu.cn",
    "https://mirror.iscas.ac.cn",
    "https://docker.nju.edu.cn",
    "https://docker.m.daocloud.io",
    "https://dockerproxy.com",
    "https://docker.jsdelivr.fyi",
    "https://docker-cf.registry.cyou",
    "https://hub.docker.com/"
  ],
  "runtimes": {
    "nvidia": {
      "path": "nvidia-container-runtime",
      "runtimeArgs": []
    }
  }
}

3、安装dify

①下载dify

下载地址:https://gitcode.com/gh_mirrors/di/dify

②安装

先解压,然后进入安装目录,例如我的进入指令:cd/d E:\dify-main\docker
在这里插入图片描述

③生成.env 配置文件

dify默认端口是80,如果要修改,则修改.env里面的NGINX_PORT=80 和 EXPOSE_NGINX_PORT=80 两个端口号
在这里插入图片描述

④安装dify

在这里插入图片描述

⑤打开dify

如果默认是80端口,则输入127.0.0.1或者localhost都可以打开
在这里插入图片描述

4.安装ollama

①下载ollama

在https://ollama.com/download进行下载

②安装ollama

安装到其他盘,可以参照:windows部署deepseek与dify

③搜索模型

可以在https://ollama.com/search,进行查找模型,并复制模型名称。
在这里插入图片描述
在这里插入图片描述

④下载模型

在cmd输入:ollama run deepseek-r1:7b,
注意:
大一些的模型对显卡要求比较高,下载后如果满足不了最低要求,则运行不了。
下载模型可以中断,下次输入下载指令可以继续下载
在这里插入图片描述

⑤运行模型

运行模型治理跟下载一样:ollama run deepseek-r1:7b
在这里插入图片描述
查看ollama其他指令可以输入:ollama -h
在这里插入图片描述

5、dify与ollama模型对接

注意docker、Ubuntu、ollama需运行起来

①在dify安装ollama

点击用户头像,点击设置–模型供应商,搜索ollama,并进行安装ollama
在这里插入图片描述
在这里插入图片描述

②配置模型

在模型供应商选择ollama,点击添加模型

http://host.docker.internal:11434

在这里插入图片描述
在这里插入图片描述
模型的类型是根据图标识选择的
在这里插入图片描述

6、安装conda

①选择对应的版本进行下载。

下载地址:ttps://www.anaconda.com/download/success
下载完成之后双击运行.exe文件,然后下一步就行,安装完成之后,进行系统环境变量配置。

②修改配置和环境变量

编辑path系统变量,根据实际安装路径进行配置:

E:\anaconda3
E:\anaconda3\Scripts 
E:\anaconda3\Library\mingw-w64\bin
E:\anaconda3\Library\bin

打开cmd命令窗口,输入 conda --version命令,验证是否配置成功。若成功则会显示具体的版本号。修改Anaconda默认环境保存路径和镜像源:
在C:\Users\Dynasty,找到.condarc,
删除原先内容,进行以下配置。

envs_dirs:
  - E:\Anaconda_envs\envs
pkgs_dirs:
  - E:\Anaconda_envs\pkgs
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - https://repo.anaconda.com/pkgs/msys2
  - defaults
show_channel_urls: true

在命令窗口中执行conda info命令,我们就可以看到修改后的配置。
在这里插入图片描述

7、安装配置Xinference

参考了Windows下安装部署Xinference

①在cmd创建conda环境

conda create xinference
conda activate xinference

②安装相关依赖

conda install python=3.12
conda install nodejs
pip install torch
在这里插入图片描述

③进行安装以及启动

安装

pip install xinference[all]  -i https://pypi.tuna.tsinghua.edu.cn/simple

指定镜像 -i https://pypi.tuna.tsinghua.edu.cn/simple
在这里插入图片描述

启动

xinference-local --host 192.168.0.104 --port 9997

不要用0.0.0.0,启动会报错,192.168.0.104为本机ip地址
在这里插入图片描述

xinference启动效果:

在这里插入图片描述

④启动模型

选择你需要的模型,点击启动
在这里插入图片描述

⑤xinference与dify对接

参照第5点打开方式

安装xinference

在这里插入图片描述

添加模型

在这里插入图片描述
说明:为什么要安装xinference,dify没有
在这里插入图片描述
这一类的模型。

8、插件的应用

我使用的一些插件

注意database插件的注册链接:

mysql+pymysql://root:root@168.192.0.107:3306/ssm

在这里插入图片描述

插件下载与安装

通过插件下载网址 下载插件
下载后通过安装插件–本地插件–选择插件进行安装
在这里插入图片描述

也可以通过dify的marketplace直接安装,我测试下载之后安装要快很多。

在这里插入图片描述

9、应用

①生成工具

创建工作流

在这里插入图片描述

dify发布为工具

注意:里面的流程是根据实际情况进行操作!有一些人通过这儿设置数据查询工具,然后引入到agent里面,会报错。
在这里插入图片描述

注意:里面的流程是根据实际情况进行操作!有一些人通过这儿设置数据查询工具,然后引入到agent里面,会报错。
一般分为几种情况:
一是:模型太小的原因
二是:引入的知识库的原因
三是:提示词的原因,提示词要越详细越好
四是:没有对引入的对话进行清洗和过滤,因为数据查询仅仅是查询sql,而不包含其他文字性内容
五是:就是我也没有找到原因(有知道的朋友,可以告诉我一下),工具单独测试没有问题

{"data_query": "tool invoke error: Instance <Account at 0x71e62cd38dd0> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: https://sqlalche.me/e/20/bhk3)"}

在这里插入图片描述

在这里插入图片描述

补充

采用现有的database.SQL Execute插件,可以查询出来数据。
在这里插入图片描述
说明:
0-0数据字典为表结构
0-0 提示词用AI实时查询数据库

【角色设定】
您是一位资深数据库专家,擅长根据业务需求将自然语言精准转换为符合规范的SQL语句。您具有以下核心能力:
1. 精通关系型数据库设计,尤其熟悉MySQL语法
2. 深入理解当前业务系统的表结构
[上下文]
3. 能准确识别业务需求中的隐藏条件
4. 熟悉SQL性能优化和事务控制

【输入处理流程】
1. 结构确认:先验证涉及的表是否存在,检查字段名是否准确
2. 关联分析:确认多表关联时的连接条件是否正确
3. 条件推导:将模糊的业务描述转化为精确的WHERE条件
4. 异常处理:识别可能存在的逻辑矛盾或性能陷阱

【输出要求】
输出sql中不要添加任何注释信息
采用如下格式返回结果:
[符合ANSI标准的SQL语句]
根据输出的SQL,例如:
select * from users
调用工具查询数据,并返回结果

②工作流

根据DY设置的一个工作流
在这里插入图片描述

测试效果

在这里插入图片描述
以下是工作的yml文件内容,新建空白yml文件,拷贝代码并放入里面保存。在diy进行引入即可
在这里插入图片描述

app:
  description: 测试模型
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: advanced-chat
  name: 模型测试
  use_icon_as_answer_icon: false
dependencies:
- current_identifier: null
  type: marketplace
  value:
    marketplace_plugin_unique_identifier: langgenius/ollama:0.0.6@7d66a960a68cafdcdf5589fdf5d01a995533f956853c69c54eddcf797006fa37
- current_identifier: null
  type: package
  value:
    plugin_unique_identifier: jaguarliuu/rookie_text2data:0.3.0@59a0ef957f535edcc661369a3edc3894ce4cd8b8063b296b699ff55c5f6d262d
- current_identifier: null
  type: package
  value:
    plugin_unique_identifier: jaguarliuu/rookie_data_alchemy:0.0.4@2be34d32b23be1a447f7822b77dc54462155710ab1cd38d118e562fddbc13cdc
- current_identifier: null
  type: package
  value:
    plugin_unique_identifier: bowenliang123/md_exporter:1.4.100@71e015c278af8ae41b80f88a72f03ef92ad01b8db0c3676eafd3f998c4d57601
kind: app
version: 0.3.0
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      allowed_file_extensions:
      - .JPG
      - .JPEG
      - .PNG
      - .GIF
      - .WEBP
      - .SVG
      allowed_file_types:
      - image
      allowed_file_upload_methods:
      - local_file
      - remote_url
      enabled: false
      fileUploadConfig:
        audio_file_size_limit: 50
        batch_count_limit: 5
        file_size_limit: 15
        image_file_size_limit: 10
        video_file_size_limit: 100
        workflow_file_upload_limit: 10
      image:
        enabled: false
        number_limits: 3
        transfer_methods:
        - local_file
        - remote_url
      number_limits: 3
    opening_statement: ''
    retriever_resource:
      enabled: true
    sensitive_word_avoidance:
      enabled: false
    speech_to_text:
      enabled: false
    suggested_questions: []
    suggested_questions_after_answer:
      enabled: false
    text_to_speech:
      enabled: false
      language: ''
      voice: ''
  graph:
    edges:
    - data:
        sourceType: start
        targetType: llm
      id: 1748696326544-llm
      source: '1748696326544'
      sourceHandle: source
      target: llm
      targetHandle: target
      type: custom
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: llm
        targetType: tool
      id: llm-source-1748696528530-target
      source: llm
      sourceHandle: source
      target: '1748696528530'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: tool
        targetType: tool
      id: 1748696528530-source-1748696624432-target
      source: '1748696528530'
      sourceHandle: source
      target: '1748696624432'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: tool
        targetType: if-else
      id: 1748696624432-source-1748696664775-target
      source: '1748696624432'
      sourceHandle: source
      target: '1748696664775'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: if-else
        targetType: llm
      id: 1748696664775-true-1748696729922-target
      source: '1748696664775'
      sourceHandle: 'true'
      target: '1748696729922'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: llm
        targetType: llm
      id: 1748696729922-source-1748696811184-target
      source: '1748696729922'
      sourceHandle: source
      target: '1748696811184'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: llm
        targetType: tool
      id: 1748696811184-source-1748696899575-target
      source: '1748696811184'
      sourceHandle: source
      target: '1748696899575'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: tool
        targetType: answer
      id: 1748696899575-source-answer-target
      source: '1748696899575'
      sourceHandle: source
      target: answer
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: if-else
        targetType: llm
      id: 1748696664775-6f64ec9a-f939-412f-b673-2bc1a852d5ce-1748697147705-target
      source: '1748696664775'
      sourceHandle: 6f64ec9a-f939-412f-b673-2bc1a852d5ce
      target: '1748697147705'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: llm
        targetType: tool
      id: 1748697147705-source-1748697966459-target
      source: '1748697147705'
      sourceHandle: source
      target: '1748697966459'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: tool
        targetType: answer
      id: 1748697966459-source-1748698000525-target
      source: '1748697966459'
      sourceHandle: source
      target: '1748698000525'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: if-else
        targetType: llm
      id: 1748696664775-false-1748698025100-target
      source: '1748696664775'
      sourceHandle: 'false'
      target: '1748698025100'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: llm
        targetType: answer
      id: 1748698025100-source-1748698346189-target
      source: '1748698025100'
      sourceHandle: source
      target: '1748698346189'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 开始
        type: start
        variables: []
      height: 53
      id: '1748696326544'
      position:
        x: 30
        y: 361.5
      positionAbsolute:
        x: 30
        y: 361.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        context:
          enabled: false
          variable_selector: []
        desc: ''
        memory:
          query_prompt_template: '{{#sys.query#}}'
          role_prefix:
            assistant: ''
            user: ''
          window:
            enabled: false
            size: 10
        model:
          completion_params: {}
          mode: chat
          name: qwen2.5vl:7b
          provider: langgenius/ollama/ollama
        prompt_template:
        - id: 48eac4f7-06d7-4a91-b28d-112d00f9bbf0
          role: system
          text: "#角色\n你是一位文字提炼专家\n#任务\n负责把用户的查询数据需求进行提炼和总结,抓取关键数据查询文字,去掉和数据查询无关的内容,只保留提炼查询数据的文字\n\
            #输出\n注意事项:\n所有非聚合字段必须出现在GROUP BY中,只输出SQL语句,不要解释。输出示例:\n查询用户信息:\nselect\
            \  *  from users\n查询用户数:\nselect  count(1) from users\n查询大于22岁的用户:\n select\
            \  * from users where age>22\n查询用户的姓名:\nselect name from users\n统计年龄大22岁的人数:\n\
            select count(1) from users where age>22\n统计绿色指标表以及指标总得分:\nselect oname,sum(score)\
            \ from green_item group by oname"
        selected: false
        title: LLM
        type: llm
        variables: []
        vision:
          enabled: false
      height: 89
      id: llm
      position:
        x: 333
        y: 361.5
      positionAbsolute:
        x: 333
        y: 361.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        answer: '{{#1748696899575.text#}}'
        desc: ''
        selected: false
        title: 直接回复
        type: answer
        variables: []
      height: 104
      id: answer
      position:
        x: 2454
        y: 361.5
      positionAbsolute:
        x: 2454
        y: 361.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        is_team_authorization: true
        output_schema: null
        paramSchemas:
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: Database type
            ja_JP: Database type
            pt_BR: Database type
            zh_Hans: 数据库类型
          label:
            en_US: Database type
            ja_JP: Database type
            pt_BR: Database type
            zh_Hans: 数据库类型
          llm_description: Database type
          max: null
          min: null
          name: db_type
          options:
          - label:
              en_US: MySQL
              ja_JP: MySQL
              pt_BR: MySQL
              zh_Hans: MySQL
            value: mysql
          - label:
              en_US: PostgreSQL
              ja_JP: PostgreSQL
              pt_BR: PostgreSQL
              zh_Hans: PostgreSQL
            value: postgresql
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: select
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: limit
            ja_JP: limit
            pt_BR: limit
            zh_Hans: SQL返回数据量限制
          label:
            en_US: limit
            ja_JP: limit
            pt_BR: limit
            zh_Hans: SQL返回数据量限制
          llm_description: limit
          max: 1000
          min: 1
          name: limit
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: number
        - auto_generate: null
          default: json
          form: form
          human_description:
            en_US: result_format
            ja_JP: result_format
            pt_BR: result_format
            zh_Hans: 返回数据格式
          label:
            en_US: result_format
            ja_JP: result_format
            pt_BR: result_format
            zh_Hans: 返回数据格式
          llm_description: result_format
          max: null
          min: null
          name: result_format
          options:
          - label:
              en_US: JSON
              ja_JP: JSON
              pt_BR: JSON
              zh_Hans: JSON
            value: json
          - label:
              en_US: TEXT
              ja_JP: TEXT
              pt_BR: TEXT
              zh_Hans: TEXT
            value: text
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: select
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: Database ip/host
            ja_JP: Database ip/host
            pt_BR: Database ip/host
            zh_Hans: 数据库IP/域名
          label:
            en_US: Database ip/host
            ja_JP: Database ip/host
            pt_BR: Database ip/host
            zh_Hans: 数据库IP/域名
          llm_description: Database ip/host
          max: null
          min: null
          name: host
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: Database port
            ja_JP: Database port
            pt_BR: Database port
            zh_Hans: 数据库端口
          label:
            en_US: Database port
            ja_JP: Database port
            pt_BR: Database port
            zh_Hans: 数据库端口
          llm_description: Database port
          max: 65535
          min: 1
          name: port
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: number
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: Database name
            ja_JP: Database name
            pt_BR: Database name
            zh_Hans: 数据库名称
          label:
            en_US: Database name
            ja_JP: Database name
            pt_BR: Database name
            zh_Hans: 数据库名称
          llm_description: Database name
          max: null
          min: null
          name: db_name
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: table_names
            ja_JP: table_names
            pt_BR: table_names
            zh_Hans: 数据表名称
          label:
            en_US: table_names
            ja_JP: table_names
            pt_BR: table_names
            zh_Hans: 数据表名称
          llm_description: table_names
          max: null
          min: null
          name: table_names
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: Schema name
            ja_JP: Schema name
            pt_BR: Schema name
            zh_Hans: 数据库Schema PGSQL用户选填,默认为public
          label:
            en_US: Schema name
            ja_JP: Schema name
            pt_BR: Schema name
            zh_Hans: 数据库Schema PGSQL用户选填,默认为public
          llm_description: Schema name
          max: null
          min: null
          name: schema_name
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: Username
            ja_JP: Username
            pt_BR: Username
            zh_Hans: 用户名
          label:
            en_US: Username
            ja_JP: Username
            pt_BR: Username
            zh_Hans: 用户名
          llm_description: Username
          max: null
          min: null
          name: username
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: Password
            ja_JP: Password
            pt_BR: Password
            zh_Hans: 密码
          label:
            en_US: Password
            ja_JP: Password
            pt_BR: Password
            zh_Hans: 密码
          llm_description: Password
          max: null
          min: null
          name: password
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: secret-input
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: LLM model for text2data.
            ja_JP: LLM model for text2data.
            pt_BR: LLM model for text2data.
            zh_Hans: LLM model for text2data.
          label:
            en_US: Model
            ja_JP: Model
            pt_BR: Model
            zh_Hans: 模型
          llm_description: LLM model for text2data.
          max: null
          min: null
          name: model
          options: []
          placeholder: null
          precision: null
          required: true
          scope: llm
          template: null
          type: model-selector
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: Fetching data from the database using natural language.
            ja_JP: Fetching data from the database using natural language.
            pt_BR: Fetching data from the database using natural language.
            zh_Hans: Fetching data from the database using natural language.
          label:
            en_US: Query string
            ja_JP: Query string
            pt_BR: Query string
            zh_Hans: 查询语句
          llm_description: Fetching data from the database using natural language.
          max: null
          min: null
          name: query
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: custom_prompt
            ja_JP: custom_prompt
            pt_BR: custom_prompt
            zh_Hans: 自定义提示
          label:
            en_US: custom_prompt
            ja_JP: custom_prompt
            pt_BR: custom_prompt
            zh_Hans: 自定义提示
          llm_description: custom_prompt
          max: null
          min: null
          name: custom_prompt
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: with_comment
            ja_JP: with_comment
            pt_BR: with_comment
            zh_Hans: 是否包含注释
          label:
            en_US: with_comment
            ja_JP: with_comment
            pt_BR: with_comment
            zh_Hans: 是否包含注释
          llm_description: with_comment
          max: null
          min: null
          name: with_comment
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: boolean
        params:
          custom_prompt: ''
          db_name: ''
          db_type: ''
          host: ''
          limit: ''
          model: ''
          password: ''
          port: ''
          query: ''
          result_format: ''
          schema_name: ''
          table_names: ''
          username: ''
          with_comment: ''
        provider_id: jaguarliuu/rookie_text2data/rookie_text2data
        provider_name: jaguarliuu/rookie_text2data/rookie_text2data
        provider_type: builtin
        selected: false
        title: rookie_text2data
        tool_configurations:
          db_name: ssm
          db_type: mysql
          host: 192.168.0.107
          limit: null
          model:
            completion_params: {}
            mode: chat
            model: qwen2.5vl:7b
            model_type: llm
            provider: langgenius/ollama/ollama
            type: model-selector
          password: jiang1987
          port: 3306
          result_format: text
          username: ssm
          with_comment: 1
        tool_description: 使用自然语言从MySQL获取数据
        tool_label: rookie_text2data
        tool_name: rookie_text2data
        tool_parameters:
          custom_prompt:
            type: mixed
            value: '绿色指标表表注释

              表名称:green_item

              -id:主键ID,int

              -oname:一级指标,varchar(255)

              -sname:二级指标,varchar(255)

              -tname:三级指标,varchar(255)

              -score:绿色分值,int

              事项表表注释

              表名称:item_dic

              -id:字典主键,int

              -tid:上级主键,int

              -name:事项名称,varchar(255)

              -item_name:细项名称,varchar(255)

              -score:等分,int

              ##菜单表表注释

              表名称:menus

              -mid:菜单主键,int

              -mfid:上级主键,int

              -mname:菜单名称,varchar(255)

              -murl:菜单链接,varchar(255)

              角色表表注释

              表名称:roles

              -rid:角色主键,int

              -rname:角色名称,varchar(255)

              角色表表注释

              表名称:users

              -id:主键ID,int

              -name:姓名,varchar(255)

              -age:年龄,int


              注意事项:

              - 如有分组统计,请使用SUM、AVG等聚合函数,不要直接用原始字段。

              - 所有非聚合字段必须出现在GROUP BY中。

              - 只输出SQL语句,不要解释。'
          query:
            type: mixed
            value: '{{#llm.text#}}'
          table_names:
            type: mixed
            value: green_item,item_dic,menus,roles,users
        type: tool
      height: 323
      id: '1748696528530'
      position:
        x: 636
        y: 361.5
      positionAbsolute:
        x: 636
        y: 361.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        is_team_authorization: true
        output_schema: null
        paramSchemas:
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: Database type
            ja_JP: Database type
            pt_BR: Database type
            zh_Hans: 数据库类型
          label:
            en_US: Database type
            ja_JP: Database type
            pt_BR: Database type
            zh_Hans: 数据库类型
          llm_description: Database type
          max: null
          min: null
          name: db_type
          options:
          - label:
              en_US: MySQL
              ja_JP: MySQL
              pt_BR: MySQL
              zh_Hans: MySQL
            value: mysql
          - label:
              en_US: PostgreSQL
              ja_JP: PostgreSQL
              pt_BR: PostgreSQL
              zh_Hans: PostgreSQL
            value: postgresql
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: select
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: Database ip/host
            ja_JP: Database ip/host
            pt_BR: Database ip/host
            zh_Hans: 数据库IP/域名
          label:
            en_US: Database ip/host
            ja_JP: Database ip/host
            pt_BR: Database ip/host
            zh_Hans: 数据库IP/域名
          llm_description: Database ip/host
          max: null
          min: null
          name: host
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: Database port
            ja_JP: Database port
            pt_BR: Database port
            zh_Hans: 数据库端口
          label:
            en_US: Database port
            ja_JP: Database port
            pt_BR: Database port
            zh_Hans: 数据库端口
          llm_description: Database port
          max: 65535
          min: 1
          name: port
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: number
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: Database name
            ja_JP: Database name
            pt_BR: Database name
            zh_Hans: 数据库名称
          label:
            en_US: Database name
            ja_JP: Database name
            pt_BR: Database name
            zh_Hans: 数据库名称
          llm_description: Database name
          max: null
          min: null
          name: db_name
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: Username
            ja_JP: Username
            pt_BR: Username
            zh_Hans: 用户名
          label:
            en_US: Username
            ja_JP: Username
            pt_BR: Username
            zh_Hans: 用户名
          llm_description: Username
          max: null
          min: null
          name: username
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: Password
            ja_JP: Password
            pt_BR: Password
            zh_Hans: 密码
          label:
            en_US: Password
            ja_JP: Password
            pt_BR: Password
            zh_Hans: 密码
          llm_description: Password
          max: null
          min: null
          name: password
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: secret-input
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: Schema name
            ja_JP: Schema name
            pt_BR: Schema name
            zh_Hans: 数据库Schema PGSQL用户选填,默认为public
          label:
            en_US: Schema name
            ja_JP: Schema name
            pt_BR: Schema name
            zh_Hans: 数据库Schema PGSQL用户选填,默认为public
          llm_description: Schema name
          max: null
          min: null
          name: schema
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: Fetching data from the database using natural language.
            ja_JP: Fetching data from the database using natural language.
            pt_BR: Fetching data from the database using natural language.
            zh_Hans: Fetching data from the database using natural language.
          label:
            en_US: SQL string
            ja_JP: SQL string
            pt_BR: SQL string
            zh_Hans: 待执行的 SQL 语句
          llm_description: Fetching data from the database using natural language.
          max: null
          min: null
          name: sql
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: json
          form: form
          human_description:
            en_US: result_format
            ja_JP: result_format
            pt_BR: result_format
            zh_Hans: 返回数据格式
          label:
            en_US: result_format
            ja_JP: result_format
            pt_BR: result_format
            zh_Hans: 返回数据格式
          llm_description: result_format
          max: null
          min: null
          name: result_format
          options:
          - label:
              en_US: JSON
              ja_JP: JSON
              pt_BR: JSON
              zh_Hans: JSON
            value: json
          - label:
              en_US: TEXT
              ja_JP: TEXT
              pt_BR: TEXT
              zh_Hans: TEXT
            value: text
          - label:
              en_US: CSV
              ja_JP: CSV
              pt_BR: CSV
              zh_Hans: CSV
            value: csv
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: select
        params:
          db_name: ''
          db_type: ''
          host: ''
          password: ''
          port: ''
          result_format: ''
          schema: ''
          sql: ''
          username: ''
        provider_id: jaguarliuu/rookie_text2data/rookie_text2data
        provider_name: jaguarliuu/rookie_text2data/rookie_text2data
        provider_type: builtin
        selected: false
        title: rookie_excute_sql
        tool_configurations:
          db_name: ssm
          db_type: mysql
          host: 192.168.0.107
          password: jiang1987
          port: 3306
          result_format: text
          username: ssm
        tool_description: sql 执行器
        tool_label: rookie_excute_sql
        tool_name: rookie_excute_sql
        tool_parameters:
          sql:
            type: mixed
            value: '{{#llm.text#}}'
        type: tool
      height: 245
      id: '1748696624432'
      position:
        x: 939
        y: 361.5
      positionAbsolute:
        x: 939
        y: 361.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        cases:
        - case_id: 'true'
          conditions:
          - comparison_operator: contains
            id: 0e10be77-29c5-466c-b950-07548022a669
            value:varType: string
            variable_selector:
            - sys
            - query
          id: 'true'
          logical_operator: and
        - case_id: 6f64ec9a-f939-412f-b673-2bc1a852d5ce
          conditions:
          - comparison_operator: contains
            id: f52c2ed9-0a5d-4e8f-8bff-01b13742d267
            value: excel
            varType: string
            variable_selector:
            - sys
            - query
          - comparison_operator: contains
            id: 4b0a8f85-7221-4d02-acf4-f709c707d7fb
            value: Excel
            varType: string
            variable_selector:
            - sys
            - query
          - comparison_operator: contains
            id: 64c7dc5d-2c3c-4786-8cec-f7db37057475
            value: EXCEL
            varType: string
            variable_selector:
            - sys
            - query
          id: 6f64ec9a-f939-412f-b673-2bc1a852d5ce
          logical_operator: and
        desc: ''
        selected: false
        title: 条件分支
        type: if-else
      height: 225
      id: '1748696664775'
      position:
        x: 1242
        y: 361.5
      positionAbsolute:
        x: 1242
        y: 361.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        context:
          enabled: false
          variable_selector: []
        desc: ''
        model:
          completion_params: {}
          mode: chat
          name: qwen2.5vl:7b
          provider: langgenius/ollama/ollama
        prompt_template:
        - id: 7f02bbf8-3196-4a90-9405-482a585afcc8
          role: system
          text: '#任务

            根据用户需求,以及数据内容,自行判断哪种图表类型适合

            #输出

            只输入你推荐的图表类型名称,从以下类型中选择一个输出:柱状图、折线图、饼图,散点图,矩形树图'
        - id: 5c0fe9be-9e09-4679-b247-aeab12cdc8bb
          role: user
          text: '用户问题:{{#sys.query#}}

            数据库数据:{{#1748696528530.text#}}'
        selected: false
        title: 图表判断器
        type: llm
        variables: []
        vision:
          enabled: false
      height: 89
      id: '1748696729922'
      position:
        x: 1545
        y: 361.5
      positionAbsolute:
        x: 1545
        y: 361.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        context:
          enabled: false
          variable_selector: []
        desc: ''
        model:
          completion_params: {}
          mode: chat
          name: qwen2.5vl:7b
          provider: langgenius/ollama/ollama
        prompt_template:
        - id: 802dc976-d7c7-4222-b8a8-2ca473820037
          role: system
          text: '#任务

            请将用户提供的文档内容转化为标准的json内容,不包含“josn”的标签,只输出标准josn'
        - id: 67ebe4d2-123c-499c-8d8b-dc20c34f7600
          role: user
          text: 用户提供的文档内容:{{#1748696624432.text#}}
        selected: false
        title: 转JOSN LLM3
        type: llm
        variables: []
        vision:
          enabled: false
      height: 89
      id: '1748696811184'
      position:
        x: 1848
        y: 361.5
      positionAbsolute:
        x: 1848
        y: 361.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        is_team_authorization: true
        output_schema: null
        paramSchemas:
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: LLM model for rookie_data_alchemy.
            ja_JP: LLM model for rookie_data_alchemy.
            pt_BR: LLM model for rookie_data_alchemy.
            zh_Hans: LLM model for rookie_data_alchemy.
          label:
            en_US: Model
            ja_JP: Model
            pt_BR: Model
            zh_Hans: 模型
          llm_description: LLM model for text2data.
          max: null
          min: null
          name: model
          options: []
          placeholder: null
          precision: null
          required: true
          scope: llm
          template: null
          type: model-selector
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: wait for data
            ja_JP: wait for data
            pt_BR: wait for data
            zh_Hans: 待处理的数据,建议为json格式或md
          label:
            en_US: data
            ja_JP: data
            pt_BR: data
            zh_Hans: 待处理的数据,建议为json格式或md
          llm_description: wait for data
          max: null
          min: null
          name: data
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: title
            ja_JP: title
            pt_BR: title
            zh_Hans: 图表标题,不填则大模型推理生成
          label:
            en_US: title
            ja_JP: title
            pt_BR: title
            zh_Hans: 图表标题,不填则大模型推理生成
          llm_description: title
          max: null
          min: null
          name: title
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: chart type
            ja_JP: chart type
            pt_BR: chart type
            zh_Hans: 图表类型
          label:
            en_US: chart type
            ja_JP: chart type
            pt_BR: chart type
            zh_Hans: 图表类型
          llm_description: chart type
          max: null
          min: null
          name: chart_type
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: custom requirements
            ja_JP: custom requirements
            pt_BR: custom requirements
            zh_Hans: 自定义需求
          label:
            en_US: custom requirements
            ja_JP: custom requirements
            pt_BR: custom requirements
            zh_Hans: 自定义需求
          llm_description: custom requirements
          max: null
          min: null
          name: custom_requirements
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        params:
          chart_type: ''
          custom_requirements: ''
          data: ''
          model: ''
          title: ''
        provider_id: jaguarliuu/rookie_data_alchemy/rookie_data_alchemy
        provider_name: jaguarliuu/rookie_data_alchemy/rookie_data_alchemy
        provider_type: builtin
        selected: false
        title: rookie_data_alchemy
        tool_configurations:
          model:
            completion_params: {}
            mode: chat
            model: deepseek-r1:7b
            model_type: llm
            provider: langgenius/ollama/ollama
            type: model-selector
        tool_description: Visualizing structured data as charts
        tool_label: rookie_data_alchemy
        tool_name: rookie_data_alchemy
        tool_parameters:
          chart_type:
            type: mixed
            value: '{{#1748696729922.text#}}'
          custom_requirements:
            type: mixed
            value: ''
          data:
            type: mixed
            value: '{{#1748696811184.text#}}'
          title:
            type: mixed
            value: ''
        type: tool
      height: 89
      id: '1748696899575'
      position:
        x: 2151
        y: 361.5
      positionAbsolute:
        x: 2151
        y: 361.5
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        context:
          enabled: false
          variable_selector: []
        desc: ''
        model:
          completion_params: {}
          mode: chat
          name: qwen2.5vl:7b
          provider: langgenius/ollama/ollama
        prompt_template:
        - id: 2d5be626-1a76-4d04-bc8c-2f57cae3fe96
          role: system
          text: '#任务

            把数据库数据转化为表格类型的markdown文本内容,并把表头翻译为中文

            #输出

            只输出转化后的表格类型的markdown,不是要“''“markdown\n”''”等语言标签,只输出标准的markdown表格'
        - id: 9d64935a-8b00-4d2c-ad97-f6a46a113a36
          role: user
          text: ''
        selected: false
        title: 转markdown格式
        type: llm
        variables: []
        vision:
          enabled: false
      height: 89
      id: '1748697147705'
      position:
        x: 1545
        y: 498
      positionAbsolute:
        x: 1545
        y: 498
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        is_team_authorization: true
        output_schema: null
        paramSchemas:
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: Markdown table text
            ja_JP: Markdown table text
            pt_BR: Markdown table text
            zh_Hans: Markdown格式文本,必须为Markdown表格格式,可包含多个表格
          label:
            en_US: Markdown text
            ja_JP: Markdown text
            pt_BR: Markdown text
            zh_Hans: Markdown格式文本
          llm_description: ''
          max: null
          min: null
          name: md_text
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: Filename of the output file
            ja_JP: Filename of the output file
            pt_BR: Filename of the output file
            zh_Hans: 输出文件名
          label:
            en_US: Filename of the output file
            ja_JP: Filename of the output file
            pt_BR: Filename of the output file
            zh_Hans: 输出文件名
          llm_description: ''
          max: null
          min: null
          name: output_filename
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        params:
          md_text: ''
          output_filename: ''
        provider_id: bowenliang123/md_exporter/md_exporter
        provider_name: bowenliang123/md_exporter/md_exporter
        provider_type: builtin
        selected: false
        title: Markdown转XLSX文件
        tool_configurations: {}
        tool_description: 一个用于将Markdown转换为XLSX文件的工具
        tool_label: Markdown转XLSX文件
        tool_name: md_to_xlsx
        tool_parameters:
          md_text:
            type: mixed
            value: '{{#1748697147705.text#}}'
          output_filename:
            type: mixed
            value: ''
        type: tool
      height: 53
      id: '1748697966459'
      position:
        x: 1848
        y: 516
      positionAbsolute:
        x: 1848
        y: 516
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        answer: '{{#sys.files#}}'
        desc: ''
        selected: false
        title: 直接回复 2
        type: answer
        variables: []
      height: 104
      id: '1748698000525'
      position:
        x: 2151
        y: 490.5
      positionAbsolute:
        x: 2151
        y: 490.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        context:
          enabled: false
          variable_selector: []
        desc: ''
        model:
          completion_params: {}
          mode: chat
          name: qwen2.5vl:7b
          provider: langgenius/ollama/ollama
        prompt_template:
        - id: d05a33f6-5888-41db-8533-fbe04d312a19
          role: system
          text: '#角色

            你是一个精通数据处理、分析和总结的大师

            #任务

            你可以根据用户的问题,从提供的数据库中检索相关信息,整合提炼后用精准合适的自然语言来回复用户

            #输出

            1.若用户只是查询数据,则提炼之后直接回复数据即可

            2.如果用户需要你分析和综合数据,则你结合数据来给出专业的分析内容'
        - id: 0f415532-e56c-4c51-a004-9658d13aa3be
          role: user
          text: '用户的问题:{{#sys.query#}}

            数据库数据:{{#1748696624432.text#}}'
        selected: false
        title: LLM 5
        type: llm
        variables: []
        vision:
          enabled: false
      height: 89
      id: '1748698025100'
      position:
        x: 1545
        y: 627
      positionAbsolute:
        x: 1545
        y: 627
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        answer: '{{#1748698025100.text#}}'
        desc: ''
        selected: false
        title: 总结分析
        type: answer
        variables: []
      height: 104
      id: '1748698346189'
      position:
        x: 1848
        y: 619.5
      positionAbsolute:
        x: 1848
        y: 619.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    viewport:
      x: -964.6500000000001
      y: -95.05000000000001
      zoom: 0.7

用户表结构

DROP TABLE IF EXISTS `users`;
CREATE TABLE `users`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '姓名',
  `age` int(0) NULL DEFAULT NULL COMMENT '年龄',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 31 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户信息' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

10 总结

从接触模型以来,也没有几天,不断的通过网上的知识进行研究和学习,文档内容如有不对对请指正。感谢!!!!

模型里的SYSTEM 示例

#角色
你是一个专业的数据分析专家,并且精通根据用户的问题、数据表结构进行生成SQL语句进行查询数据库。
#任务
1.负责把用户的查询数据需求进行提炼和总结,抓取关键数据查询文字,去掉和数据查询无关的内容,只保留提炼查询数据的文字
2.根据用户的问题,准确确定用户需求,首先查看数据库表中的数据表结构,然后编写准确的并且可直接运行的SQL语句进行统计和查询数据库中的数据,并且返回相关数据,对于用户的工作效率提升十分重要。
#输出
注意事项:
所有非聚合字段必须出现在GROUP BY中,只输出SQL语句,不要解释。输出示例:

查询用户信息:
select  *  from users
查询用户数:
select  count(1) from users

角色定义你模型的作用
任务:任务一定要写详细、清楚、简洁
输出:输出的内容进行描述,示例针对sql查询或者调用图表,模型会根据你的示例进行处理,比如查询用户的示例select * from users,如果在对话中输入查询角色信息,则模型自动会调整为select * from roles,但是如果你输入的是展示角色信息,那么就可能模型就识别不了(跟模型理解有关)。

USER和ASSISTANT 待研究

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2396766.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Redis部署架构详解:原理、场景与最佳实践

Redis部署架构详解&#xff1a;原理、场景与最佳实践 Redis作为一种高性能的内存数据库&#xff0c;在现代应用架构中扮演着至关重要的角色。随着业务规模的扩大和系统复杂度的提升&#xff0c;选择合适的Redis部署架构变得尤为重要。本文将详细介绍Redis的各种部署架构模式&a…

C++哈希表:unordered系列容器详解

本节目标 1.unordered系列关联式容器 2.底层结构 3.模拟实现 4.哈希的应用 5.海量数据处理面试题 unordered系列关联式容器 在c98中&#xff0c;STL提供了底层为红黑树结构的一系列关联式容器&#xff0c;在查询时效率可以达到logN&#xff0c;即最差的情况下需要比较红…

WordPress通过简码插入bilibili视频

发布于&#xff1a;Eucalyptus-Blog 一、前言 B站是国内非常受欢迎的视频分享平台&#xff0c;上面不仅内容丰富&#xff0c;而且很多视频制作精良、趣味十足。很多人&#xff0c;比如我&#xff0c;就喜欢将B站的视频通过 iframe 嵌入到自己的网页中&#xff0c;但这段代码又…

ZLG ZCANPro,ECU刷新,bug分享

文章目录 摘要 📋问题的起因bug分享 ✨思考&反思 🤔摘要 📋 ZCANPro想必大家都不陌生,买ZLG的CAN卡,必须要用的上位机软件。在汽车行业中,有ECU软件升级的需求,通常都通过UDS协议实现程序的更新,满足UDS升级的上位机要么自己开发,要么用CANoe或者VFlash,最近…

黑马k8s(十七)

一&#xff1a;高级存储 1.高级存储-pv和pvc介绍 2.高级存储-pv 3.高级存储-pvc 最后一个改成5gi pvc3是没有来绑定成功的 pv3没有绑定 删除pod、和pvc&#xff0c;观察状态&#xff1a; 4.高级存储-pc和pvc的生命周期 二&#xff1a;配置存储 1.配置存储-ConfigMap 2.配…

掌握HttpClient技术:从基础到实战(Apache)

目录 前言 一、Apache HttpClient简介 二、HttpClient基础使用 1. 添加依赖 2. 创建HttpClient实例 3. 发送GET请求 4. 发送POST请求 三、HttpClient高级配置与实战案例 1. 连接池优化 2. 超时与重试配置 3. 文件上传&#xff08;Multipart&#xff09; 总结 前言 …

sql知识梳理(超全,超详细,自用)

目录 通识 查询的基本语法 数据库&#xff08;database&#xff09;操作 表&#xff08;table&#xff09;的操作 表中列的操作 索引操作 表中行的操作 insert into语句 update语句 删除语句 select语句 表与表之间的关系 连接查询 子查询 视图 数据备份与还原 …

[ Qt ] | QPushButton常见用法

目录 绑定键盘快捷键 前面已经说了很多用法了&#xff0c;下面主要说说绑定键盘&#xff0c;设置Icon图片。 绑定键盘快捷键 实现四个按钮&#xff0c;可以使用wsad来控制另一个按钮的上下左右的移动。 #include "widget.h" #include "ui_widget.h"Wid…

电脑驱动程序更新工具, 3DP Chip 中文绿色版,一键更新驱动!

介绍 3DP Chip 是一款免费的驱动程序更新工具&#xff0c;可以帮助用户快速、方便地识别和更新计算机硬件驱动程序。 驱动程序更新工具下载 https://pan.quark.cn/s/98895d47f57c 软件截图 软件特点 简单易用&#xff1a;用户界面简洁明了&#xff0c;操作方便&#xff0c;…

【机器学习基础】机器学习入门核心:数学基础与Python科学计算库

机器学习入门核心&#xff1a;数学基础与Python科学计算库 一、核心数学基础回顾1. 函数与导数2. Taylor公式3. 概率论基础4. 统计量5. 重要定理6. 最大似然估计&#xff08;MLE&#xff09;7. 线性代数 二、Python科学计算库精要1. NumPy&#xff1a;数值计算核心2. SciPy&…

上交具身机器人的视觉运动导航!HTSCN:融合空间记忆与语义推理认知的导航策略

作者&#xff1a;Qiming Liu 1 ^{1} 1, Guangzhan Wang 2 ^{2} 2, Zhe Liu 3 , 4 ^{3,4} 3,4 and Hesheng Wang 1 , 3 , 5 , 6 ^{1,3,5,6} 1,3,5,6单位&#xff1a; 1 ^{1} 1上海交通大学自动化系&#xff0c; 2 ^{2} 2上海交通大学软件学院&#xff0c; 3 ^{3} 3上海交通大学教…

【C++并发编程01】初识C++并发编程

1、并发是什么 并发是指两个或更多独立的活动同时发生&#xff0c;现实生活中常见的并发场景如边吃饭边看手机。 1.1、计算机中的并发&#xff1a; 计算机领域的并发是指在单个系统里同时执行多个独立的任务&#xff0c;而非顺序的进行一些活动。 我们在电脑上能够边听音乐边和…

Mysql库的操作和表的操作

Mysql库和表的操作 库的操作1.查看数据库列表2.创建数据库3.使用数据库4.查看当前在那个数据库中5.显示数据库的创建语句6.修改数据库7.删除数据库8.备份和恢复数据库9.查看数据的连接情况(简单来说就是查看有多少人使用你的数据库) 表的操作1.创建表2.查看表结构3.修改表本身(…

LangChain-结合GLM+SQL+函数调用实现数据库查询(三)

针对 LangChain-结合GLM+SQL+函数调用实现数据库查询(二)-CSDN博客 进一步简化 通过 LangChain 和大语言模型(GLM-4)实现了一个 AI 代理,能够根据自然语言提问自动生成 SQL 查询语句,并连接 MySQL 数据库执行查询,最终返回结果。 整个流程如下: 用户提问 → AI 生成 SQ…

抖音商城抓包 分析

声明 本文章中所有内容仅供学习交流使用&#xff0c;不用于其他任何目的&#xff0c;抓包内容、敏感网址、数据接口等均已做脱敏处理&#xff0c;严禁用于商业用途和非法用途&#xff0c;否则由此产生的一切后果均与作者无关&#xff01; 抓包展示 总结 1.出于安全考虑,本章未…

性能优化 - 案例篇:数据一致性

文章目录 Pre引言1. 分布式缓存概念2. Redis 与 Memcached 区别概览3. Spring Boot 中使用 Redis3.1 引入依赖与常用客户端3.2 RedisTemplate 的基本用法3.3 Spring Cache 注解式缓存 4. 秒杀业务简介及挑战5. Lua 脚本实现原子库存扣减5.1 准备阶段&#xff1a;数据预加载5.2 …

Spring框架学习day6--事务管理

Spring事务管理 Spring事务管理是在AOP的基础上&#xff0c;当我们的方法完全执行成功后&#xff0c;再提交事务&#xff0c;如果方法中有异常&#xff0c;就不提交事务 Spring中的事务管理有两种方式&#xff1a; ​ 1.编程式事务 ​ 需要我们在业务代码中手动提交 ​ 2.声明式…

免费酒店管理系统+餐饮系统+小程序点餐——仙盟创梦IDE

酒店系统主屏幕 房间管理 酒店管理系统的房间管理&#xff0c;可实现对酒店所有房间的实时掌控。它能清晰显示房间状态&#xff0c;如已预订、已入住、空闲等&#xff0c;便于高效安排入住与退房&#xff0c;合理分配资源&#xff0c;提升服务效率&#xff0c;保障酒店运营有条…

Git企业级项目管理实战

目录 1. 准备工作 2. 添加成员 2.1 添加企业成员 2.2 添加项目成员 2.3 添加仓库开发人员 3. 开发场景 - 基于git flow模型的实践 3.1 新需求加入 3.2 修复测试环境 Bug 3.3 修改预发布环境Bug 3.4 修改正式环境 Bug 3.5 紧急修复正式环境 Bug 4. 拓展阅读 4.1 其…

【实例】事业单位学习平台自动化操作

目录 一、创作背景: 二、实现逻辑: 三、代码分析【Deepseek分析】: 1) 主要功能 2)核心组件 2.1 GUI界面 (AutomationApp类) 2.2 浏览器自动化 2.3 平台特定处理 3) 关键技术 4)代码亮点 5)总结 四、运行截图: 五、程序代码: 特别声明:***本代码仅限编程学…