Zongsoft.Intelligences 0.1.1

dotnet add package Zongsoft.Intelligences --version 0.1.1
                    
NuGet\Install-Package Zongsoft.Intelligences -Version 0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Zongsoft.Intelligences" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zongsoft.Intelligences" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Zongsoft.Intelligences" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Zongsoft.Intelligences --version 0.1.1
                    
#r "nuget: Zongsoft.Intelligences, 0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Zongsoft.Intelligences@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Zongsoft.Intelligences&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Zongsoft.Intelligences&version=0.1.1
                    
Install as a Cake Tool

人工智能扩展库

安装 Ollama

Windows 11 中确保 WSL 2Podman 安装成功。

确保 Podman 虚拟机已经启动,可通过下列命令进行查验:

podman machine list     #查看虚拟机列表
podman machine info     #查看虚拟机信息
podman machine start    #启动默认虚拟机

💡 提示: DockerPodman 的操作方式基本一致,只需将 podman 命令改成 docker 即可。

Podman 中安装 Ollama

根据 Ollama 官方文档 Ollama is now available as an official Docker image 的指引,在 PowerShell 中执行下列命令安装 Ollama 镜像。

podman run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama

等待下载安装完成后,通过下面命令进行查验 (此时镜像列表为空)

podman exec -it ollama ollama list

安装模型

Ollama 官方模型库 (https://ollama.com/search) 中查找需要的大语言模型。

💡 如果只是本地开发测试,推荐使用 阿里千问 (qwen3:0.6b) 模型,它只有 523MB 大小,可在无显卡的低配电脑上流畅运行。

podman exec -it ollama ollama pull qwen3:0.6b

等待下载安装完成后,通过下面命令进行查验:

# 查看本地模型库列表
podman exec -it ollama ollama list

# 运行 qwen3:0.6b 模型
# 运行成功后自动进入交互模式,可通过 `/bye` 命令退出
podman exec -it ollama ollama run qwen3:0.6b

# 查看正在运行的模型列表
podman exec -it ollama ollama ps

运行调试

本扩展库提供了 命令行RESTful API 接口两种方式。

命令行

  1. 执行 terminal 项目的 deploy.cmd 部署命令;
  2. 启动编译后的 terminal 本地宿主程序;

    如果 Ollama 没有安装在本机,则需要修改该插件的 Zongsoft.Intelligences.option 配置文件中的连接地址。

命令说明
  • 查看AI助手列表

    ai.assistant
    
  • 激活指定的AI助手

    注意:后续命令皆基于该命令设置的AI助手。

    # 设置AI助手配置(注:该命令参数即为配置文件中的连接名)
    ai.assistant ollama
    
  • 模型命令

    # 查看本地模型库列表
    ai.assistant.model.list
    
    # 查看正在运行的模型列表
    ai.assistant.model.list -running
    
    # 查看指定的模型信息
    ai.assistant.model.info "qwen3:0.6b"
    
    # 下载并安装指定的大语言模型
    ai.assistant.model.install "qwen3:0.6b"
    # 删除并卸载指定的大语言模型
    ai.assistant.model.uninstall "qwen3:0.6b"
    
  • 会话命令

    # 创建一个新的会话
    ai.assistant.chat.open
    # 进入指定的会话
    ai.assistant.chat.open 'session|chatroom'
    
    # 关闭当前会话
    ai.assistant.chat.close
    # 关闭指定会话
    ai.assistant.chat.close 'session|chatroom'
    
    # 清空当前会话的历史记录
    ai.assistant.chat.clear
    # 清空指定会话的历史记录
    ai.assistant.chat.clear 'session|chatroom'
    
    # 查看当前会话的历史纪录
    ai.assistant.chat.history
    # 查看指定会话的历史记录
    ai.assistant.chat.history 'session|chatroom'
    
  • 聊天命令

    # 对话
    ai.assistant.chat "内容"
    # 对话:结果为纯文本
    ai.assistant.chat -format:text "内容"
    
    # 对话:结果为异步流
    ai.assistant.chat -streaming "内容"
    # 对话:结果为纯文本的异步流
    ai.assistant.chat -streaming -format:text "内容"
    
    # 进入交互对话模式
    ai.assistant.chat -interactive
    

RESTful API 接口

  • 获取AI助手列表

    GET /ai/assistants

  • 获取指定AI助手信息

    GET /ai/assistants/{name}

  • 获取模型列表

    GET /ai/assistants/{name}/models

  • 获取模型详情

    GET /ai/assistants/{name}/models/{id}

  • 获取会话列表

    GET /ai/assistants/{name}/chats

  • 获取会话详情

    GET /ai/assistants/{name}/chats/{id}

  • 创建新的会话

    POST /ai/assistants/{name}/chats

  • 关闭一个会话

    DELETE /ai/assistants/{name}/chats/{id}

  • 获取指定会话的聊天历史记录

    GET /ai/assistants/{name}/chats/{id}/history

  • 清空指定会话的聊天历史记录

    DELETE /ai/assistants/{name}/chats/{id}/history

  • 聊天对话 (无会话历史)

    POST /ai/assistants/{name}/chats/chat

  • 聊天对话 (有会话历史)

    POST /ai/assistants/{name}/chats/{id}/chat

提示:api 项目中的 chat.html 文件为调用聊天 API 的范例,它采用 SSE 技术实现。

完整信息请参考 api 项目中的 Zongsoft.Intelligences.Web.http 文档。

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Zongsoft.Intelligences:

Package Downloads
Zongsoft.Intelligences.Web

This is a web class library about artificial intelligence development.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 146 9/10/2025
0.1.0 141 9/10/2025