boly38 / botEnSky

BlueSky bot account that bring happiness to BlueSky users
https://bsky.app/profile/botensky.bsky.social
MIT License
0 stars 0 forks source link

Pl@ntNet - impossible de répondre au post - replyTo status:400 #36

Closed boly38 closed 1 month ago

boly38 commented 1 month ago

on SIMULATION, plantnet identification is OK

02-06-2024 12:21:26.650 [info ] 🧾️BotService - 🖥️ Plantnet  👤 REDACTED_IPS plugin result Post:
    https://bsky.app/profile/neoresistant.bsky.social/post/3ktutqfpfcc2x 2024-06-01 18:16:38 by @Jean Gautier   🐝🐢🦊🕊️ (https://bsky.app/profile/neoresistant.bsky.social) --- #FleurisTonFil
Le très joli compagnon blanc (ou silène blanche)
#photographie #photography
    SIMULATION - Réponse prévue : Pl@ntNet identifie (à 61.65%) Silene latifolia (fam Caryophyllaceae) com. Silène blanc, Compagnon blanc, Lychnide blanche
#BeSPlantnet #IndentificationDePlantes

but on ACTION,

(news) the bluesky replyTo failed

12:22:59 | impossible de répondre au post

(server) with 400 status

02-06-2024 12:22:53.927 [info ] 🧾️Pl@ntNet - 🖥️ Plantnet  👤 REDACTED_IPS 1 candidate(s)
02-06-2024 12:22:53.928 [info ] 🧾️PlantnetService - Pla@ntNet identify following image : https://cdn.bsky.app/img/feed_fullsize/plain/did:plc:umlxafzutkwwnbonfpz7iazr/bafkreigdzlgx4jgoraqun3loh7t54k2nla4k7qdtik2nk5jlurcbvjne74@jpeg
02-06-2024 12:22:59.296 [error] 🧾️Pl@ntNet - 🖥️ Plantnet  👤 REDACTED_IPS replyTo {
  "status": 400,
  "error": "InvalidRequest",
  "success": false,
  "headers": {
    "access-control-allow-origin": "*",
    "content-length": "132",
    "content-type": "application/json; charset=utf-8",
    "date": "Sun, 02 Jun 2024 10:22:59 GMT",
    "etag": "W/\"84-8F/JCt3SgfypR1VYxro03Yu5m2I\"",
    "keep-alive": "timeout=90",
    "ratelimit-limit": "5000",
    "ratelimit-policy": "5000;w=3600",
    "ratelimit-remaining": "4997",
    "ratelimit-reset": "1717327379",
    "strict-transport-security": "max-age=63072000",
    "vary": "Accept-Encoding",
    "x-powered-by": "Express"
  }
}
02-06-2024 12:22:59.297 [warn ] 🧾️BotService - 🖥️ Plantnet  👤 REDACTED_IPS  plugin error: impossible de répondre au post

TODO:

boly38 commented 1 month ago

Ooh .. 🤕 it seems that payload I'm using is soooo far from latest bluesky doc:

replyTo used EXTRACT OF FACETS:

  "text": "Pl@ntNet identifie (à 61.65%) Silene latifolia (fam Caryophyllaceae) com. Silène blanc, Compagnon blanc, Lychnide blanche\n\n#BeSPlantnet #IndentificationDePlantes",
  "facets": [
    {
      "index": {
        "start": 123,
        "end": 135
      },
      "type": "mention",
      "mention": {
        "name": "#BeSPlantnet"
      }
    },

but according to this doc and this doc

I must send this instead

  "text": "Pl@ntNet identifie (à 61.65%) Silene latifolia (fam Caryophyllaceae) com. Silène blanc, Compagnon blanc, Lychnide blanche\n\n#BeSPlantnet #IndentificationDePlantes",
  "facets": [
    {
      "index": {
        "byteStart": 123,
        "byteEnd": 135
      },
      features: [{
        $type: 'app.bsky.richtext.facet#tag',
        tag: '#BeSPlantnet'
      }]
    },

extract

  "text": "Pl@ntNet identifie (à 61.65%) Silene latifolia (fam Caryophyllaceae) com. Silène blanc, Compagnon blanc, Lychnide blanche\n\n#BeSPlantnet #IndentificationDePlantes",
  "facets": [
    {
      "index": {
        "byteStart": 125,
        "byteEnd": 137
      },