NewLife.StarChat
1.0.2026.320-beta0540
This is a prerelease version of NewLife.StarChat.
dotnet add package NewLife.StarChat --version 1.0.2026.320-beta0540
NuGet\Install-Package NewLife.StarChat -Version 1.0.2026.320-beta0540
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="NewLife.StarChat" Version="1.0.2026.320-beta0540" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NewLife.StarChat" Version="1.0.2026.320-beta0540" />
<PackageReference Include="NewLife.StarChat" />
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 NewLife.StarChat --version 1.0.2026.320-beta0540
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NewLife.StarChat, 1.0.2026.320-beta0540"
#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 NewLife.StarChat@1.0.2026.320-beta0540
#: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=NewLife.StarChat&version=1.0.2026.320-beta0540&prerelease
#tool nuget:?package=NewLife.StarChat&version=1.0.2026.320-beta0540&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NewLife.StarChat 星语
星语(StarChat) 是新生命团队打造的多模型对话交互式 AI 系统,集对话前端、统一 AI 网关、Agent 平台于一身。底层依托 NewLife.AI 基础库,支持 34 个主流 AI 服务商,开箱即用。
产品定位
| 定位 | 说明 |
|---|---|
| 对话前端 | 自然语言问答、多轮对话、附件上传、模型切换、消息流式输出 |
| 统一 AI 网关 | 兼容 OpenAI / Anthropic / Gemini 等标准协议,34 个服务商统一入口 |
| Agent 平台 | 函数调用(Function Calling)、MCP 工具调用、图像生成与编辑 |
系统分为两层:
- NewLife.AI(基础库):多协议模型适配、函数调用、图像生成等通用 AI 能力,不依赖数据库,可单独使用。
- NewLife.StarChat(应用层):对话 Web 前端、会话管理、API 网关路由、使用量统计等业务功能,依赖 XCode 数据库。
核心特性
- 多模型支持:内置 34 个 AI 服务商适配(OpenAI、通义千问、DeepSeek、Gemini 等),一键切换模型。
- 流式对话:SSE 流式输出,打字机实时渲染,首 token 响应 ≤ 2 秒。
- 思考模式:支持自动 / 思考(Chain-of-Thought)/ 快速三档,可折叠展示推理过程。
- 函数调用 & MCP:原生 .NET 工具注册 + MCP 协议工具调用,工具调用过程可视化展示。
- 多模态:支持视觉理解(图片输入)、文档解析(PDF/DOCX/TXT)、图像生成与编辑。
- API 网关:对外提供兼容 OpenAI 的统一接口,支持 AppKey 鉴权与用量统计。
- 技能管理:以 Markdown 编写可复用 AI 行为指令,注入 System Prompt 赋予特定领域能力。
- 自学习系统:自动分析对话,提取用户偏好与业务知识,构建持久化记忆,越用越懂用户。
- 会话管理:多会话切换、标题自动生成、历史搜索、分享链接(只读访问)。
- 响应式 UI:移动端适配(768px 断点),深色 / 浅色主题,Markdown + KaTeX + Mermaid 渲染。
快速开始
方式一:直接运行(独立部署)
# 克隆仓库
git clone https://github.com/NewLifeX/NewLife.AI.git
cd NewLife.AI
# 运行 StarChat
dotnet run --project NewLife.StarChat
浏览器访问 http://localhost:5000,默认使用 SQLite 数据库,开箱即用。
方式二:NuGet 包引用(嵌入到已有项目)
dotnet add package NewLife.StarChat
在 Program.cs 中注册服务与中间件:
using NewLife.StarChat;
var builder = WebApplication.CreateBuilder(args);
// 注册 StarChat 服务
builder.Services.AddStarChat();
var app = builder.Build();
// 启用 StarChat 中间件:嵌入静态资源 + SPA 回退
app.UseStarChat(redirectToChat: true);
app.Run();
方式三:仅使用基础 AI 库
using NewLife.AI.Providers;
// 直接实例化服务商,传入密钥与模型创建客户端
var client = new DashScopeProvider().CreateClient("your-api-key", "qwen-max");
// 发送消息并获取回复
var response = await client.CompleteAsync("你好,请介绍一下你自己");
Console.WriteLine(response.Text);
配置说明
编辑 appsettings.json 配置模型提供商:
{
"StarChat": {
"ShareExpireDays": 30,
"DefaultModel": "qwen-max"
},
"ConnectionStrings": {
"StarChat": "Data Source=data/starchat.db"
}
}
在管理后台(/Admin)中可配置:
- 模型配置:添加各服务商的 API Key 和模型列表
- 提供商配置:管理 34 个服务商的连接信息
- 技能管理:创建和管理 AI 技能指令
- AppKey 管理:创建 API 网关访问密钥
- 系统设置:推荐问题、分享有效期等全局配置
技术架构
┌─────────────────────────────────────────────┐
│ NewLife.StarChat(应用层) │
│ Web 前端 · 会话管理 · API 网关 · 使用统计 │
├─────────────────────────────────────────────┤
│ NewLife.AI(基础库) │
│ 34 服务商适配 · 函数调用 · MCP · 图像生成 │
├─────────────────────────────────────────────┤
│ NewLife.XCode(数据库)+ NewLife.Cube(UI) │
└─────────────────────────────────────────────┘
- 前端:Vite + TypeScript,Markdown 渲染(marked + highlight.js + KaTeX + Mermaid)
- 后端:ASP.NET Core 10,XCode ORM,NewLife.Cube 管理后台
- 数据库:默认 SQLite,支持 MySQL / PostgreSQL
相关链接
©2002-2026 新生命开发团队 | MIT License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 was computed. 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 is compatible. 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.
-
net10.0
- NewLife.AI (>= 1.0.2026.320-beta0540)
- NewLife.Cube.Core (>= 6.9.2026.303)
- NewLife.MySql (>= 1.0.2026.302)
- NewLife.XCode (>= 11.25.2026.302)
-
net8.0
- NewLife.AI (>= 1.0.2026.320-beta0540)
- NewLife.Cube.Core (>= 6.9.2026.303)
- NewLife.MySql (>= 1.0.2026.302)
- NewLife.XCode (>= 11.25.2026.302)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.2026.320-beta0540 | 42 | 3/20/2026 |
| 1.0.2026.320-beta0408 | 36 | 3/20/2026 |
NewLife.StarChat(星语)对话交互式 AI 应用项目骨架