@oryksa/sdk 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.es.md CHANGED
@@ -1,91 +1,133 @@
1
- <p align="center"><img src="https://app.oryksa.com/static/oryksa_logo.png" width="300" alt="ORYKSA"></p>
2
-
3
- # @oryksa/sdk
4
-
5
- [![English](https://img.shields.io/badge/English-30363d?style=for-the-badge)](README.md) [![Português](https://img.shields.io/badge/Portugu%C3%AAs-30363d?style=for-the-badge)](README.pt.md) [![Español](https://img.shields.io/badge/Espa%C3%B1ol-0891b2?style=for-the-badge)](README.es.md) [![Français](https://img.shields.io/badge/Fran%C3%A7ais-30363d?style=for-the-badge)](README.fr.md)
6
-
7
- <p align="center"><a href="https://developer.oryksa.com/es/sdks"><img src="https://developer.oryksa.com/assets/img/sdk/oryksa-sdks-es.gif" width="760" alt="SDKs de ORYKSA: el chat y la voz de la IA en iOS, Android, Flutter, React Native y la web"></a></p>
8
-
9
- SDK oficial de JavaScript y TypeScript de **ORYKSA AI Employees**: pon un empleado de IA que ya conoce el negocio dentro de tu app web, tu backend Node o tu app de escritorio Electron. El mismo cerebro de WhatsApp y del chat del sitio web, en texto y voz.
10
-
11
- - Documentación: https://developer.oryksa.com
12
- - API: `https://api.oryksa.com/v1`
13
-
14
- ## Capturas de pantalla
15
-
16
- <p align="center"><img src="https://raw.githubusercontent.com/oryksa/oryksa-js/main/docs/screenshots/js_chat_en.png" width="420" alt="Chat"> <img src="https://raw.githubusercontent.com/oryksa/oryksa-js/main/docs/screenshots/js_theme_en.png" width="420" alt="Chat with the README theme"></p>
17
-
18
- Una página de tienda con `mountChat`, capturada por el CI en Chrome con una cuenta de prueba de ORYKSA (`test/shots.html`): colores por defecto a la izquierda y, a la derecha, el código de *Colores y tema*, más abajo.
19
-
20
- ## Instalar
21
-
22
- ```bash
23
- npm install @oryksa/sdk
24
- ```
25
-
26
- ## Servidor (clave secreta)
27
-
28
- ```js
29
- import { Oryksa } from "@oryksa/sdk";
30
- const oryksa = new Oryksa(process.env.ORYKSA_API_KEY); // developer.oryksa.com > Keys
31
-
32
- const r = await oryksa.chat({ message: "Are you open on Saturday?" });
33
- console.log(r.reply, r.conversation_id);
34
-
35
- // Teach the AI employee about your app (e.g. on every release)
36
- await oryksa.learnApp({
37
- name: "FitTrack",
38
- description: "Fitness app to log workouts and follow training plans.",
39
- screens: [{ title: "Workouts", content: "Tap + to log a workout." }],
40
- faq: [{ question: "How do I cancel Premium?", answer: "Settings > Subscription > Cancel." }],
41
- });
42
- ```
43
-
44
- ## En la app (token de sesión, nunca la clave secreta)
45
-
46
- ```js
47
- // your server
48
- app.get("/oryksa-token", requireLogin, async (req, res) => {
49
- const s = await oryksa.createSession({ conversationId: "user-" + req.user.id, customerName: req.user.firstName });
50
- res.json({ token: s.client_token });
51
- });
52
-
53
- // your web app
54
- import { OryksaClient, mountChat } from "@oryksa/sdk";
55
- const client = new OryksaClient({ getToken: async () => (await fetch("/oryksa-token").then(r => r.json())).token });
56
- mountChat({ client, lang: "en" }); // ready-made chat UI
57
- ```
58
-
59
- ## Colores y tema
60
-
61
- `mountChat` acepta tres colores como texto CSS: `accent` (botones, burbujas del visitante, enlaces), `ink` (texto principal) y `soft` (burbujas de la IA). Los que falten mantienen el valor por defecto (`#5B57E0`, `#161B3D` y `#EEEBFB`). `position` (`"left"` o `"right"`) elige el lado de la pantalla.
62
-
63
- ```js
64
- mountChat({ client, lang: "en", accent: "#0E8A6B", ink: "#10281F", soft: "#E3F5EE" });
65
- ```
66
-
67
- ## Webhooks
68
-
69
- ```js
70
- import { verifyWebhook } from "@oryksa/sdk";
71
- app.post("/oryksa-webhook", express.raw({ type: "application/json" }), async (req, res) => {
72
- const event = await verifyWebhook(req.body, req.get("ORYKSA-Signature"), process.env.ORYKSA_WEBHOOK_SECRET);
73
- if (event.type === "booking.created") { /* save it */ }
74
- res.sendStatus(200);
75
- });
76
- ```
77
-
78
- ## Errores
79
-
80
- Cada llamada que falla lanza `OryksaError` con `status`, `code` (por ejemplo `interaction_limit_reached`, `rate_limited`, `plan_required`) y `message`.
81
-
82
- ## Sobre el autor
83
-
84
- **Weslley Harakawa** - Fundador de ORYKSA AI. En Lisboa, Portugal. Especialidades: inteligencia artificial, desarrollo web y móvil, tokenización en blockchain. Formación: University of the People.
85
-
86
- - LinkedIn: https://www.linkedin.com/in/weslleyharakawa/
87
- - ORYKSA AI Employees: https://oryksa.com (X: https://x.com/oryksa, Instagram: https://www.instagram.com/oryksaai, YouTube: https://www.youtube.com/@ORYKSA)
88
-
89
- ---
90
-
91
- MIT License · ORYKSA AI Employees · W8 Atlantic Unipessoal Lda
1
+ <p align="center"><img src="https://app.oryksa.com/static/oryksa_logo.png" width="300" alt="ORYKSA"></p>
2
+
3
+ # @oryksa/sdk
4
+
5
+ [![English](https://img.shields.io/badge/English-30363d?style=for-the-badge)](README.md) [![Português](https://img.shields.io/badge/Portugu%C3%AAs-30363d?style=for-the-badge)](README.pt.md) [![Español](https://img.shields.io/badge/Espa%C3%B1ol-0891b2?style=for-the-badge)](README.es.md) [![Français](https://img.shields.io/badge/Fran%C3%A7ais-30363d?style=for-the-badge)](README.fr.md)
6
+
7
+ <p align="center"><a href="https://developer.oryksa.com/es/sdks"><img src="https://developer.oryksa.com/assets/img/sdk/oryksa-sdks-es.gif" width="760" alt="SDKs de ORYKSA: el chat y la voz de la IA en iOS, Android, Flutter, React Native y la web"></a></p>
8
+
9
+ SDK oficial de JavaScript y TypeScript de **ORYKSA AI Employees**: pon un empleado de IA que ya conoce el negocio dentro de tu app web, tu backend Node o tu app de escritorio Electron. El mismo cerebro de WhatsApp y del chat del sitio web, en texto y voz.
10
+
11
+ - Documentación: https://developer.oryksa.com
12
+ - API: `https://api.oryksa.com/v1`
13
+
14
+ ## Capturas de pantalla
15
+
16
+ <p align="center"><img src="https://raw.githubusercontent.com/oryksa/oryksa-js/main/docs/screenshots/js_chat_en.png" width="420" alt="Chat"> <img src="https://raw.githubusercontent.com/oryksa/oryksa-js/main/docs/screenshots/js_theme_en.png" width="420" alt="Chat with the README theme"></p>
17
+
18
+ Una página de tienda con `mountChat`, capturada por el CI en Chrome con una cuenta de prueba de ORYKSA (`test/shots.html`): colores por defecto a la izquierda y, a la derecha, el código de *Colores y tema*, más abajo.
19
+
20
+ ## Instalar
21
+
22
+ ```bash
23
+ npm install @oryksa/sdk
24
+ ```
25
+
26
+ ## Servidor (clave secreta)
27
+
28
+ ```js
29
+ import { Oryksa } from "@oryksa/sdk";
30
+ const oryksa = new Oryksa(process.env.ORYKSA_API_KEY); // developer.oryksa.com > Keys
31
+
32
+ const r = await oryksa.chat({ message: "Are you open on Saturday?" });
33
+ console.log(r.reply, r.conversation_id);
34
+
35
+ // Teach the AI employee about your app (e.g. on every release)
36
+ await oryksa.learnApp({
37
+ name: "FitTrack",
38
+ description: "Fitness app to log workouts and follow training plans.",
39
+ screens: [{ title: "Workouts", content: "Tap + to log a workout." }],
40
+ faq: [{ question: "How do I cancel Premium?", answer: "Settings > Subscription > Cancel." }],
41
+ });
42
+ ```
43
+
44
+ ## En la app (token de sesión, nunca la clave secreta)
45
+
46
+ ```js
47
+ // your server
48
+ app.get("/oryksa-token", requireLogin, async (req, res) => {
49
+ const s = await oryksa.createSession({ conversationId: "user-" + req.user.id, customerName: req.user.firstName });
50
+ res.json({ token: s.client_token });
51
+ });
52
+
53
+ // your web app
54
+ import { OryksaClient, mountChat } from "@oryksa/sdk";
55
+ const client = new OryksaClient({ getToken: async () => (await fetch("/oryksa-token").then(r => r.json())).token });
56
+ mountChat({ client, lang: "en" }); // ready-made chat UI
57
+ ```
58
+
59
+ ## Enlaces con botón Abrir (0.1.5)
60
+
61
+ Los enlaces que da la IA se pueden pulsar en el chat (direcciones web y e-mails), y cada enlace web tiene una tarjeta debajo de su respuesta con la foto y el título de la página y un botón **Abrir** (las páginas de tu propio sitio, los dominios de tu chat web; otros sitios muestran la dirección). Pasa `onLink` para abrir tus propias páginas, por ejemplo la página del producto: devuelve true cuando tu app lo abrió, false para abrirlo en una pestaña nueva.
62
+
63
+ ```js
64
+ mountChat({
65
+ client, lang: "es",
66
+ onLink: (url) => {
67
+ const id = myProductIdOf(url); // tus rutas
68
+ if (!id) return false;
69
+ router.push("/product/" + id);
70
+ return true;
71
+ },
72
+ });
73
+ ```
74
+
75
+ `client.linkPreview(url)` da el título y la foto de un enlace (`null` cuando no se puede leer); `linksIn(text)` y `withoutLinks(text)` también se exportan.
76
+
77
+ ## Adjuntar una foto o un documento (0.1.5)
78
+
79
+ El chat de `mountChat` tiene un botón para adjuntar: foto de la galería, cámara (móviles y tabletas) o documento (PDF, Word, texto, CSV). Las fotos se reducen antes de enviarse (hasta 2 MB); documentos hasta 8 MB. La IA ve la foto o lee el documento. Se desactiva con `attachments: false`. Por código: `client.send(texto, { image: { base64, mime } })` o `{ file: { base64, name, mime } }`.
80
+
81
+ ## Tus funciones de IA: `ai` (0.1.5)
82
+
83
+ Haz que la IA haga lo que tu app o web necesita (leer una foto, extraer datos, clasificar, traducir, escribir) y paga con interacciones ORYKSA: 1 por respuesta. Tu prompt y tu JSON Schema viven en tu código; basta el token de sesión (nunca lleves la clave secreta). No crea una conversación en tu bandeja.
84
+
85
+ ```js
86
+ const r = await client.ai({
87
+ instructions: "Read the tyre on the photo: brand, model and size exactly as written on the sidewall. " +
88
+ "If the size is not legible, readable=false and size=null. Never invent.",
89
+ images: [{ base64: photoBase64, mime: "image/jpeg" }], // resized to 1600 px
90
+ schema: {
91
+ type: "object",
92
+ properties: { readable: { type: "boolean" }, brand: { type: ["string", "null"] }, size: { type: ["string", "null"] } },
93
+ required: ["readable", "brand", "size"],
94
+ },
95
+ });
96
+ if (r.json?.readable) showProducts(r.json.size);
97
+ ```
98
+
99
+ `r.text` trae la respuesta en texto, `r.json` el objeto (con schema) y `r.interactionsSpent` las interacciones usadas. Cuando se agotan las interacciones del plan, la llamada falla con `OryksaError` status 402.
100
+
101
+ ## Colores y tema
102
+
103
+ `mountChat` acepta tres colores como texto CSS: `accent` (botones, burbujas del visitante, enlaces), `ink` (texto principal) y `soft` (burbujas de la IA). Los que falten mantienen el valor por defecto (`#5B57E0`, `#161B3D` y `#EEEBFB`). `position` (`"left"` o `"right"`) elige el lado de la pantalla.
104
+
105
+ ```js
106
+ mountChat({ client, lang: "en", accent: "#0E8A6B", ink: "#10281F", soft: "#E3F5EE" });
107
+ ```
108
+
109
+ ## Webhooks
110
+
111
+ ```js
112
+ import { verifyWebhook } from "@oryksa/sdk";
113
+ app.post("/oryksa-webhook", express.raw({ type: "application/json" }), async (req, res) => {
114
+ const event = await verifyWebhook(req.body, req.get("ORYKSA-Signature"), process.env.ORYKSA_WEBHOOK_SECRET);
115
+ if (event.type === "booking.created") { /* save it */ }
116
+ res.sendStatus(200);
117
+ });
118
+ ```
119
+
120
+ ## Errores
121
+
122
+ Cada llamada que falla lanza `OryksaError` con `status`, `code` (por ejemplo `interaction_limit_reached`, `rate_limited`, `plan_required`) y `message`.
123
+
124
+ ## Sobre el autor
125
+
126
+ **Weslley Harakawa** - Fundador de ORYKSA AI. En Lisboa, Portugal. Especialidades: inteligencia artificial, desarrollo web y móvil, tokenización en blockchain. Formación: University of the People.
127
+
128
+ - LinkedIn: https://www.linkedin.com/in/weslleyharakawa/
129
+ - ORYKSA AI Employees: https://oryksa.com (X: https://x.com/oryksa, Instagram: https://www.instagram.com/oryksaai, YouTube: https://www.youtube.com/@ORYKSA)
130
+
131
+ ---
132
+
133
+ MIT License · ORYKSA AI Employees · W8 Atlantic Unipessoal Lda
package/README.fr.md CHANGED
@@ -1,91 +1,133 @@
1
- <p align="center"><img src="https://app.oryksa.com/static/oryksa_logo.png" width="300" alt="ORYKSA"></p>
2
-
3
- # @oryksa/sdk
4
-
5
- [![English](https://img.shields.io/badge/English-30363d?style=for-the-badge)](README.md) [![Português](https://img.shields.io/badge/Portugu%C3%AAs-30363d?style=for-the-badge)](README.pt.md) [![Español](https://img.shields.io/badge/Espa%C3%B1ol-30363d?style=for-the-badge)](README.es.md) [![Français](https://img.shields.io/badge/Fran%C3%A7ais-0891b2?style=for-the-badge)](README.fr.md)
6
-
7
- <p align="center"><a href="https://developer.oryksa.com/fr/sdks"><img src="https://developer.oryksa.com/assets/img/sdk/oryksa-sdks-fr.gif" width="760" alt="SDK ORYKSA : le chat et la voix de l'IA sur iOS, Android, Flutter, React Native et le web"></a></p>
8
-
9
- SDK officiel JavaScript et TypeScript d'**ORYKSA AI Employees** : placez un employé IA qui connaît déjà l'entreprise dans votre app web, votre backend Node ou votre app de bureau Electron. Le même cerveau que WhatsApp et le chat du site web, en texte et en voix.
10
-
11
- - Documentation : https://developer.oryksa.com
12
- - API : `https://api.oryksa.com/v1`
13
-
14
- ## Captures d'écran
15
-
16
- <p align="center"><img src="https://raw.githubusercontent.com/oryksa/oryksa-js/main/docs/screenshots/js_chat_en.png" width="420" alt="Chat"> <img src="https://raw.githubusercontent.com/oryksa/oryksa-js/main/docs/screenshots/js_theme_en.png" width="420" alt="Chat with the README theme"></p>
17
-
18
- Une page de boutique avec `mountChat`, capturée par la CI dans Chrome avec un compte de test ORYKSA (`test/shots.html`) : couleurs par défaut à gauche et, à droite, le code de *Couleurs et thème*, plus bas.
19
-
20
- ## Installer
21
-
22
- ```bash
23
- npm install @oryksa/sdk
24
- ```
25
-
26
- ## Serveur (clé secrète)
27
-
28
- ```js
29
- import { Oryksa } from "@oryksa/sdk";
30
- const oryksa = new Oryksa(process.env.ORYKSA_API_KEY); // developer.oryksa.com > Keys
31
-
32
- const r = await oryksa.chat({ message: "Are you open on Saturday?" });
33
- console.log(r.reply, r.conversation_id);
34
-
35
- // Teach the AI employee about your app (e.g. on every release)
36
- await oryksa.learnApp({
37
- name: "FitTrack",
38
- description: "Fitness app to log workouts and follow training plans.",
39
- screens: [{ title: "Workouts", content: "Tap + to log a workout." }],
40
- faq: [{ question: "How do I cancel Premium?", answer: "Settings > Subscription > Cancel." }],
41
- });
42
- ```
43
-
44
- ## Dans l'app (jeton de session, jamais la clé secrète)
45
-
46
- ```js
47
- // your server
48
- app.get("/oryksa-token", requireLogin, async (req, res) => {
49
- const s = await oryksa.createSession({ conversationId: "user-" + req.user.id, customerName: req.user.firstName });
50
- res.json({ token: s.client_token });
51
- });
52
-
53
- // your web app
54
- import { OryksaClient, mountChat } from "@oryksa/sdk";
55
- const client = new OryksaClient({ getToken: async () => (await fetch("/oryksa-token").then(r => r.json())).token });
56
- mountChat({ client, lang: "en" }); // ready-made chat UI
57
- ```
58
-
59
- ## Couleurs et thème
60
-
61
- `mountChat` accepte trois couleurs en texte CSS : `accent` (boutons, bulles du visiteur, liens), `ink` (texte principal) et `soft` (bulles de l'IA). Celles qui manquent gardent la valeur par défaut (`#5B57E0`, `#161B3D` et `#EEEBFB`). `position` (`"left"` ou `"right"`) choisit le côté de l'écran.
62
-
63
- ```js
64
- mountChat({ client, lang: "en", accent: "#0E8A6B", ink: "#10281F", soft: "#E3F5EE" });
65
- ```
66
-
67
- ## Webhooks
68
-
69
- ```js
70
- import { verifyWebhook } from "@oryksa/sdk";
71
- app.post("/oryksa-webhook", express.raw({ type: "application/json" }), async (req, res) => {
72
- const event = await verifyWebhook(req.body, req.get("ORYKSA-Signature"), process.env.ORYKSA_WEBHOOK_SECRET);
73
- if (event.type === "booking.created") { /* save it */ }
74
- res.sendStatus(200);
75
- });
76
- ```
77
-
78
- ## Erreurs
79
-
80
- Chaque appel qui échoue lève `OryksaError` avec `status`, `code` (par exemple `interaction_limit_reached`, `rate_limited`, `plan_required`) et `message`.
81
-
82
- ## À propos de l'auteur
83
-
84
- **Weslley Harakawa** - Fondateur d'ORYKSA AI. À Lisbonne, Portugal. Spécialités : intelligence artificielle, développement web et mobile, tokenisation blockchain. Formation : University of the People.
85
-
86
- - LinkedIn: https://www.linkedin.com/in/weslleyharakawa/
87
- - ORYKSA AI Employees: https://oryksa.com (X: https://x.com/oryksa, Instagram: https://www.instagram.com/oryksaai, YouTube: https://www.youtube.com/@ORYKSA)
88
-
89
- ---
90
-
91
- MIT License · ORYKSA AI Employees · W8 Atlantic Unipessoal Lda
1
+ <p align="center"><img src="https://app.oryksa.com/static/oryksa_logo.png" width="300" alt="ORYKSA"></p>
2
+
3
+ # @oryksa/sdk
4
+
5
+ [![English](https://img.shields.io/badge/English-30363d?style=for-the-badge)](README.md) [![Português](https://img.shields.io/badge/Portugu%C3%AAs-30363d?style=for-the-badge)](README.pt.md) [![Español](https://img.shields.io/badge/Espa%C3%B1ol-30363d?style=for-the-badge)](README.es.md) [![Français](https://img.shields.io/badge/Fran%C3%A7ais-0891b2?style=for-the-badge)](README.fr.md)
6
+
7
+ <p align="center"><a href="https://developer.oryksa.com/fr/sdks"><img src="https://developer.oryksa.com/assets/img/sdk/oryksa-sdks-fr.gif" width="760" alt="SDK ORYKSA : le chat et la voix de l'IA sur iOS, Android, Flutter, React Native et le web"></a></p>
8
+
9
+ SDK officiel JavaScript et TypeScript d'**ORYKSA AI Employees** : placez un employé IA qui connaît déjà l'entreprise dans votre app web, votre backend Node ou votre app de bureau Electron. Le même cerveau que WhatsApp et le chat du site web, en texte et en voix.
10
+
11
+ - Documentation : https://developer.oryksa.com
12
+ - API : `https://api.oryksa.com/v1`
13
+
14
+ ## Captures d'écran
15
+
16
+ <p align="center"><img src="https://raw.githubusercontent.com/oryksa/oryksa-js/main/docs/screenshots/js_chat_en.png" width="420" alt="Chat"> <img src="https://raw.githubusercontent.com/oryksa/oryksa-js/main/docs/screenshots/js_theme_en.png" width="420" alt="Chat with the README theme"></p>
17
+
18
+ Une page de boutique avec `mountChat`, capturée par la CI dans Chrome avec un compte de test ORYKSA (`test/shots.html`) : couleurs par défaut à gauche et, à droite, le code de *Couleurs et thème*, plus bas.
19
+
20
+ ## Installer
21
+
22
+ ```bash
23
+ npm install @oryksa/sdk
24
+ ```
25
+
26
+ ## Serveur (clé secrète)
27
+
28
+ ```js
29
+ import { Oryksa } from "@oryksa/sdk";
30
+ const oryksa = new Oryksa(process.env.ORYKSA_API_KEY); // developer.oryksa.com > Keys
31
+
32
+ const r = await oryksa.chat({ message: "Are you open on Saturday?" });
33
+ console.log(r.reply, r.conversation_id);
34
+
35
+ // Teach the AI employee about your app (e.g. on every release)
36
+ await oryksa.learnApp({
37
+ name: "FitTrack",
38
+ description: "Fitness app to log workouts and follow training plans.",
39
+ screens: [{ title: "Workouts", content: "Tap + to log a workout." }],
40
+ faq: [{ question: "How do I cancel Premium?", answer: "Settings > Subscription > Cancel." }],
41
+ });
42
+ ```
43
+
44
+ ## Dans l'app (jeton de session, jamais la clé secrète)
45
+
46
+ ```js
47
+ // your server
48
+ app.get("/oryksa-token", requireLogin, async (req, res) => {
49
+ const s = await oryksa.createSession({ conversationId: "user-" + req.user.id, customerName: req.user.firstName });
50
+ res.json({ token: s.client_token });
51
+ });
52
+
53
+ // your web app
54
+ import { OryksaClient, mountChat } from "@oryksa/sdk";
55
+ const client = new OryksaClient({ getToken: async () => (await fetch("/oryksa-token").then(r => r.json())).token });
56
+ mountChat({ client, lang: "en" }); // ready-made chat UI
57
+ ```
58
+
59
+ ## Liens avec un bouton pour les ouvrir (0.1.5)
60
+
61
+ Les liens que donne l'IA se cliquent dans le chat (adresses web et e-mails), et chaque lien web a une carte sous sa réponse avec la photo et le titre de la page et un bouton pour l'ouvrir (les pages de votre propre site, les domaines de votre chat web ; les autres sites montrent l'adresse). Passez `onLink` pour ouvrir vos propres pages, par exemple la page du produit : renvoyez true quand votre app l'a ouvert, false pour l'ouvrir dans un nouvel onglet.
62
+
63
+ ```js
64
+ mountChat({
65
+ client, lang: "en",
66
+ onLink: (url) => {
67
+ const id = myProductIdOf(url); // vos routes
68
+ if (!id) return false;
69
+ router.push("/product/" + id);
70
+ return true;
71
+ },
72
+ });
73
+ ```
74
+
75
+ `client.linkPreview(url)` donne le titre et la photo d'un lien (`null` quand il ne peut pas être lu) ; `linksIn(text)` et `withoutLinks(text)` sont aussi exportés.
76
+
77
+ ## Joindre une photo ou un document (0.1.5)
78
+
79
+ Le chat de `mountChat` a un bouton pour joindre : photo de la galerie, appareil photo (téléphones et tablettes) ou document (PDF, Word, texte, CSV). Les photos sont réduites avant l'envoi (jusqu'à 2 Mo) ; documents jusqu'à 8 Mo. L'IA regarde la photo ou lit le document. À désactiver avec `attachments: false`. Par code : `client.send(texte, { image: { base64, mime } })` ou `{ file: { base64, name, mime } }`.
80
+
81
+ ## Vos propres fonctions d'IA : `ai` (0.1.5)
82
+
83
+ Faites faire à l'IA ce dont votre app ou site a besoin (lire une photo, extraire des données, classer, traduire, rédiger) et payez en interactions ORYKSA : 1 par réponse. Votre prompt et votre JSON Schema restent dans votre code ; le jeton de session suffit (n'embarquez jamais la clé secrète). Aucune conversation n'est créée dans votre boîte.
84
+
85
+ ```js
86
+ const r = await client.ai({
87
+ instructions: "Read the tyre on the photo: brand, model and size exactly as written on the sidewall. " +
88
+ "If the size is not legible, readable=false and size=null. Never invent.",
89
+ images: [{ base64: photoBase64, mime: "image/jpeg" }], // resized to 1600 px
90
+ schema: {
91
+ type: "object",
92
+ properties: { readable: { type: "boolean" }, brand: { type: ["string", "null"] }, size: { type: ["string", "null"] } },
93
+ required: ["readable", "brand", "size"],
94
+ },
95
+ });
96
+ if (r.json?.readable) showProducts(r.json.size);
97
+ ```
98
+
99
+ `r.text` contient la réponse en texte, `r.json` l'objet (avec un schema) et `r.interactionsSpent` les interactions utilisées. Quand les interactions du forfait sont épuisées, l'appel échoue avec `OryksaError` status 402.
100
+
101
+ ## Couleurs et thème
102
+
103
+ `mountChat` accepte trois couleurs en texte CSS : `accent` (boutons, bulles du visiteur, liens), `ink` (texte principal) et `soft` (bulles de l'IA). Celles qui manquent gardent la valeur par défaut (`#5B57E0`, `#161B3D` et `#EEEBFB`). `position` (`"left"` ou `"right"`) choisit le côté de l'écran.
104
+
105
+ ```js
106
+ mountChat({ client, lang: "en", accent: "#0E8A6B", ink: "#10281F", soft: "#E3F5EE" });
107
+ ```
108
+
109
+ ## Webhooks
110
+
111
+ ```js
112
+ import { verifyWebhook } from "@oryksa/sdk";
113
+ app.post("/oryksa-webhook", express.raw({ type: "application/json" }), async (req, res) => {
114
+ const event = await verifyWebhook(req.body, req.get("ORYKSA-Signature"), process.env.ORYKSA_WEBHOOK_SECRET);
115
+ if (event.type === "booking.created") { /* save it */ }
116
+ res.sendStatus(200);
117
+ });
118
+ ```
119
+
120
+ ## Erreurs
121
+
122
+ Chaque appel qui échoue lève `OryksaError` avec `status`, `code` (par exemple `interaction_limit_reached`, `rate_limited`, `plan_required`) et `message`.
123
+
124
+ ## À propos de l'auteur
125
+
126
+ **Weslley Harakawa** - Fondateur d'ORYKSA AI. À Lisbonne, Portugal. Spécialités : intelligence artificielle, développement web et mobile, tokenisation blockchain. Formation : University of the People.
127
+
128
+ - LinkedIn: https://www.linkedin.com/in/weslleyharakawa/
129
+ - ORYKSA AI Employees: https://oryksa.com (X: https://x.com/oryksa, Instagram: https://www.instagram.com/oryksaai, YouTube: https://www.youtube.com/@ORYKSA)
130
+
131
+ ---
132
+
133
+ MIT License · ORYKSA AI Employees · W8 Atlantic Unipessoal Lda