本地LLM聊天界面

Tamarin 是一个功能丰富的聊天界面,设计用于通过 LM Studio 与本地语言模型交互,提供AI代理能力、工具执行和实时流式响应。

  • by JungleM0nkey
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 JungleM0nkey/apehost-tamarin-ui

使用说明

通过以下方式为本地LLM提供现代聊天UI LM工作室,具有代理功能、工具执行和流式响应。

特性 • 入门指南 • 配置 • 建筑 • 发展

概述

Tamarin是一个功能丰富的聊天界面,旨在通过LM Studio与本地语言模型配合使用。它采用Next.js构建,具有独特的深色/琥珀色配色方案,超越了简单的聊天,提供了具有工具执行、多服务器支持和实时流媒体的AI代理功能。

[!提示] Tamarin与本地LM Studio实例完全脱机工作-不需要云API密钥。

特性

  • 流媒体响应 --实时令牌流式传输,提供即时反馈
  • AI代理 --具有可定制行为的预构建代理预设(研究员、程序员、分析师、一般助理)
  • 工具执行 --内置工具,包括网络搜索、计算器和日期时间实用程序
  • 多服务器支持 --同时连接到多个LM Studio实例
  • 持续对话 --本地保存的对话及其完整历史记录
  • Markdown和代码突出显示 --完全的markdown支持,语法高亮显示和一键代码复制
  • 生成设置 --微调温度、最大令牌、top-p和系统提示
  • 深色主题 --优化的深色用户界面,带有琥珀色调,可舒适延长使用时间

入门指南

先决条件

安装

  1. 克隆存储库:

    git clone https://github.com/JungleM0nkey/apehost-tamarin-ui.git
    cd apehost-tamarin-ui
    
  2. 安装依赖项:

    npm install
    
  3. 启动开发服务器:

    npm run dev
    
  4. 打开 http://localhost:3000 在您的浏览器中。

LM工作室设置

  1. 打开LM Studio并加载模型
  2. 导航到 本地服务器 标签
  3. 点击 启动服务器 (默认端口:1234)
  4. Tamarin将自动检测可用型号

配置

环境变量

复制 .env.local.example 到 .env.local 并根据需要进行定制:

# LM Studio Servers Configuration
# Format: "name1|url1,name2|url2"
LMSTUDIO_SERVERS="Local|http://localhost:1234/v1"

# Rate Limiting (requests per minute per IP)
RATE_LIMIT_RPM=60

生成设置

设置 默认值 说明
温度 0.7 控制随机性(0-2)
最大令牌 2048 最大响应长度
Top-P 0.95 核采样阈值
系统提示 可定制 型号说明

代理预设

Tamarin包括几个预配置的AI代理:

代理 描述 工具
研究助理 专注于研究和分析 网络搜索,DateTime
编程助手 软件开发和调试 计算器,DateTime
数据分析师 数据分析和计算 计算器,DateTime
一般助理 各种任务的多功能助手 所有工具

建筑

src/
├── app/                    # Next.js App Router
│   ├── api/               # API routes
│   │   ├── agents/        # Agent management & execution
│   │   ├── chat/          # Chat completion endpoint
│   │   ├── servers/       # Server management
│   │   └── tools/         # Tool registry endpoint
│   └── page.tsx           # Main chat interface
├── components/
│   ├── chat/              # Chat UI (messages, input, tools)
│   ├── sidebar/           # Navigation & settings
│   └── ui/                # Reusable UI components (shadcn)
├── hooks/                 # React hooks
├── lib/
│   ├── agents/            # Agent presets
│   ├── schemas/           # Zod validation schemas
│   ├── services/          # Core services
│   │   ├── agent-orchestrator.ts  # Agent execution loop
│   │   ├── lmstudio-service.ts    # LM Studio client
│   │   ├── server-manager.ts      # Multi-server management
│   │   └── tool-registry.ts       # Tool registration
│   └── tools/             # Built-in tools
└── store/                 # Zustand state management

关键组件

  • 代理协调器 --通过规划和工具执行管理代理执行循环
  • LM工作室服务 -服务器端API客户端,具有重试逻辑和流式传输支持
  • 工具注册表 --用于注册和执行工具的可插拔系统
  • 服务器管理器 --处理多个LM Studio服务器配置

发展

可用脚本

npm run dev      # Start development server with Turbopack
npm run build    # Build for production
npm run start    # Start production server
npm run lint     # Run ESLint

技术栈

技术 目的
Next.js 16 带有App Router的React框架
反应19 UI库
TypeScript 5 类型安全
顺风CSS 4 造型
状态 国家管理
黄道带 架构验证
shadcn/ui UI组件

添加自定义工具

在中注册新工具 src/lib/tools/:

import { defineTool } from "@/lib/services/tool-registry";

defineTool(
  "my_tool",
  "Description of what the tool does",
  {
    input: { type: "string", description: "Input parameter", required: true },
  },
  async (args) => {
    // Tool implementation
    return { result: "Tool output" };
  }
);

资源


Built with the ApeHost dark/amber theme