Skip to content

Yapay Zeka Reaksiyonları

Yapay zeka çalıştırmalarına ve mesajlarına 10 reaksiyon türüyle tepki verin. Reaksiyonlar geçiş anlambilimini kullanır; aynı uç nokta bir reaksiyonu ekler veya kaldırır.

Uç noktalar

MethodPathDescriptionAuthRate Limit
POST/ai/reactions/toggleToggle a reactionJWT + Entitlement30/min
GET/ai/reactions/runs/:runIdGet reactions for a runJWT + Entitlement60/min
GET/ai/reactions/messages/:messageIdGet reactions for a messageJWT + Entitlement60/min
GET/ai/reactions/runs/:runId/statsAggregate stats for a runJWT + Entitlement60/min
GET/ai/reactions/messages/:messageId/statsAggregate stats for a messageJWT + Entitlement60/min
DELETE/ai/reactions/:idRemove a reaction by IDJWT + Entitlement30/min

Reaksiyon Türleri

TypeDescription
likeGeneral positive signal
dislikeGeneral negative signal
accurateFactually correct
creativeNovel or surprising
fastQuick response
helpfulDirectly useful
inspiringMotivating content
confusingHard to understand
wrongFactually incorrect
slowResponse took too long

POST /ai/reactions/toggle

Bir çalıştırma veya mesajdaki reaksiyonu değiştirin. Reaksiyon zaten mevcutsa kaldırılır. Eğer mevcut değilse eklenir.

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

Rica etmek

FieldTypeRequiredDescription
reactionTypestringYesOne of the 10 reaction types
runIdstringNoTarget run ID
messageIdstringNoTarget message ID
commentstringNoOptional comment (max 1000 chars, only for like/dislike)

Cevap

Yanıt Örneği (Eklendi)
json
{
  "data": {
    "action": "added",
    "reaction": {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "chainerId": "u1234567-abcd-ef01-2345-6789abcdef00",
      "reactionType": "helpful",
      "comment": null,
      "createdAt": "2026-03-17T14:00:00.000Z"
    }
  }
}
Yanıt Örneği (Kaldırıldı)
json
{
  "data": {
    "action": "removed"
  }
}
Yanıt Alanları
FieldTypeDescription
action"added" | "removed"Whether the reaction was created or deleted
reactionobject | undefinedThe created reaction (only when action is "added")
reaction.idstringReaction UUID
reaction.chainerIdstringUser who reacted
reaction.reactionTypestringThe reaction type
reaction.commentstring | nullOptional comment
reaction.createdAtstringISO 8601 timestamp

Kod Örnekleri

Mevcut bir AI çalışmasının "kimliğini" "$RUN_ID" olarak kullanın.

bash
curl -X POST https://api.chainabit.com/api/v1/ai/reactions/toggle \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "reactionType": "helpful",
    "runId": "'"$RUN_ID"'"
  }'
javascript
const runId = process.env.RUN_ID; // id of the AI run you're reacting to

const res = await fetch(`${BASE_URL}/ai/reactions/toggle`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    reactionType: "helpful",
    runId,
  }),
});
const { data } = await res.json();
python
import os
import requests

run_id = os.environ["RUN_ID"]  # id of the AI run you're reacting to

res = requests.post(
    f"{BASE_URL}/ai/reactions/toggle",
    headers={"Authorization": f"Bearer {TOKEN}"},
    json={
        "reactionType": "helpful",
        "runId": run_id,
    },
)
data = res.json()["data"]

GET /ai/reactions/runs/:runId

Bir çalıştırma için toplu reaksiyon istatistiklerini ve mevcut kullanıcının reaksiyonlarını alın.

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

Rica etmek

  • Yol parametreleri: runId

Cevap

Yanıt Örneği
json
{
  "data": {
    "stats": [
      { "reactionType": "helpful", "count": 12 },
      { "reactionType": "accurate", "count": 8 },
      { "reactionType": "like", "count": 5 }
    ],
    "userReactions": ["helpful", "like"]
  }
}
Yanıt Alanları
FieldTypeDescription
statsarrayAggregate counts per reaction type, sorted by count descending
stats[].reactionTypestringReaction type name
stats[].countnumberTotal reactions of this type
userReactionsstring[]Reaction types the current user has applied

Kod Örnekleri

Mevcut bir AI çalışmasının "kimliğini" "$RUN_ID" olarak kullanın.

bash
curl https://api.chainabit.com/api/v1/ai/reactions/runs/$RUN_ID \
  -H "Authorization: Bearer $TOKEN"
javascript
const runId = process.env.RUN_ID; // id of the AI run

const res = await fetch(
  `${BASE_URL}/ai/reactions/runs/${runId}`,
  { headers: { Authorization: `Bearer ${TOKEN}` } }
);
const { data } = await res.json();
python
import os
import requests

run_id = os.environ["RUN_ID"]  # id of the AI run

res = requests.get(
    f"{BASE_URL}/ai/reactions/runs/{run_id}",
    headers={"Authorization": f"Bearer {TOKEN}"},
)
data = res.json()["data"]

GET /ai/reactions/runs/:runId/stats

Kullanıcıya özel veriler olmadan bir çalıştırmanın toplam reaksiyon sayılarını alın.

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

Rica etmek

  • Yol parametreleri: runId

Cevap

Yanıt Örneği
json
{
  "data": {
    "stats": [
      { "reactionType": "helpful", "count": 12 },
      { "reactionType": "accurate", "count": 8 }
    ],
    "userReactions": []
  }
}

Kod Örnekleri

Mevcut bir AI çalışmasının "kimliğini" "$RUN_ID" olarak kullanın.

bash
curl https://api.chainabit.com/api/v1/ai/reactions/runs/$RUN_ID/stats \
  -H "Authorization: Bearer $TOKEN"
javascript
const runId = process.env.RUN_ID; // id of the AI run

const res = await fetch(
  `${BASE_URL}/ai/reactions/runs/${runId}/stats`,
  { headers: { Authorization: `Bearer ${TOKEN}` } }
);
const { data } = await res.json();
python
import os
import requests

run_id = os.environ["RUN_ID"]  # id of the AI run

res = requests.get(
    f"{BASE_URL}/ai/reactions/runs/{run_id}/stats",
    headers={"Authorization": f"Bearer {TOKEN}"},
)
data = res.json()["data"]

DELETE /ai/reactions/:id

Belirli bir reaksiyonu kimliğine göre kaldırın. Yalnızca reaksiyon sahibi bunu silebilir.

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

Rica etmek

  • Yol parametreleri: "kimlik"

Cevap

Yanıt Örneği
json
{
  "data": {
    "deleted": true
  }
}

Kod Örnekleri

Toggle Reaction'ın "eklenen" yanıtındaki (data.reaction.id) kimliğini $REACTION_ID olarak kullanın.

bash
curl -X DELETE https://api.chainabit.com/api/v1/ai/reactions/$REACTION_ID \
  -H "Authorization: Bearer $TOKEN"
javascript
const reactionId = process.env.REACTION_ID; // id from the "added" response of POST /ai/reactions/toggle

const res = await fetch(
  `${BASE_URL}/ai/reactions/${reactionId}`,
  {
    method: "DELETE",
    headers: { Authorization: `Bearer ${TOKEN}` },
  }
);
const { data } = await res.json();
python
import os
import requests

reaction_id = os.environ["REACTION_ID"]  # id from the "added" response of POST /ai/reactions/toggle

res = requests.delete(
    f"{BASE_URL}/ai/reactions/{reaction_id}",
    headers={"Authorization": f"Bearer {TOKEN}"},
)
data = res.json()["data"]

Built with purpose.