feat: PC7 chatbot V1 onglet centre HAUT + endpoint Astro proxy SSR

- ChatbotV2.vue : Vue island, thread chat (input + messages bot/user),
  persistance sessionStorage, bandeau beta '120 fiches AEP, RAG-PE bientot',
  gestion erreurs 429/502/504 ; pas de streaming ni markdown V1
- /api/chatbot.ts : endpoint Astro server proxy POST vers CHATBOT_UPSTREAM
  (default https://aep.trans-former.fr/api/chatbot), timeout 25s,
  body { question, history } -> upstream classique chatbot AEP Mistral Small
- astro.config.mjs : output 'server' + adapter @astrojs/node standalone
  (Astro 6 a supprime mode hybrid ; on opt-in prerender sur les pages)
- Toutes les pages publiques (index, manifeste, manifeste/commander,
  a-propos, mentions-legales) ont 'export const prerender = true'
- ColCentre.astro : remplace ChatbotPlaceholder par ChatbotV2 dans le tab
- .env.example : ajoute CHATBOT_UPSTREAM (V1.5 = switch LightRAG-PE 1 ligne)

Decision V1 : endpoint AEP /api/chatbot (classique, repond bien) au lieu
de /api/chatbot-v2 qui retourne v2_ready=false ('base vectorielle en cours').
Bandeau beta reste valide ; switch v2 quand ready cote AEP via env var.

Note PC8 deploy : Coolify doit booter avec 'node ./dist/server/entry.mjs'
(SSR Node standalone) au lieu de servir dist/client/ static.

Test end-to-end OK : SSR boot port 4399 + curl POST /api/chatbot ->
reponse_texte 800+ chars de l'AEP backend.
This commit is contained in:
Jules Neny
2026-05-09 01:22:01 +02:00
parent fccbc6d19c
commit be7fc09085
13 changed files with 719 additions and 255 deletions

View File

@@ -8,3 +8,8 @@ PUBLIC_BEHOLD_JULESNENY=
# Journal unifie (PC6) - URL JSON agrege par n8n cron nocturne
# Override en local : pointer vers un mock /public/data/journal.json par exemple
PUBLIC_JOURNAL_URL=https://data.trans-former.fr/journal.json
# Chatbot upstream (PC7) - URL backend chatbot AEP
# V1 : chatbot AEP classique (Mistral Small + 120 fiches)
# V1.5 : switch vers LightRAG-PE (1 ligne)
CHATBOT_UPSTREAM=https://aep.trans-former.fr/api/chatbot

View File

@@ -1,10 +1,15 @@
// @ts-check
import { defineConfig } from 'astro/config';
import vue from '@astrojs/vue';
import node from '@astrojs/node';
import tailwindcss from '@tailwindcss/vite';
// https://astro.build/config
// PC7 — bascule SSR (mode 'server' Astro 6) pour endpoint /api/chatbot proxy.
// Toutes les pages publiques restent statiques via `export const prerender = true`.
// Coolify deploy (PC8) : `node ./dist/server/entry.mjs` (Node adapter standalone).
export default defineConfig({
output: 'server',
adapter: node({ mode: 'standalone' }),
integrations: [vue()],
vite: {
plugins: [tailwindcss()],

191
package-lock.json generated
View File

@@ -8,6 +8,7 @@
"name": "astro-site-cerveau",
"version": "0.0.1",
"dependencies": {
"@astrojs/node": "^10.1.0",
"@astrojs/vue": "^6.0.1",
"@tailwindcss/vite": "^4.2.4",
"@types/d3": "^7.4.3",
@@ -67,6 +68,20 @@
"vfile": "^6.0.3"
}
},
"node_modules/@astrojs/node": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/@astrojs/node/-/node-10.1.0.tgz",
"integrity": "sha512-4/2oqUTQ71UQ8+xX249T4l/d0/YkC5ssOVl4R2yQO7Wg4mOnvsq9Z9iaTkWAyElg3lqZq7XRNCEXCmDNiYcW1A==",
"license": "MIT",
"dependencies": {
"@astrojs/internal-helpers": "0.9.0",
"send": "^1.2.1",
"server-destroy": "^1.0.1"
},
"peerDependencies": {
"astro": "^6.3.0"
}
},
"node_modules/@astrojs/prism": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-4.0.1.tgz",
@@ -3853,6 +3868,15 @@
"robust-predicates": "^3.0.2"
}
},
"node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/dequal": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
@@ -3981,6 +4005,12 @@
"node": ">=4"
}
},
"node_modules/ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
"license": "MIT"
},
"node_modules/electron-to-chromium": {
"version": "1.5.352",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.352.tgz",
@@ -4015,6 +4045,15 @@
"vue": "^3.2.37"
}
},
"node_modules/encodeurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/enhanced-resolve": {
"version": "5.21.2",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.21.2.tgz",
@@ -4105,6 +4144,12 @@
"node": ">=6"
}
},
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
"license": "MIT"
},
"node_modules/escape-string-regexp": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz",
@@ -4136,6 +4181,15 @@
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"license": "MIT"
},
"node_modules/etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/eventemitter3": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz",
@@ -4268,6 +4322,15 @@
"node": ">=20"
}
},
"node_modules/fresh": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
"integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
@@ -4609,6 +4672,26 @@
"integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==",
"license": "BSD-2-Clause"
},
"node_modules/http-errors": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
"license": "MIT",
"dependencies": {
"depd": "~2.0.0",
"inherits": "~2.0.4",
"setprototypeof": "~1.2.0",
"statuses": "~2.0.2",
"toidentifier": "~1.0.1"
},
"engines": {
"node": ">= 0.8"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
@@ -4630,6 +4713,12 @@
"node": ">= 4"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"license": "ISC"
},
"node_modules/internmap": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz",
@@ -5972,6 +6061,31 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/mime-db": {
"version": "1.54.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz",
"integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==",
"license": "MIT",
"dependencies": {
"mime-db": "^1.54.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/mrmime": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz",
@@ -6093,6 +6207,18 @@
"integrity": "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==",
"license": "MIT"
},
"node_modules/on-finished": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
"license": "MIT",
"dependencies": {
"ee-first": "1.1.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/oniguruma-parser": {
"version": "0.12.2",
"resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.2.tgz",
@@ -6316,6 +6442,15 @@
"integrity": "sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA==",
"license": "MIT"
},
"node_modules/range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/readdirp": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.0.0.tgz",
@@ -6712,6 +6847,44 @@
"node": ">=10"
}
},
"node_modules/send": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz",
"integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==",
"license": "MIT",
"dependencies": {
"debug": "^4.4.3",
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"etag": "^1.8.1",
"fresh": "^2.0.0",
"http-errors": "^2.0.1",
"mime-types": "^3.0.2",
"ms": "^2.1.3",
"on-finished": "^2.4.1",
"range-parser": "^1.2.1",
"statuses": "^2.0.2"
},
"engines": {
"node": ">= 18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/server-destroy": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/server-destroy/-/server-destroy-1.0.1.tgz",
"integrity": "sha512-rb+9B5YBIEzYcD6x2VKidaa+cqYBJQKnU4oe4E3ANwRRN56yk/ua1YCJT1n21NTS8w6CcOclAKNP3PhdCXKYtQ==",
"license": "ISC"
},
"node_modules/setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
"license": "ISC"
},
"node_modules/sharp": {
"version": "0.34.5",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.34.5.tgz",
@@ -6845,6 +7018,15 @@
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
"license": "BSD-3-Clause"
},
"node_modules/statuses": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/stringify-entities": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz",
@@ -6964,6 +7146,15 @@
"node": ">=8.0"
}
},
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
"license": "MIT",
"engines": {
"node": ">=0.6"
}
},
"node_modules/totalist": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz",

View File

@@ -15,6 +15,7 @@
"build:carte-o": "node scripts/build-carte-o.js"
},
"dependencies": {
"@astrojs/node": "^10.1.0",
"@astrojs/vue": "^6.0.1",
"@tailwindcss/vite": "^4.2.4",
"@types/d3": "^7.4.3",

View File

@@ -1,6 +1,6 @@
{
"meta": {
"generated": "2026-05-08T22:56:53.553Z",
"generated": "2026-05-08T23:20:14.828Z",
"source": "AEP/Articles",
"nodeCount": 84,
"edgeCount": 94,
@@ -25,19 +25,19 @@
"TR - renovation-energetique - website pro.md": 1,
"AEP ARTICLES, BROUILLON": 6,
"Livre - le nouveau contrat social": 2,
"AEP agriculture": 1,
"AEP archi": 4,
"AEP déconstruction": 9,
"AEP agriculture": 1,
"AEP géopolitique": 3,
"AEP education": 4,
"AEP justice": 3,
"AEP IA": 14,
"AEP nouveaux récits": 9,
"AEP histoire": 7,
"AEP IA": 14,
"AEP géopolitique": 3,
"AEP justice": 3,
"AEP piraterie (script formation)": 2,
"AEP nouveaux récits": 9,
"AEP politique": 3,
"AEP santé": 6,
"AEP regénération": 3,
"AEP santé": 6,
"AEP spiritualité": 1,
"AEP système économique": 4
}
@@ -142,6 +142,15 @@
"theme": "Livre - le nouveau contrat social",
"path": "Livre - le nouveau contrat social/AEP - article fiscalite contrat social.md"
},
{
"id": "aep-agriculture",
"label": "AEP Agriculture",
"family": "methode",
"intention": "Contrat social : les agriculteurs, àvalorises par autre chose que les produits quil créent. Besoin que ça soit le moins cher possible",
"slug": "aep-agriculture",
"theme": "AEP agriculture",
"path": "AEP ARTICLES, BROUILLON/AEP agriculture/AEP Agriculture.md"
},
{
"id": "aep-beton-critique",
"label": "AEP Béton - critique",
@@ -223,42 +232,6 @@
"theme": "AEP déconstruction",
"path": "AEP ARTICLES, BROUILLON/AEP déconstruction/AEP humour - manifeste brouillon.md"
},
{
"id": "aep-agriculture",
"label": "AEP Agriculture",
"family": "methode",
"intention": "Contrat social : les agriculteurs, àvalorises par autre chose que les produits quil créent. Besoin que ça soit le moins cher possible",
"slug": "aep-agriculture",
"theme": "AEP agriculture",
"path": "AEP ARTICLES, BROUILLON/AEP agriculture/AEP Agriculture.md"
},
{
"id": "2025-07-05-juan-branco-thinker-view-ep-2-30-06-2025",
"label": "2025-07-05 Juan branco - thinker view - ep 2 30-06-2025",
"family": "penseur",
"intention": "Juan branco - thinker view - ep 2, 30/06/2025",
"slug": "2025-07-05-juan-branco-thinker-view-ep-2-30-06-2025",
"theme": "AEP géopolitique",
"path": "AEP ARTICLES, BROUILLON/AEP géopolitique/2025-07-05 Juan branco - thinker view - ep 2 30-06-2025.md"
},
{
"id": "aep-israel-palestine-conflit-brut",
"label": "AEP Israel - Palestine, conflit (brut)",
"family": "penseur",
"intention": "Depuis lattaque du 7 octobre 2023 par le Hamas, qui a fait environ 1 200 morts israéliens, l'État dIsraël, dirigé par Benyamin Netanyahou, a lancé une campagne militaire dune intensité sans précédent contre la bande d",
"slug": "aep-israel-palestine-conflit-brut",
"theme": "AEP géopolitique",
"path": "AEP ARTICLES, BROUILLON/AEP géopolitique/AEP Israel - Palestine, conflit (brut).md"
},
{
"id": "aep-politique-energie-fr",
"label": "AEP Politique Énergie FR",
"family": "methode",
"intention": "MOC : Architecture technique d'ATISPOLITIQUETRANSMETTRE Source : Discussion Álvaro Projet: PFE - Infolettre AEP! AEP émerger une nouvelle pratiqueAEP Politique Énergie FR Tags : #contenu/infolettre #contenu/manifeste #co",
"slug": "aep-politique-energie-fr",
"theme": "AEP géopolitique",
"path": "AEP ARTICLES, BROUILLON/AEP géopolitique/AEP Politique Énergie FR.md"
},
{
"id": "aep-cooperation",
"label": "AEP Coopération",
@@ -295,123 +268,6 @@
"theme": "AEP education",
"path": "AEP ARTICLES, BROUILLON/AEP education/Mémorisation - discussion train.md"
},
{
"id": "aep-justice-securite",
"label": "AEP justice & sécurité",
"family": "penseur",
"intention": "MOC : POLITIQUE-AEP 1 Source : divers Projets : AEP articles, idées en gestation-AEP tableau des articles Tags : #contenu/article Date : 2025-10-31 Justice/droit Juan Branco réformes structurelles https://www.youtube.com",
"slug": "aep-justice-securite",
"theme": "AEP justice",
"path": "AEP ARTICLES, BROUILLON/AEP justice/AEP justice & sécurité.md"
},
{
"id": "crepuscule-juan-branco-itw",
"label": "Crépuscule - Juan branco - ITW",
"family": "penseur",
"intention": "Crépuscule - Juan branco - podcast - thinkerview",
"slug": "crepuscule-juan-branco-itw",
"theme": "AEP justice",
"path": "AEP ARTICLES, BROUILLON/AEP justice/Crépuscule - Juan branco - ITW.md"
},
{
"id": "narcotrafic",
"label": "Narcotrafic",
"family": "collectif",
"intention": "Ces frontières sont valorisées dans les médias par la dramaturgie de postures martiales mettant en valeur des politiciens, doublées de menaces a l'ordre social, et a la stigmatisation de groupes sociaux (racailles, bande",
"slug": "narcotrafic",
"theme": "AEP justice",
"path": "AEP ARTICLES, BROUILLON/AEP justice/Narcotrafic.md"
},
{
"id": "2026-03-11-aep-ia-usage-sage-intention",
"label": "2026-03-11 AEP IA usage sage intention",
"family": "ressource",
"intention": "MOC : Transcriptions Projets : AEP - IA - usage sage Date : 2026-03-11 Durée : 9m 18s · groq récap de la conversation sur l'IA super cool qu'on a eue avec Issa, envie de poser ça comme base de la future formation IA de N",
"slug": "2026-03-11-aep-ia-usage-sage-intention",
"theme": "AEP IA",
"path": "AEP ARTICLES, BROUILLON/AEP IA/2026-03-11 AEP IA usage sage intention.md"
},
{
"id": "aep-ia-usage-sage",
"label": "AEP - IA - usage sage",
"family": "methode",
"intention": "MOC : ORGANISATION-PFE - Infolettre AEP Source : Ines Lee [\"oops i become codependent on IA\"](https://ineslee.substack.com/p/ai-codependence) + Tyler Austin Harper, The Atlantic, \"[what happens when people don't undersan",
"slug": "aep-ia-usage-sage",
"theme": "AEP IA",
"path": "AEP ARTICLES, BROUILLON/AEP IA/AEP - IA - usage sage.md"
},
{
"id": "anthropic-revolution-ia-2026",
"label": "Anthropic, révolution IA 2026",
"family": "concept",
"intention": "révolution d'anthropic via cowork, claude code & opus.",
"slug": "anthropic-revolution-ia-2026",
"theme": "AEP IA",
"path": "AEP ARTICLES, BROUILLON/AEP IA/Anthropic, révolution IA 2026.md"
},
{
"id": "ia-usage-sage-sven-et-lucie",
"label": "IA usage sage Sven et Lucie",
"family": "ressource",
"intention": "Voici la retranscription d'un article que j'aimerais écrire sur l'usage de l'IA. Et c'était un rendez-vous la semaine dernière avec Zden et Lucie, qui nous a permis pendant deux heures de traverser des sujets importants ",
"slug": "ia-usage-sage-sven-et-lucie",
"theme": "AEP IA",
"path": "AEP ARTICLES, BROUILLON/AEP IA/IA usage sage Sven et Lucie.md"
},
{
"id": "manifeste-anti-iag",
"label": "Manifeste anti-IAg",
"family": "ressource",
"intention": "[Vous pouvez signer ce manifeste ([version pdf ici](https://atecopol.hypotheses.org/files/2025/12/ManifesteObjectionConscienceIAg.pdf)) dans [ce formulaire](https://framaforms.org/face-a-lia-generative-lobjection-de-cons",
"slug": "manifeste-anti-iag",
"theme": "AEP IA",
"path": "AEP ARTICLES, BROUILLON/AEP IA/Manifeste anti-IAg.md"
},
{
"id": "aep-culture-dominante-analyse-series",
"label": "AEP culture dominante (analyse séries)",
"family": "concept",
"intention": "\"grands récits\" - star wars - le seigneur des anneaux - dune !Post Dune- avis critique.m4a - harry potter - eragon (le livre plus que le film) - one piece - naruto - Arcane : !Arcanes feedback série.m4a = parallèle avec ",
"slug": "aep-culture-dominante-analyse-series",
"theme": "AEP nouveaux récits",
"path": "AEP ARTICLES, BROUILLON/AEP nouveaux récits/AEP culture dominante (analyse séries).md"
},
{
"id": "aep-medias-la-pensee-critique",
"label": "AEP médias & la pensée critique",
"family": "methode",
"intention": "MOC : POLITIQUE-PFE - Infolettre AEP Source : https://mythodologie.fr/ Projets : NAAV - apprendre a apprendre-cours de transformation urbaine- Tags : Date : 2025-06-19 une note expliquant les bases de l'intelligence crit",
"slug": "aep-medias-la-pensee-critique",
"theme": "AEP nouveaux récits",
"path": "AEP ARTICLES, BROUILLON/AEP nouveaux récits/AEP médias & la pensée critique.md"
},
{
"id": "aep-prospective",
"label": "AEP prospective",
"family": "penseur",
"intention": "En lien avec Tout pour tout le monde - ITW - prospective",
"slug": "aep-prospective",
"theme": "AEP nouveaux récits",
"path": "AEP ARTICLES, BROUILLON/AEP nouveaux récits/AEP prospective.md"
},
{
"id": "aep-ecrire-de-nouveaux-recits",
"label": "AEP écrire de nouveaux récits",
"family": "ressource",
"intention": "MOC : POLITIQUETRANSMETTRE- ART-FACILITATION Projets : Stratégie création de contenu PFE - Infolettre AEP AEP éducation-L'art du récit (storytelling) Tags : #contenu/article Date : 2024-03-23 # Projets d'écriture 1. LIVR",
"slug": "aep-ecrire-de-nouveaux-recits",
"theme": "AEP nouveaux récits",
"path": "AEP ARTICLES, BROUILLON/AEP nouveaux récits/AEP écrire de nouveaux récits.md"
},
{
"id": "archetypes-eneagramme",
"label": "Archétypes - énéagramme",
"family": "collectif",
"intention": "MOC : LITTERATURE-écrivain-ART-SPIRITUALITE Source : Annif Flo 44 ans - orga Projets : AEP écrire de nouveaux récits-LIVRE - le nouveau contrat social Tags : Date : 2025-10-31 note sur l'étude des personnages d'un récit/",
"slug": "archetypes-eneagramme",
"theme": "AEP nouveaux récits",
"path": "AEP ARTICLES, BROUILLON/AEP nouveaux récits/Archétypes - énéagramme.md"
},
{
"id": "aep-histoire",
"label": "AEP Histoire",
@@ -475,6 +331,105 @@
"theme": "AEP histoire",
"path": "AEP ARTICLES, BROUILLON/AEP histoire/Lempire na jamais pris fin 6 -.md"
},
{
"id": "2026-03-11-aep-ia-usage-sage-intention",
"label": "2026-03-11 AEP IA usage sage intention",
"family": "ressource",
"intention": "MOC : Transcriptions Projets : AEP - IA - usage sage Date : 2026-03-11 Durée : 9m 18s · groq récap de la conversation sur l'IA super cool qu'on a eue avec Issa, envie de poser ça comme base de la future formation IA de N",
"slug": "2026-03-11-aep-ia-usage-sage-intention",
"theme": "AEP IA",
"path": "AEP ARTICLES, BROUILLON/AEP IA/2026-03-11 AEP IA usage sage intention.md"
},
{
"id": "aep-ia-usage-sage",
"label": "AEP - IA - usage sage",
"family": "methode",
"intention": "MOC : ORGANISATION-PFE - Infolettre AEP Source : Ines Lee [\"oops i become codependent on IA\"](https://ineslee.substack.com/p/ai-codependence) + Tyler Austin Harper, The Atlantic, \"[what happens when people don't undersan",
"slug": "aep-ia-usage-sage",
"theme": "AEP IA",
"path": "AEP ARTICLES, BROUILLON/AEP IA/AEP - IA - usage sage.md"
},
{
"id": "anthropic-revolution-ia-2026",
"label": "Anthropic, révolution IA 2026",
"family": "concept",
"intention": "révolution d'anthropic via cowork, claude code & opus.",
"slug": "anthropic-revolution-ia-2026",
"theme": "AEP IA",
"path": "AEP ARTICLES, BROUILLON/AEP IA/Anthropic, révolution IA 2026.md"
},
{
"id": "ia-usage-sage-sven-et-lucie",
"label": "IA usage sage Sven et Lucie",
"family": "ressource",
"intention": "Voici la retranscription d'un article que j'aimerais écrire sur l'usage de l'IA. Et c'était un rendez-vous la semaine dernière avec Zden et Lucie, qui nous a permis pendant deux heures de traverser des sujets importants ",
"slug": "ia-usage-sage-sven-et-lucie",
"theme": "AEP IA",
"path": "AEP ARTICLES, BROUILLON/AEP IA/IA usage sage Sven et Lucie.md"
},
{
"id": "manifeste-anti-iag",
"label": "Manifeste anti-IAg",
"family": "ressource",
"intention": "[Vous pouvez signer ce manifeste ([version pdf ici](https://atecopol.hypotheses.org/files/2025/12/ManifesteObjectionConscienceIAg.pdf)) dans [ce formulaire](https://framaforms.org/face-a-lia-generative-lobjection-de-cons",
"slug": "manifeste-anti-iag",
"theme": "AEP IA",
"path": "AEP ARTICLES, BROUILLON/AEP IA/Manifeste anti-IAg.md"
},
{
"id": "2025-07-05-juan-branco-thinker-view-ep-2-30-06-2025",
"label": "2025-07-05 Juan branco - thinker view - ep 2 30-06-2025",
"family": "penseur",
"intention": "Juan branco - thinker view - ep 2, 30/06/2025",
"slug": "2025-07-05-juan-branco-thinker-view-ep-2-30-06-2025",
"theme": "AEP géopolitique",
"path": "AEP ARTICLES, BROUILLON/AEP géopolitique/2025-07-05 Juan branco - thinker view - ep 2 30-06-2025.md"
},
{
"id": "aep-israel-palestine-conflit-brut",
"label": "AEP Israel - Palestine, conflit (brut)",
"family": "penseur",
"intention": "Depuis lattaque du 7 octobre 2023 par le Hamas, qui a fait environ 1 200 morts israéliens, l'État dIsraël, dirigé par Benyamin Netanyahou, a lancé une campagne militaire dune intensité sans précédent contre la bande d",
"slug": "aep-israel-palestine-conflit-brut",
"theme": "AEP géopolitique",
"path": "AEP ARTICLES, BROUILLON/AEP géopolitique/AEP Israel - Palestine, conflit (brut).md"
},
{
"id": "aep-politique-energie-fr",
"label": "AEP Politique Énergie FR",
"family": "methode",
"intention": "MOC : Architecture technique d'ATISPOLITIQUETRANSMETTRE Source : Discussion Álvaro Projet: PFE - Infolettre AEP! AEP émerger une nouvelle pratiqueAEP Politique Énergie FR Tags : #contenu/infolettre #contenu/manifeste #co",
"slug": "aep-politique-energie-fr",
"theme": "AEP géopolitique",
"path": "AEP ARTICLES, BROUILLON/AEP géopolitique/AEP Politique Énergie FR.md"
},
{
"id": "aep-justice-securite",
"label": "AEP justice & sécurité",
"family": "penseur",
"intention": "MOC : POLITIQUE-AEP 1 Source : divers Projets : AEP articles, idées en gestation-AEP tableau des articles Tags : #contenu/article Date : 2025-10-31 Justice/droit Juan Branco réformes structurelles https://www.youtube.com",
"slug": "aep-justice-securite",
"theme": "AEP justice",
"path": "AEP ARTICLES, BROUILLON/AEP justice/AEP justice & sécurité.md"
},
{
"id": "crepuscule-juan-branco-itw",
"label": "Crépuscule - Juan branco - ITW",
"family": "penseur",
"intention": "Crépuscule - Juan branco - podcast - thinkerview",
"slug": "crepuscule-juan-branco-itw",
"theme": "AEP justice",
"path": "AEP ARTICLES, BROUILLON/AEP justice/Crépuscule - Juan branco - ITW.md"
},
{
"id": "narcotrafic",
"label": "Narcotrafic",
"family": "collectif",
"intention": "Ces frontières sont valorisées dans les médias par la dramaturgie de postures martiales mettant en valeur des politiciens, doublées de menaces a l'ordre social, et a la stigmatisation de groupes sociaux (racailles, bande",
"slug": "narcotrafic",
"theme": "AEP justice",
"path": "AEP ARTICLES, BROUILLON/AEP justice/Narcotrafic.md"
},
{
"id": "creation-de-script-template",
"label": "Création de script - template",
@@ -493,6 +448,51 @@
"theme": "AEP piraterie (script formation)",
"path": "AEP ARTICLES, BROUILLON/AEP piraterie (script formation)/methodologie_developpement.md"
},
{
"id": "aep-culture-dominante-analyse-series",
"label": "AEP culture dominante (analyse séries)",
"family": "concept",
"intention": "\"grands récits\" - star wars - le seigneur des anneaux - dune !Post Dune- avis critique.m4a - harry potter - eragon (le livre plus que le film) - one piece - naruto - Arcane : !Arcanes feedback série.m4a = parallèle avec ",
"slug": "aep-culture-dominante-analyse-series",
"theme": "AEP nouveaux récits",
"path": "AEP ARTICLES, BROUILLON/AEP nouveaux récits/AEP culture dominante (analyse séries).md"
},
{
"id": "aep-medias-la-pensee-critique",
"label": "AEP médias & la pensée critique",
"family": "methode",
"intention": "MOC : POLITIQUE-PFE - Infolettre AEP Source : https://mythodologie.fr/ Projets : NAAV - apprendre a apprendre-cours de transformation urbaine- Tags : Date : 2025-06-19 une note expliquant les bases de l'intelligence crit",
"slug": "aep-medias-la-pensee-critique",
"theme": "AEP nouveaux récits",
"path": "AEP ARTICLES, BROUILLON/AEP nouveaux récits/AEP médias & la pensée critique.md"
},
{
"id": "aep-prospective",
"label": "AEP prospective",
"family": "penseur",
"intention": "En lien avec Tout pour tout le monde - ITW - prospective",
"slug": "aep-prospective",
"theme": "AEP nouveaux récits",
"path": "AEP ARTICLES, BROUILLON/AEP nouveaux récits/AEP prospective.md"
},
{
"id": "aep-ecrire-de-nouveaux-recits",
"label": "AEP écrire de nouveaux récits",
"family": "ressource",
"intention": "MOC : POLITIQUETRANSMETTRE- ART-FACILITATION Projets : Stratégie création de contenu PFE - Infolettre AEP AEP éducation-L'art du récit (storytelling) Tags : #contenu/article Date : 2024-03-23 # Projets d'écriture 1. LIVR",
"slug": "aep-ecrire-de-nouveaux-recits",
"theme": "AEP nouveaux récits",
"path": "AEP ARTICLES, BROUILLON/AEP nouveaux récits/AEP écrire de nouveaux récits.md"
},
{
"id": "archetypes-eneagramme",
"label": "Archétypes - énéagramme",
"family": "collectif",
"intention": "MOC : LITTERATURE-écrivain-ART-SPIRITUALITE Source : Annif Flo 44 ans - orga Projets : AEP écrire de nouveaux récits-LIVRE - le nouveau contrat social Tags : Date : 2025-10-31 note sur l'étude des personnages d'un récit/",
"slug": "archetypes-eneagramme",
"theme": "AEP nouveaux récits",
"path": "AEP ARTICLES, BROUILLON/AEP nouveaux récits/Archétypes - énéagramme.md"
},
{
"id": "5-chantiers-mamdani-nyc",
"label": "5 chantiers Mamdani NYC",
@@ -520,6 +520,33 @@
"theme": "AEP politique",
"path": "AEP ARTICLES, BROUILLON/AEP politique/AEP politique - état des lieux.md"
},
{
"id": "aep-regen-fertival",
"label": "AEP - Regen - fertival",
"family": "methode",
"intention": "MOC : FACILITATION-Agroforesterie- Source : Sacha Gouttenoire Projets : Fertival 2025-PFE - Infolettre AEP Tags : Date : 2025-05-02 10.03.23 article phare sur la pratique de la regénération naturelle, une pratique illust",
"slug": "aep-regen-fertival",
"theme": "AEP regénération",
"path": "AEP ARTICLES, BROUILLON/AEP regénération/! AEP - Regen - fertival.md"
},
{
"id": "aep-emerger-une-nouvelle-pratique",
"label": "AEP émerger une nouvelle pratique",
"family": "methode",
"intention": "MOC : POLITIQUEArchitecture technique d'ATIS Source : Projets : faire émerger une nouvelle pratique de l'architecture Tags : Date : 2024-11-11 projet principal d'énonciation d'une théorie de la transformation ! Structure",
"slug": "aep-emerger-une-nouvelle-pratique",
"theme": "AEP regénération",
"path": "AEP ARTICLES, BROUILLON/AEP regénération/! AEP émerger une nouvelle pratique.md"
},
{
"id": "aep-mdcs-medecine-du-corps-social",
"label": "AEP mdcs - Médecine du corps social",
"family": "methode",
"intention": "Note capitalisme socialisme 3ème voie ? Communes, local briser pyramide colonialiste, troisième voie, rendre local l'indispensable, et global le spécifique.",
"slug": "aep-mdcs-medecine-du-corps-social",
"theme": "AEP regénération",
"path": "AEP ARTICLES, BROUILLON/AEP regénération/AEP mdcs - Médecine du corps social.md"
},
{
"id": "aep-fiscalite-contrat-social",
"label": "AEP fiscalité - contrat social",
@@ -574,33 +601,6 @@
"theme": "AEP santé",
"path": "AEP ARTICLES, BROUILLON/AEP santé/Qualité de vie EU vs USA - art. mindvalley.md"
},
{
"id": "aep-regen-fertival",
"label": "AEP - Regen - fertival",
"family": "methode",
"intention": "MOC : FACILITATION-Agroforesterie- Source : Sacha Gouttenoire Projets : Fertival 2025-PFE - Infolettre AEP Tags : Date : 2025-05-02 10.03.23 article phare sur la pratique de la regénération naturelle, une pratique illust",
"slug": "aep-regen-fertival",
"theme": "AEP regénération",
"path": "AEP ARTICLES, BROUILLON/AEP regénération/! AEP - Regen - fertival.md"
},
{
"id": "aep-emerger-une-nouvelle-pratique",
"label": "AEP émerger une nouvelle pratique",
"family": "methode",
"intention": "MOC : POLITIQUEArchitecture technique d'ATIS Source : Projets : faire émerger une nouvelle pratique de l'architecture Tags : Date : 2024-11-11 projet principal d'énonciation d'une théorie de la transformation ! Structure",
"slug": "aep-emerger-une-nouvelle-pratique",
"theme": "AEP regénération",
"path": "AEP ARTICLES, BROUILLON/AEP regénération/! AEP émerger une nouvelle pratique.md"
},
{
"id": "aep-mdcs-medecine-du-corps-social",
"label": "AEP mdcs - Médecine du corps social",
"family": "methode",
"intention": "Note capitalisme socialisme 3ème voie ? Communes, local briser pyramide colonialiste, troisième voie, rendre local l'indispensable, et global le spécifique.",
"slug": "aep-mdcs-medecine-du-corps-social",
"theme": "AEP regénération",
"path": "AEP ARTICLES, BROUILLON/AEP regénération/AEP mdcs - Médecine du corps social.md"
},
{
"id": "aep-spiritualite",
"label": "AEP spiritualité",
@@ -1029,22 +1029,6 @@
"source": "aep-dec-l-inconfort-la-solitude-crise-d-identite",
"target": "aep-rite-passage-age-adulte"
},
{
"source": "aep-israel-palestine-conflit-brut",
"target": "aep-ia-usage-sage"
},
{
"source": "aep-israel-palestine-conflit-brut",
"target": "crepuscule-juan-branco-itw"
},
{
"source": "aep-israel-palestine-conflit-brut",
"target": "aep-justice-securite"
},
{
"source": "aep-politique-energie-fr",
"target": "aep-emerger-une-nouvelle-pratique"
},
{
"source": "aep-education",
"target": "aep-ecrire-de-nouveaux-recits"
@@ -1053,46 +1037,6 @@
"source": "aep-education",
"target": "aep-medias-la-pensee-critique"
},
{
"source": "crepuscule-juan-branco-itw",
"target": "aep-politique-etat-des-lieux"
},
{
"source": "crepuscule-juan-branco-itw",
"target": "aep-medias-la-pensee-critique"
},
{
"source": "2026-03-11-aep-ia-usage-sage-intention",
"target": "aep-ia-usage-sage"
},
{
"source": "aep-ia-usage-sage",
"target": "aep-medias-la-pensee-critique"
},
{
"source": "manifeste-anti-iag",
"target": "aep-ia-usage-sage"
},
{
"source": "aep-culture-dominante-analyse-series",
"target": "aep-ecrire-de-nouveaux-recits"
},
{
"source": "aep-prospective",
"target": "aep-mdcs-medecine-du-corps-social"
},
{
"source": "aep-ecrire-de-nouveaux-recits",
"target": "l-empire-n-a-jamais-pris-fin-6"
},
{
"source": "archetypes-eneagramme",
"target": "aep-ecrire-de-nouveaux-recits"
},
{
"source": "archetypes-eneagramme",
"target": "livre-le-nouveau-contrat-social"
},
{
"source": "aep-histoire",
"target": "aep-ecrire-de-nouveaux-recits"
@@ -1121,6 +1065,70 @@
"source": "aep-histoire",
"target": "l-empire-n-a-jamais-pris-fin-5-cathares"
},
{
"source": "2026-03-11-aep-ia-usage-sage-intention",
"target": "aep-ia-usage-sage"
},
{
"source": "aep-ia-usage-sage",
"target": "aep-medias-la-pensee-critique"
},
{
"source": "manifeste-anti-iag",
"target": "aep-ia-usage-sage"
},
{
"source": "aep-israel-palestine-conflit-brut",
"target": "aep-ia-usage-sage"
},
{
"source": "aep-israel-palestine-conflit-brut",
"target": "crepuscule-juan-branco-itw"
},
{
"source": "aep-israel-palestine-conflit-brut",
"target": "aep-justice-securite"
},
{
"source": "aep-politique-energie-fr",
"target": "aep-emerger-une-nouvelle-pratique"
},
{
"source": "crepuscule-juan-branco-itw",
"target": "aep-politique-etat-des-lieux"
},
{
"source": "crepuscule-juan-branco-itw",
"target": "aep-medias-la-pensee-critique"
},
{
"source": "aep-culture-dominante-analyse-series",
"target": "aep-ecrire-de-nouveaux-recits"
},
{
"source": "aep-prospective",
"target": "aep-mdcs-medecine-du-corps-social"
},
{
"source": "aep-ecrire-de-nouveaux-recits",
"target": "l-empire-n-a-jamais-pris-fin-6"
},
{
"source": "archetypes-eneagramme",
"target": "aep-ecrire-de-nouveaux-recits"
},
{
"source": "archetypes-eneagramme",
"target": "livre-le-nouveau-contrat-social"
},
{
"source": "aep-emerger-une-nouvelle-pratique",
"target": "l-empire-n-a-jamais-pris-fin-6"
},
{
"source": "aep-mdcs-medecine-du-corps-social",
"target": "livre-le-nouveau-contrat-social"
},
{
"source": "aep-fiscalite-contrat-social",
"target": "livre-le-nouveau-contrat-social"
@@ -1137,14 +1145,6 @@
"source": "aep-performance-douce",
"target": "aep-sante-mentale-burn-out"
},
{
"source": "aep-emerger-une-nouvelle-pratique",
"target": "l-empire-n-a-jamais-pris-fin-6"
},
{
"source": "aep-mdcs-medecine-du-corps-social",
"target": "livre-le-nouveau-contrat-social"
},
{
"source": "aep-spiritualite",
"target": "aep-histoire"

View File

@@ -1,8 +1,8 @@
---
// Centre - HAUT : tabs (Carte O mindmap | Chatbot RAG placeholder PC7).
// Centre - HAUT : tabs (Carte O mindmap | Chatbot RAG branche PC7).
// BAS : iframe carte AEP + scroll articles Substack (PC4).
import CarteOWrapper from '../vue/CarteOWrapper.vue';
import ChatbotPlaceholder from '../vue/ChatbotPlaceholder.vue';
import ChatbotV2 from '../vue/ChatbotV2.vue';
import IframeCarteAEP from './IframeCarteAEP.astro';
import ScrollArticles from './ScrollArticles.astro';
---
@@ -51,7 +51,7 @@ import ScrollArticles from './ScrollArticles.astro';
data-tab-panel="chatbot"
class="absolute inset-0 hidden"
>
<ChatbotPlaceholder client:visible />
<ChatbotV2 client:visible />
</div>
</div>
</section>

View File

@@ -0,0 +1,187 @@
<script setup lang="ts">
// PC7 — Chatbot V1 brancha sur endpoint AEP (proxy Astro server-side).
// Persistance thread sessionStorage. Bandeau beta info ; pas de streaming, pas de markdown V1.
import { ref, onMounted, nextTick, useTemplateRef } from 'vue'
interface Msg {
role: 'user' | 'bot'
content: string
ts: number
}
const props = defineProps<{ apiUrl?: string }>()
const messages = ref<Msg[]>([])
const input = ref('')
const sending = ref(false)
const errorBanner = ref('')
const threadEl = useTemplateRef<HTMLElement>('threadEl')
const STORAGE_KEY = 'tf-chatbot-v2-thread'
const ENDPOINT = props.apiUrl || '/api/chatbot'
onMounted(() => {
try {
const saved = sessionStorage.getItem(STORAGE_KEY)
if (saved) messages.value = JSON.parse(saved)
} catch {
// sessionStorage indisponible ; on ignore.
}
})
const persist = () => {
try {
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(messages.value))
} catch {
// ignore
}
}
const scrollToBottom = async () => {
await nextTick()
const el = threadEl.value
if (el) el.scrollTo({ top: el.scrollHeight, behavior: 'smooth' })
}
const send = async () => {
const q = input.value.trim()
if (!q || sending.value) return
messages.value.push({ role: 'user', content: q, ts: Date.now() })
input.value = ''
sending.value = true
errorBanner.value = ''
persist()
scrollToBottom()
try {
const res = await fetch(ENDPOINT, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
question: q,
history: messages.value.slice(-10).map((m) => ({ role: m.role, content: m.content })),
}),
})
if (!res.ok) {
if (res.status === 429) {
errorBanner.value = 'Limite de questions atteinte ; ressaie plus tard.'
} else if (res.status === 502 || res.status === 504) {
errorBanner.value = "Le service de chat n'est pas joignable ; ressaie dans un instant."
} else {
errorBanner.value = `Erreur ${res.status} ; ressaie ou recharge la page.`
}
sending.value = false
return
}
const data = await res.json()
const answer =
data.reponse_texte ||
data.answer ||
data.text ||
data.message ||
'Pas de reponse.'
messages.value.push({ role: 'bot', content: answer, ts: Date.now() })
} catch (e) {
errorBanner.value = "Probleme reseau ; verifie ta connexion."
messages.value.push({
role: 'bot',
content: `Erreur : ${(e as Error).message || 'inconnue'}`,
ts: Date.now(),
})
} finally {
sending.value = false
persist()
scrollToBottom()
}
}
const reset = () => {
messages.value = []
errorBanner.value = ''
persist()
}
</script>
<template>
<div class="h-full flex flex-col bg-white">
<div class="bg-amber-50 border-b border-amber-200 px-3 py-2 text-xs text-amber-900 leading-snug">
<span class="font-medium">Beta :</span> 120 fiches AEP indexees (Mistral Small) ; bientot RAG-PE multi-corpus.
</div>
<div
v-if="errorBanner"
class="bg-rose-50 border-b border-rose-200 px-3 py-2 text-xs text-rose-800"
role="alert"
>
{{ errorBanner }}
</div>
<div
ref="threadEl"
class="flex-1 overflow-y-auto px-3 py-3 space-y-3"
role="log"
aria-live="polite"
>
<p
v-if="!messages.length"
class="text-neutral-400 text-sm italic text-center mt-8 px-4"
>
Pose une question sur l'AEP ; le manifeste ; les agences locales...
</p>
<div
v-for="m in messages"
:key="m.ts"
:class="[
'max-w-[85%] rounded-lg px-3 py-2 text-sm leading-relaxed whitespace-pre-wrap break-words',
m.role === 'user'
? 'bg-neutral-900 text-white ml-auto'
: 'bg-neutral-100 text-neutral-800 mr-auto',
]"
>
{{ m.content }}
</div>
<div
v-if="sending"
class="bg-neutral-100 max-w-[60%] rounded-lg px-3 py-2 text-sm text-neutral-500 italic mr-auto"
>
Le bot reflechit...
</div>
</div>
<form
class="border-t border-neutral-200 p-2 flex gap-2 items-stretch"
@submit.prevent="send"
>
<input
v-model="input"
type="text"
placeholder="Ta question..."
:disabled="sending"
class="flex-1 px-3 py-2 border border-neutral-300 rounded-lg text-sm focus:outline-none focus:border-neutral-900 disabled:opacity-60"
aria-label="Saisis ta question"
/>
<button
type="submit"
:disabled="sending || !input.trim()"
class="px-3 py-2 bg-neutral-900 text-white rounded-lg text-sm font-medium disabled:opacity-50"
>
Envoyer
</button>
<button
v-if="messages.length"
type="button"
class="px-2 py-2 text-neutral-500 text-xs hover:text-neutral-900 underline"
@click="reset"
>
Reset
</button>
</form>
</div>
</template>

View File

@@ -1,4 +1,6 @@
---
export const prerender = true;
import BaseLayout from '../layouts/BaseLayout.astro';
import HamburgerMenu from '../components/astro/HamburgerMenu.astro';
---

65
src/pages/api/chatbot.ts Normal file
View File

@@ -0,0 +1,65 @@
// PC7 — Endpoint proxy POST /api/chatbot
// Forward la question vers CHATBOT_UPSTREAM (default : aep.trans-former.fr/api/chatbot).
// Tunnel CORS (l'upstream ne sert pas de header CORS pour trans-former.fr) + timeout 25s.
import type { APIRoute } from 'astro'
export const prerender = false
const UPSTREAM =
import.meta.env.CHATBOT_UPSTREAM || 'https://aep.trans-former.fr/api/chatbot'
const TIMEOUT_MS = 25_000
const jsonResponse = (status: number, payload: unknown) =>
new Response(JSON.stringify(payload), {
status,
headers: { 'Content-Type': 'application/json; charset=utf-8' },
})
export const POST: APIRoute = async ({ request }) => {
let body: { question?: string; q?: string; history?: unknown }
try {
body = await request.json()
} catch {
return jsonResponse(400, { error: 'invalid_json' })
}
const question = (body.question || body.q || '').toString().trim()
if (!question) {
return jsonResponse(400, { error: 'missing_question' })
}
const ctrl = new AbortController()
const timer = setTimeout(() => ctrl.abort(), TIMEOUT_MS)
try {
const upstream = await fetch(UPSTREAM, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
question,
history: Array.isArray(body.history) ? body.history : [],
}),
signal: ctrl.signal,
})
clearTimeout(timer)
const text = await upstream.text()
const contentType =
upstream.headers.get('content-type') || 'application/json; charset=utf-8'
return new Response(text, {
status: upstream.status,
headers: { 'Content-Type': contentType },
})
} catch (e) {
clearTimeout(timer)
const err = e as Error
const aborted = err.name === 'AbortError'
return jsonResponse(aborted ? 504 : 502, {
error: aborted ? 'upstream_timeout' : 'upstream_failed',
detail: err.message || 'unknown',
})
}
}

View File

@@ -1,4 +1,6 @@
---
export const prerender = true;
import BaseLayout from '../layouts/BaseLayout.astro';
import ColJournal from '../components/astro/ColJournal.astro';
import ColCentre from '../components/astro/ColCentre.astro';

View File

@@ -1,4 +1,6 @@
---
export const prerender = true;
import BaseLayout from '../layouts/BaseLayout.astro';
import HamburgerMenu from '../components/astro/HamburgerMenu.astro';
---

View File

@@ -1,4 +1,6 @@
---
export const prerender = true;
import BaseLayout from '../../layouts/BaseLayout.astro';
import HamburgerMenu from '../../components/astro/HamburgerMenu.astro';
---

View File

@@ -1,4 +1,6 @@
---
export const prerender = true;
import BaseLayout from '../layouts/BaseLayout.astro';
import HamburgerMenu from '../components/astro/HamburgerMenu.astro';
---