Zincirleme Analiz
İlerleme özetleri, model öngörüleri, sağlık puanları ve kurtarma planları oluşturmak için Chainy'nin zincir tamamlama verilerini analiz edin. Ayrıca, serbest metin açıklamasını sıralı alt bitlere bölen bir görev ayrıştırma uç noktasını da ortaya çıkarır.
Uç noktalar
| Method | Path | Description | Auth | Rate Limit |
|---|---|---|---|---|
| POST | /ai/chainy-analysis | Trigger analysis for a Chainy | JWT + Entitlement | 10/min |
| GET | /ai/chainy-analysis/:chainyId | List past analyses for a Chainy | JWT + Entitlement | 60/min |
| POST | /ai/chainy-analysis/bit-decomposition | Decompose a task into sub-bits | JWT + Entitlement | 10/min |
POST /ai/chainy-analysis
Chainy'nin yapay zeka analizini tetikleyin. Sonuçlar GET uç noktası aracılığıyla saklanır ve alınabilir.
Rica etmek
- Yetki: JWT Taşıyıcı jetonu + aktif AI yetkisi gerekli
- "chainyId" mevcut bir Chainy'nin "kimliği" olmalıdır - ör. Aşağıda "$CHAINY_ID" olarak gösterilen Create Chainy adresinden.
Talep Gövdesi
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
chainyId | string | Yes | Valid UUID | Chainy to analyse |
analysisType | string | Yes | See table below | Type of analysis to run |
Analiz Türleri
analysisType | Description |
|---|---|
progress | Summary stats: total chains, active count, total completions, average streak |
patterns | Temporal patterns: completion velocity, recent activity, chain distribution |
recommendations | Typed recommendation list (streak_recovery, get_started, maintain) |
decomposition | Chain listing with status for decomposition planning |
chainy_health | Composite health score (0–100): active chain ratio, streak health, velocity, fragmentation |
continuity | At-risk chain detection: chains at risk of streak break, broken, and strong performers |
blocker | Stall detection: chains with zero or declining progress |
routine | Time-of-day and day-of-week completion pattern analysis |
focus | Attention distribution: neglected vs over-served chains |
recovery | Structured recovery plan for broken streaks with prioritised next actions |
Cevap
Yanıt Örneği
json
{
"data": {
"id": "cm9analysis01",
"chainyId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"analysisType": "chainy_health",
"result": {
"healthScore": 74,
"signals": ["strong_streaks", "low_fragmentation"],
"breakdown": {
"activeChainRatio": 0.8,
"streakHealth": 0.9,
"velocity": 0.6,
"fragmentation": 0.2
}
},
"createdAt": "2026-05-22T10:00:00.000Z"
}
}Kod Örnekleri
bash
curl -X POST "$BASE_URL/ai/chainy-analysis" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"chainyId": "'"$CHAINY_ID"'",
"analysisType": "chainy_health"
}'javascript
const chainyId = process.env.CHAINY_ID; // id of the Chainy to analyze
const res = await fetch(`${BASE_URL}/ai/chainy-analysis`, {
method: "POST",
headers: {
Authorization: `Bearer ${TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
chainyId,
analysisType: "chainy_health",
}),
});
const { data } = await res.json();python
import os
import requests
chainy_id = os.environ["CHAINY_ID"] # id of the Chainy to analyze
res = requests.post(
f"{BASE_URL}/ai/chainy-analysis",
headers={"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"},
json={
"chainyId": chainy_id,
"analysisType": "chainy_health",
},
)
data = res.json()["data"]GET /ai/chainy-analysis/:chainyId
Belirli bir Chainy için geçmiş analizleri listeleyin. Kimliği doğrulanmış kullanıcıya yöneliktir.
Rica etmek
- Yetki: JWT Taşıyıcı jetonu + aktif AI yetkisi gerekli
- Yol parametreleri: "chainyId" — yukarıda analiz ettiğiniz aynı Chainy "id"sini (veya Create Chainy) adresinden herhangi bir Chainy "id"sini "$CHAINY_ID" olarak kullanın
Cevap
Yanıt Örneği
json
{
"data": [
{
"id": "cm9analysis01",
"chainyId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"analysisType": "chainy_health",
"result": { "healthScore": 74 },
"createdAt": "2026-05-22T10:00:00.000Z"
}
]
}Kod Örnekleri
bash
curl "$BASE_URL/ai/chainy-analysis/$CHAINY_ID" \
-H "Authorization: Bearer $TOKEN"javascript
const chainyId = process.env.CHAINY_ID; // id of the Chainy to list analyses for
const res = await fetch(`${BASE_URL}/ai/chainy-analysis/${chainyId}`, {
headers: { Authorization: `Bearer ${TOKEN}` },
});
const { data } = await res.json();python
import os
import requests
chainy_id = os.environ["CHAINY_ID"] # id of the Chainy to list analyses for
res = requests.get(
f"{BASE_URL}/ai/chainy-analysis/{chainy_id}",
headers={"Authorization": f"Bearer {TOKEN}"},
)
data = res.json()["data"]POST /ai/chainy-analysis/bit-decomposition
Serbest metin görev tanımını daha küçük, işlem yapılabilir alt bitlerden oluşan sıralı bir listeye bölün. İsteğe bağlı olarak daha fazla ayrıştırma için mevcut bir bitin kapsamına alınır.
Rica etmek
- Yetki: JWT Taşıyıcı jetonu + aktif AI yetkisi gerekli
- "chainId" mevcut bir zincirin "kimliği" olmalıdır - ör. Aşağıda "$CHAIN_ID" olarak gösterilen Zincir Oluştur adresinden.
Talep Gövdesi
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
chainId | string | Yes | Valid UUID | Chain that provides context for decomposition |
description | string | Yes | max 2000 chars | Task description to decompose |
bitId | string | No | Valid UUID | Existing bit to decompose further |
Cevap
Yanıt Örneği
json
{
"data": {
"suggestedBits": [
{ "title": "Choose CI/CD provider", "order": 1, "estimatedMinutes": 30 },
{ "title": "Configure build pipeline", "order": 2, "estimatedMinutes": 60 },
{ "title": "Add deployment stage", "order": 3, "estimatedMinutes": 45 },
{ "title": "Set up environment secrets", "order": 4, "estimatedMinutes": 20 },
{ "title": "Run first end-to-end deploy", "order": 5, "estimatedMinutes": 30 }
]
}
}Yanıt Alanları
| Field | Type | Description |
|---|---|---|
suggestedBits | object[] | Ordered list of suggested sub-tasks |
suggestedBits[].title | string | Sub-task title |
suggestedBits[].description | string | undefined | Optional elaboration |
suggestedBits[].estimatedMinutes | number | undefined | Time estimate |
suggestedBits[].order | number | Position in the sequence |
Kod Örnekleri
bash
curl -X POST "$BASE_URL/ai/chainy-analysis/bit-decomposition" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"chainId": "'"$CHAIN_ID"'",
"description": "Set up CI/CD pipeline for the mobile app"
}'javascript
const chainId = process.env.CHAIN_ID; // id of the chain that provides decomposition context
const res = await fetch(`${BASE_URL}/ai/chainy-analysis/bit-decomposition`, {
method: "POST",
headers: {
Authorization: `Bearer ${TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
chainId,
description: "Set up CI/CD pipeline for the mobile app",
}),
});
const { data } = await res.json();python
import os
import requests
chain_id = os.environ["CHAIN_ID"] # id of the chain that provides decomposition context
res = requests.post(
f"{BASE_URL}/ai/chainy-analysis/bit-decomposition",
headers={"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"},
json={
"chainId": chain_id,
"description": "Set up CI/CD pipeline for the mobile app",
},
)
data = res.json()["data"]Hata Yanıtları
| Status | Code | When |
|---|---|---|
| 400 | VALIDATION_FAILED | Missing required fields or invalid UUID |
| 403 | FORBIDDEN | Chainy or Chain does not belong to your account |
| 503 | SERVICE_UNAVAILABLE | No AI provider available |