mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
feat: add docs
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
name: Deploy Docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- '.github/workflows/deploy-docs.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
# 设置 GITHUB_TOKEN 权限以允许部署到 GitHub Pages
|
||||
permissions:
|
||||
contents: write
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
# 只允许一个并发部署,跳过正在运行和最新排队之间的运行队列
|
||||
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成
|
||||
concurrency:
|
||||
group: pages
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 8
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup pnpm cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
cd docs
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build with VitePress
|
||||
run: |
|
||||
cd docs
|
||||
pnpm run build
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: peaceiris/actions-gh-pages@v4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./docs/docs/.vitepress/dist
|
||||
cname: false # 如果你有自定义域名,可以设置为你的域名
|
||||
|
||||
@@ -90,6 +90,7 @@ Thumbs.db
|
||||
*.temp
|
||||
.cache/
|
||||
|
||||
docs/docs/.vitepress/cache
|
||||
.pnpm-store
|
||||
|
||||
dump.rdb
|
||||
@@ -0,0 +1,26 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
.vitepress/cache
|
||||
@@ -0,0 +1,44 @@
|
||||
# Memoh 文档
|
||||
|
||||
这是 Memoh 项目的官方文档。
|
||||
|
||||
## 本地开发
|
||||
|
||||
安装依赖:
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
启动开发服务器:
|
||||
|
||||
```bash
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
文档将在 `http://localhost:5173` 运行。
|
||||
|
||||
## 构建
|
||||
|
||||
构建生产版本:
|
||||
|
||||
```bash
|
||||
pnpm build
|
||||
```
|
||||
|
||||
预览构建结果:
|
||||
|
||||
```bash
|
||||
pnpm preview
|
||||
```
|
||||
|
||||
## 部署
|
||||
|
||||
文档会在 `docs/` 目录发生变化时自动部署到 GitHub Pages。
|
||||
|
||||
部署地址:https://memohai.github.io/Memoh/
|
||||
|
||||
## 手动部署
|
||||
|
||||
如果需要手动触发部署,可以在 GitHub Actions 页面选择 "Deploy Docs" workflow,然后点击 "Run workflow"。
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
import { defineConfig } from 'vitepress'
|
||||
|
||||
// https://vitepress.vuejs.org/config/app-configs
|
||||
export default defineConfig({
|
||||
title: 'Memoh',
|
||||
description: '长记忆、自托管、AI 驱动的个人生活助手',
|
||||
|
||||
// GitHub Pages 部署配置
|
||||
base: '/Memoh/',
|
||||
|
||||
// 主题配置
|
||||
themeConfig: {
|
||||
// 网站标题(显示在导航栏)
|
||||
siteTitle: 'Memoh',
|
||||
|
||||
// 导航栏
|
||||
nav: [
|
||||
{ text: '指南', link: '/guide/getting-started' },
|
||||
{ text: 'Telegram Bot', link: '/platforms/telegram' },
|
||||
{ text: 'CLI 工具', link: '/cli/' }
|
||||
],
|
||||
|
||||
// 侧边栏
|
||||
sidebar: {
|
||||
'/guide/': [
|
||||
{
|
||||
text: '开始使用',
|
||||
items: [
|
||||
{ text: '快速开始', link: '/guide/getting-started' },
|
||||
{ text: '安装', link: '/guide/installation' },
|
||||
{ text: '配置', link: '/guide/configuration' }
|
||||
]
|
||||
}
|
||||
],
|
||||
'/platforms/': [
|
||||
{
|
||||
text: '平台集成',
|
||||
items: [
|
||||
{ text: 'Telegram', link: '/platforms/telegram' }
|
||||
]
|
||||
}
|
||||
],
|
||||
'/cli/': [
|
||||
{
|
||||
text: '命令行工具',
|
||||
items: [
|
||||
{ text: '介绍', link: '/cli/' }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// 社交链接
|
||||
socialLinks: [
|
||||
{ icon: 'github', link: 'https://github.com/memohai/Memoh' }
|
||||
],
|
||||
|
||||
// 页脚
|
||||
footer: {
|
||||
message: '基于 MIT 许可发布',
|
||||
copyright: 'Copyright © 2024 Memoh'
|
||||
},
|
||||
|
||||
// 搜索
|
||||
search: {
|
||||
provider: 'local'
|
||||
},
|
||||
|
||||
// 编辑链接
|
||||
editLink: {
|
||||
pattern: 'https://github.com/memohai/Memoh/edit/main/docs/docs/:path',
|
||||
text: '在 GitHub 上编辑此页'
|
||||
},
|
||||
|
||||
// 最后更新时间
|
||||
lastUpdated: {
|
||||
text: '最后更新于',
|
||||
formatOptions: {
|
||||
dateStyle: 'short',
|
||||
timeStyle: 'medium'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
ignoreDeadLinks: true,
|
||||
})
|
||||
@@ -0,0 +1,75 @@
|
||||
# CLI 工具
|
||||
|
||||
Memoh 提供了功能强大的命令行工具,让你可以轻松管理和配置你的 AI 助手。
|
||||
|
||||
## 安装
|
||||
|
||||
CLI 工具已包含在主项目中,无需单独安装。
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 登录
|
||||
|
||||
```bash
|
||||
pnpm cli auth login
|
||||
```
|
||||
|
||||
或者使用参数:
|
||||
|
||||
```bash
|
||||
pnpm cli auth login -u admin -p password
|
||||
```
|
||||
|
||||
### 查看当前用户
|
||||
|
||||
```bash
|
||||
pnpm cli auth whoami
|
||||
```
|
||||
|
||||
### Agent 交互模式
|
||||
|
||||
```bash
|
||||
pnpm cli
|
||||
```
|
||||
|
||||
或者:
|
||||
|
||||
```bash
|
||||
pnpm cli agent interactive
|
||||
```
|
||||
|
||||
## 主要命令
|
||||
|
||||
### 认证
|
||||
|
||||
- `auth login` - 登录
|
||||
- `auth logout` - 登出
|
||||
- `auth whoami` - 查看当前用户
|
||||
- `auth config` - 配置 API URL
|
||||
|
||||
### Agent
|
||||
|
||||
- `agent chat <message>` - 发送消息
|
||||
- `agent interactive` - 进入交互模式
|
||||
|
||||
### 模型管理
|
||||
|
||||
- `model list` - 列出所有模型
|
||||
- `model create` - 创建新模型
|
||||
- `model get <id>` - 获取模型详情
|
||||
- `model delete <id>` - 删除模型
|
||||
- `model defaults` - 查看默认模型
|
||||
|
||||
### 记忆管理
|
||||
|
||||
- `memory search <query>` - 搜索记忆
|
||||
- `memory add <content>` - 添加记忆
|
||||
- `memory messages` - 查看消息历史
|
||||
|
||||
### 定时任务
|
||||
|
||||
- `schedule list` - 列出所有定时任务
|
||||
- `schedule create` - 创建定时任务
|
||||
- `schedule toggle <id>` - 启用/禁用任务
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# 配置指南
|
||||
|
||||
## 环境变量
|
||||
|
||||
### 必需配置
|
||||
|
||||
- `DATABASE_URL` - PostgreSQL 连接字符串
|
||||
- `ROOT_USER` - 超级管理员用户名
|
||||
- `ROOT_USER_PASSWORD` - 超级管理员密码
|
||||
- `JWT_SECRET` - JWT 签名密钥
|
||||
|
||||
### 可选配置
|
||||
|
||||
- `QDRANT_URL` - Qdrant 连接字符串(默认:http://localhost:6333)
|
||||
- `REDIS_URL` - Redis 连接字符串(默认:redis://localhost:6379)
|
||||
- `API_PORT` - API 服务端口(默认:7002)
|
||||
|
||||
## 模型配置
|
||||
|
||||
### 创建模型
|
||||
|
||||
```bash
|
||||
pnpm cli model create \
|
||||
--name "GPT-4" \
|
||||
--model-id "gpt-4" \
|
||||
--base-url "https://api.openai.com/v1" \
|
||||
--api-key "your-api-key" \
|
||||
--client-type "openai" \
|
||||
--type "chat"
|
||||
```
|
||||
|
||||
### 设置默认模型
|
||||
|
||||
```bash
|
||||
pnpm cli config set \
|
||||
--chat-model <uuid> \
|
||||
--summary-model <uuid> \
|
||||
--embedding-model <uuid>
|
||||
```
|
||||
|
||||
## 用户配置
|
||||
|
||||
### 设置最大上下文时间
|
||||
|
||||
```bash
|
||||
pnpm cli config set --max-context-time <minutes>
|
||||
```
|
||||
|
||||
默认值为 900 分钟(15 小时)。
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
# 快速开始
|
||||
|
||||
欢迎使用 Memoh!本指南将帮助你快速上手。
|
||||
|
||||
## 什么是 Memoh?
|
||||
|
||||
Memoh 是一个专属于你的 AI 私人管家,你可以把它跑在你的 NAS,路由器等个人设备上,24 小时的为你提供服务。
|
||||
|
||||
## 环境要求
|
||||
|
||||
在开始之前,请确保你的系统满足以下要求:
|
||||
|
||||
- **PostgreSQL 16+** - 数据库
|
||||
- **Bun 1.2+** - JavaScript 运行时
|
||||
- **PNPM** - 包管理器
|
||||
- **Qdrant** - 向量数据库
|
||||
- **Redis** - 缓存和会话存储
|
||||
|
||||
## 安装步骤
|
||||
|
||||
### 1. 克隆项目
|
||||
|
||||
```bash
|
||||
git clone https://github.com/memohai/Memoh.git
|
||||
cd Memoh
|
||||
```
|
||||
|
||||
### 2. 安装依赖
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
### 3. 配置环境变量
|
||||
|
||||
复制环境变量示例文件:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
编辑 `.env` 文件,配置以下变量:
|
||||
|
||||
```env
|
||||
# 数据库配置
|
||||
DATABASE_URL=postgresql://user:password@localhost:5432/memoh
|
||||
|
||||
# 管理员账户
|
||||
ROOT_USER=admin
|
||||
ROOT_USER_PASSWORD=your_password
|
||||
|
||||
# JWT 密钥
|
||||
JWT_SECRET=your_jwt_secret_key
|
||||
|
||||
# Qdrant 向量数据库
|
||||
QDRANT_URL=http://localhost:6333
|
||||
|
||||
# Redis 缓存
|
||||
REDIS_URL=redis://localhost:6379
|
||||
```
|
||||
|
||||
### 4. 初始化数据库
|
||||
|
||||
```bash
|
||||
pnpm run db:push
|
||||
```
|
||||
|
||||
### 5. 启动 API 服务
|
||||
|
||||
```bash
|
||||
pnpm run api:dev
|
||||
```
|
||||
|
||||
API 服务将在 `http://localhost:7002` 启动。
|
||||
|
||||
## 下一步
|
||||
|
||||
- [使用 CLI 工具](/cli/) - 学习如何使用命令行工具
|
||||
- [配置 Telegram Bot](/platforms/telegram) - 集成 Telegram 平台
|
||||
- [配置指南](/guide/configuration) - 了解如何配置 Memoh
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# 安装指南
|
||||
|
||||
## 使用 PNPM(推荐)
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
## 使用 NPM
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
## 使用 Yarn
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
```
|
||||
|
||||
## 开发模式
|
||||
|
||||
启动开发服务器:
|
||||
|
||||
```bash
|
||||
pnpm run dev
|
||||
```
|
||||
|
||||
## 生产构建
|
||||
|
||||
构建生产版本:
|
||||
|
||||
```bash
|
||||
pnpm run build
|
||||
```
|
||||
|
||||
## Docker 部署
|
||||
|
||||
(待补充 Docker 配置)
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
layout: home
|
||||
|
||||
hero:
|
||||
name: Memoh
|
||||
text: AI 私人管家
|
||||
tagline: 长记忆、自托管、AI 驱动的个人生活助手
|
||||
actions:
|
||||
- theme: brand
|
||||
text: 快速开始
|
||||
link: /guide/getting-started
|
||||
- theme: alt
|
||||
text: 查看 GitHub
|
||||
link: https://github.com/memohai/Memoh
|
||||
|
||||
features:
|
||||
- icon: 🧠
|
||||
title: 长记忆能力
|
||||
details: Memoh 拥有长记忆能力,可以为你的家庭成员提供个性化的服务。他会存储最近一段时间(默认最近15个小时)的上下文,超出时间后则会根据你的需求按需加载记忆。
|
||||
- icon: ⏰
|
||||
title: 智能定时任务
|
||||
details: Memoh 可以帮你创建智能的定时任务,比如:每天早上七点生成一个早餐菜谱,通过 Telegram 发送给我。
|
||||
- icon: 💬
|
||||
title: 多平台支持
|
||||
details: Memoh 可以支持多种聊天软件,比如:Telegram,微信,QQ等常用社交软件,通过直接发送消息与 Memoh 进行交互。
|
||||
- icon: 🔒
|
||||
title: 自托管部署
|
||||
details: 你可以把 Memoh 跑在你的 NAS,路由器等个人设备上,24小时的为你提供服务,完全掌控你的数据。
|
||||
- icon: 🚀
|
||||
title: 易于使用
|
||||
details: 提供命令行工具和 Web 界面,让你轻松管理和配置你的 AI 助手。
|
||||
- icon: 🔧
|
||||
title: 高度可定制
|
||||
details: 支持多种 AI 模型,可以配置不同的聊天模型、嵌入模型和摘要模型,满足你的个性化需求。
|
||||
---
|
||||
@@ -0,0 +1,60 @@
|
||||
# Telegram Bot 集成
|
||||
|
||||
Memoh 支持通过 Telegram Bot 进行交互。
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 1. 获取 Bot Token
|
||||
|
||||
1. 在 Telegram 搜索 `@BotFather`
|
||||
2. 发送 `/newbot`
|
||||
3. 按提示输入 bot 名称和用户名
|
||||
4. 复制获得的 token
|
||||
|
||||
### 2. 启动 Telegram Service
|
||||
|
||||
```bash
|
||||
pnpm telegram:start
|
||||
```
|
||||
|
||||
Telegram Service 将在 `http://localhost:7101` 启动。
|
||||
|
||||
### 3. 配置 Platform
|
||||
|
||||
使用 CLI 工具创建 platform:
|
||||
|
||||
```bash
|
||||
pnpm cli platform create
|
||||
```
|
||||
|
||||
根据提示配置:
|
||||
- name: `telegram`
|
||||
- endpoint: `http://localhost:7101`
|
||||
- config: `{ "botToken": "<your-telegram-bot-token>" }`
|
||||
|
||||
## Bot 命令
|
||||
|
||||
- `/start` - 欢迎消息和命令列表
|
||||
- `/login <username> <password>` - 登录到你的账户
|
||||
- `/logout` - 登出
|
||||
- `/whoami` - 显示当前用户信息
|
||||
- `/chat <message>` - 与 AI 对话
|
||||
- `/help` - 显示帮助信息
|
||||
|
||||
## 使用示例
|
||||
|
||||
```
|
||||
你: /start
|
||||
|
||||
Bot: 👋 Welcome to Memoh Bot!
|
||||
|
||||
你: /login admin password
|
||||
|
||||
Bot: ✅ Login successful!
|
||||
|
||||
你: /chat 你好,介绍一下你自己
|
||||
|
||||
Bot: 🤖 你好!我是 Memoh AI 助手...
|
||||
```
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "@memoh/docs",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vitepress dev docs",
|
||||
"build": "vitepress build docs",
|
||||
"serve": "vitepress serve docs",
|
||||
"preview": "vitepress preview docs"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vitepress": "^1.6.0",
|
||||
"vue": "^3.5.0"
|
||||
},
|
||||
"pnpm": {
|
||||
"peerDependencyRules": {
|
||||
"ignoreMissing": [
|
||||
"@algolia/client-search"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+1307
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
packages:
|
||||
- 'packages/*'
|
||||
- 'docs'
|
||||
|
||||
onlyBuiltDependencies:
|
||||
- sqlite3
|
||||
Reference in New Issue
Block a user