strapi-plugin-mcp-chat 0.5.0 → 0.6.0
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/admin/src/components/AdminOverlays.tsx +8 -18
- package/admin/src/components/FloatingChat.tsx +70 -3
- package/dist/server/index.js +436 -213
- package/package.json +1 -1
- package/server/src/content-tools.ts +4 -2
- package/server/src/controllers/chat.ts +2 -2
- package/server/src/index.ts +8 -1
- package/server/src/provision/infer.ts +92 -20
- package/server/src/provision/link.ts +232 -35
- package/server/src/provision/orchestrate.ts +4 -3
- package/server/src/provision/runner.ts +44 -1
- package/server/src/services/chat.ts +8 -2
|
@@ -25,6 +25,12 @@ type ChatInput = {
|
|
|
25
25
|
lang?: Lang;
|
|
26
26
|
/** URL da página aberta no preview — contexto do "isso aqui". */
|
|
27
27
|
previewUrl?: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* Status do preview atual: 'draft' (toggle de rascunho ligado) ou 'published'
|
|
30
|
+
* (live). A busca de texto segue ESTE modo — acha rascunho quando em draft, e
|
|
31
|
+
* o conteúdo no ar quando em live. Default 'draft'.
|
|
32
|
+
*/
|
|
33
|
+
previewStatus?: 'draft' | 'published';
|
|
28
34
|
/**
|
|
29
35
|
* Política de publicação. `false` (default) = modo RASCUNHO: o agente edita o
|
|
30
36
|
* draft e NÃO publica, a menos que o usuário peça explicitamente. `true` =
|
|
@@ -103,7 +109,7 @@ Be concise and actionable. ALWAYS answer in English.`,
|
|
|
103
109
|
};
|
|
104
110
|
|
|
105
111
|
export default ({ strapi }: { strapi: any }) => ({
|
|
106
|
-
async chat({ messages, image, lang = 'pt', previewUrl, autoPublish = false }: ChatInput) {
|
|
112
|
+
async chat({ messages, image, lang = 'pt', previewUrl, previewStatus = 'draft', autoPublish = false }: ChatInput) {
|
|
107
113
|
const apiKey = process.env.OPENAI_API_KEY;
|
|
108
114
|
if (!apiKey) {
|
|
109
115
|
throw new Error(
|
|
@@ -116,7 +122,7 @@ export default ({ strapi }: { strapi: any }) => ({
|
|
|
116
122
|
const { buscarTexto, editarCampo, publicar, listarLocales, criarLocale, traduzir } =
|
|
117
123
|
createContentTools(strapi);
|
|
118
124
|
const LOCAL_TOOLS: Record<string, (args: any) => Promise<any>> = {
|
|
119
|
-
buscar_texto: (a) => buscarTexto(a?.termo),
|
|
125
|
+
buscar_texto: (a) => buscarTexto(a?.termo, previewStatus),
|
|
120
126
|
editar_campo: (a) => editarCampo(a),
|
|
121
127
|
publicar: (a) => publicar(a),
|
|
122
128
|
listar_locales: () => listarLocales(),
|