Skip to content

Chao Bağlamı

Chao Bağlam API'si için referans. Chao, Chainabit'in Chainy yerlisi davranış danışmanıdır; bu uç nokta, kişiselleştirilmiş koçluk oturumlarına güç veren çözümlenmiş bağlamı bir araya getirir.

Ayrıca bakın

Uç noktalar

MethodPathDescriptionAuthRate Limit
GET/ai/chao/contextGet resolved Chao contextJWT + Entitlement30/min

GET /ai/chao/context

Tanım

Çözülmüş Chao bağlamını alın. Davranış "chainyId"nin sağlanıp sağlanmadığına bağlıdır:

  • chainyId ile — söz konusu hedef sistem için Chainy kapsamlı anıları ve zincir üretkenlik verilerini döndürür.
  • 'chainyId' olmadan - genel mod içeriğini döndürür: hesap çapındaki bellekler, kısa vadeli bitler (görevler) ve aktif zincirler (vizyonlarıyla birlikte hedef sistemleri).

Kimlik Doğrulama: JWT Taşıyıcı jetonu + aktif AI yetkisi gereklidir. Hız sınırı: 30/dak

Rica etmek

Sorgu Parametreleri
ParameterTypeRequiredDescription
chainyIdstring (UUID)NoThe Chainy to resolve context for. Must belong to the authenticated account. If omitted, general mode is returned.

Cevap

Yanıt – Zincirleme Modu

'ChainyId' sağlandığında döndürülür.

json
{
  "data": {
    "mode": "chainy",
    "chainyId": "550e8400-e29b-41d4-a716-446655440000",
    "memories": [
      {
        "content": "User prefers morning workouts before 8 AM.",
        "type": "preference",
        "scope": "chainy",
        "importance": 85,
        "origin": "inferred",
        "confidence": "high"
      }
    ],
    "productivitySnapshot": {
      "chains": [
        {
          "title": "Morning Run",
          "currentStreak": 12,
          "longestStreak": 30,
          "totalCompletions": 156,
          "status": "active"
        }
      ],
      "recentCompletions": [
        {
          "chainTitle": "Morning Run",
          "completedAt": "2026-03-20T07:30:00.000Z"
        }
      ]
    }
  }
}
Yanıt – Genel Mod

'ChainyId' atlandığında döndürülür. Chao, hesabın tamamında kısa vadeli görevleri ve aktif hedef sistemlerini ortaya çıkarıyor.

json
{
  "data": {
    "mode": "general",
    "memories": [
      {
        "content": "User prefers concise, action-oriented advice.",
        "type": "preference",
        "scope": "account",
        "importance": 70,
        "origin": "inferred",
        "confidence": "high"
      }
    ],
    "bits": [
      {
        "id": "a1b2c3d4-...",
        "title": "Write unit tests",
        "description": "Cover edge cases for the auth module.",
        "priority": "p2",
        "scheduledFor": "2026-03-31",
        "score": 47
      }
    ],
    "chainies": [
      {
        "id": "550e8400-...",
        "title": "Morning Athlete",
        "description": "Build a consistent morning exercise routine to feel energized daily.",
        "status": "active"
      }
    ]
  }
}
Yanıt Alanları — Zincirleme Mod
FieldTypeDescription
modestringAlways "chainy"
chainyIdstringThe Chainy UUID this context was resolved for
memoriesobject[]Chainy-scoped memory entries
memories[].contentstringHuman-readable memory content
memories[].typestringMemory type: preference, behavioral_pattern, goal, observation
memories[].scopestringMemory scope: chainy, account, workspace
memories[].importancenumberImportance score (0–100)
memories[].originstringHow the memory was created: inferred, explicit, system
memories[].confidencestringConfidence level: high, medium, low
productivitySnapshot.chains[].titlestringChain title
productivitySnapshot.chains[].currentStreaknumberCurrent active streak
productivitySnapshot.chains[].longestStreaknumberAll-time longest streak
productivitySnapshot.chains[].totalCompletionsnumberTotal completions
productivitySnapshot.chains[].statusstringChain status: active, paused, archived
productivitySnapshot.recentCompletions[].chainTitlestringTitle of the completed chain
productivitySnapshot.recentCompletions[].completedAtstringISO 8601 completion timestamp
Yanıt Alanları — Genel Mod
FieldTypeDescription
modestringAlways "general"
memoriesobject[]Account-wide memory entries
bitsobject[]Near-term tasks scored by date proximity and priority
bits[].idstringBit UUID
bits[].titlestringTask title
bits[].descriptionstring | nullShort task description
bits[].prioritystringPriority: p1, p2, p3, p4
bits[].scheduledForstring | nullISO date the bit is scheduled for
bits[].scorenumberComputed relevance score (higher = more urgent)
chainiesobject[]Active goal systems
chainies[].idstringChainy UUID
chainies[].titlestringGoal system title
chainies[].descriptionstring | nullGoal system vision or description
chainies[].statusstringAlways "active" in this response
Hata Yanıtları
StatusCodeDescription
400BAD_REQUESTchainyId was provided but is not a valid UUID
401UNAUTHORIZEDMissing or invalid JWT token
403FORBIDDENNo active AI entitlement
404NOT_FOUNDChainy not found or does not belong to the authenticated account

Kod Örnekleri

Chainy modunda, "chainyId" mevcut bir Chainy'nin "kimliği" olmalıdır - ör. Aşağıda "$CHAINY_ID" olarak gösterilen Create Chainy adresinden.

bash
curl "https://api.chainabit.com/api/v1/ai/chao/context?chainyId=$CHAINY_ID" \
  -H "Authorization: Bearer $TOKEN"
bash
curl "https://api.chainabit.com/api/v1/ai/chao/context" \
  -H "Authorization: Bearer $TOKEN"
javascript
const chainyId = process.env.CHAINY_ID; // id of the Chainy to resolve context for

// Chainy-scoped mode
const chainyRes = await fetch(
  `${BASE_URL}/ai/chao/context?chainyId=${chainyId}`,
  { headers: { Authorization: `Bearer ${TOKEN}` } },
);

// General mode
const generalRes = await fetch(
  `${BASE_URL}/ai/chao/context`,
  { headers: { Authorization: `Bearer ${TOKEN}` } },
);
python
import os
import requests

chainy_id = os.environ["CHAINY_ID"]  # id of the Chainy to resolve context for

# Chainy-scoped mode
chainy_res = requests.get(
    f"{BASE_URL}/ai/chao/context",
    params={"chainyId": chainy_id},
    headers={"Authorization": f"Bearer {TOKEN}"},
)

# General mode
general_res = requests.get(
    f"{BASE_URL}/ai/chao/context",
    headers={"Authorization": f"Bearer {TOKEN}"},
)

Built with purpose.