5分鐘教學|無需信用卡

5分鐘添加AI記憶

按照此逐步指南為您的AI賦予持久記憶。完成每一步時勾選標記。

進度0 / 5 步驟
0%
  1. 註冊或登入您的Seizn帳戶
  2. 在儀表板中導覽至API金鑰
  3. 點擊「建立新金鑰」並複製您的金鑰
前往儀表板
bash
npm install seizn
typescript
import { Seizn } from 'seizn';

const client = new Seizn({ apiKey: process.env.SEIZN_API_KEY });

// Save a memory
const memory = await client.add({
  content: "User prefers dark mode and concise responses",
  memory_type: "preference",
  tags: ["ui", "communication"]
});

console.log('Memory saved:', memory.id);
typescript
// Search for relevant memories
const results = await client.search({
  query: "What are the user's UI preferences?",
  limit: 5,
  threshold: 0.7
});

// Use memories in your AI prompt
for (const memory of results) {
  console.log(`[${memory.similarity.toFixed(2)}] ${memory.content}`);
}

搜尋記憶時應看到如下回應:

json
{
  "success": true,
  "results": [
    {
      "id": "mem_a1b2c3d4e5f6",
      "content": "User prefers dark mode and concise responses",
      "memory_type": "preference",
      "tags": ["ui", "communication"],
      "similarity": 0.94,
      "created_at": "2026-01-15T10:30:00Z"
    }
  ],
  "count": 1,
  "query_time_ms": 47
}

成功!

您的AI現在擁有持久記憶。使用搜尋結果來增強AI的上下文和回應。