@wabot-dev/framework 0.2.5 → 0.3.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/README.md CHANGED
@@ -3,13 +3,13 @@
3
3
  <div align="center">
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@wabot-dev/framework.svg?style=flat-square)](https://www.npmjs.com/package/@wabot-dev/framework)
6
- [![License](https://img.shields.io/npm/l/@wabot-dev/framework.svg?style=flat-square)](https://www.npmjs.com/package/@wabot-dev/framework)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
7
7
  [![Documentation](https://img.shields.io/badge/docs-wabot.dev-blue.svg?style=flat-square)](https://docs.wabot.dev)
8
8
 
9
9
 
10
10
  **Un framework moderno y flexible para crear bots con TypeScript e Inteligencia Artificial**
11
11
 
12
- [Documentación](https://docs.wabot.dev) • [Inicio Rápido](https://docs.wabot.dev/guides/start-new-project/) • [Repositorio](https://github.com/wabot-dev/wabot-ts)
12
+ [Documentación](https://docs.wabot.dev) • [Inicio Rápido](https://docs.wabot.dev/guides/start-new-project/)
13
13
 
14
14
  </div>
15
15
 
@@ -53,14 +53,13 @@ Wabot se integra nativamente con las principales plataformas de mensajería:
53
53
 
54
54
  ## 🧠 Proveedores de IA
55
55
 
56
- Conecta tu bot con los principales modelos de lenguaje del mercado:
57
-
58
- | Proveedor | Modelos |
59
- |-----------|---------|
60
- | 🟢 **OpenAI** | GPT-4, GPT-3.5, y más |
61
- | 🔵 **Google** | Gemini Pro, Gemini Ultra |
62
- | 🟣 **Anthropic** | Claude 3 y más |
56
+ Potencia tu bot con los principales proveedores de inteligencia artificial:
63
57
 
58
+ | Proveedor | Soporte en Wabot |
59
+ |-----------|------------------|
60
+ | 🟢 **OpenAI** | ✅ Integración completa |
61
+ | 🔵 **Google** | ✅ Integración completa |
62
+ | 🟣 **Anthropic** | ✅ Integración completa |
64
63
  ---
65
64
 
66
65
  ## 📚 Documentación
@@ -84,7 +83,6 @@ Explora nuestra documentación completa para dominar Wabot:
84
83
 
85
84
  ¿Quieres contribuir al proyecto? ¡Serás bienvenido!
86
85
 
87
- - 📦 **Repositorio:** [github.com/wabot-dev/wabot-ts](https://github.com/wabot-dev/wabot-ts)
88
86
  - 🐛 **Reportar bugs:** [Issues](https://github.com/wabot-dev/wabot-ts/issues)
89
87
  - 💬 **Discusiones:** [Discussions](https://github.com/wabot-dev/wabot-ts/discussions)
90
88
 
@@ -94,9 +92,8 @@ Explora nuestra documentación completa para dominar Wabot:
94
92
 
95
93
  ¿Necesitas ayuda? Estamos aquí para ti:
96
94
 
97
- - 📧 **Email:** [soporte@wabot.dev](mailto:soporte@wabot.dev)
95
+ - 📧 **Email:** [contact@wabot.dev](mailto:contact@wabot.dev)
98
96
  - 🐛 **Issues:** [Reportar un problema](https://github.com/wabot-dev/wabot-ts/issues)
99
- - 📖 **Documentación:** [docs.wabot.dev](https://docs.wabot.dev)
100
97
 
101
98
  ---
102
99
 
@@ -110,6 +107,6 @@ Este proyecto está licenciado bajo [Licencia MIT](https://github.com/wabot-dev/
110
107
 
111
108
  **Hecho con ❤️ por el equipo de Wabot**
112
109
 
113
- [Sitio Web](https://wabot.dev) • [Documentación](https://docs.wabot.dev) • [GitHub](https://github.com/wabot-dev/wabot-ts) • [npm](https://www.npmjs.com/package/@wabot-dev/framework)
110
+ [Sitio Web](https://wabot.dev) • [Documentación](https://docs.wabot.dev) • [npm](https://www.npmjs.com/package/@wabot-dev/framework)
114
111
 
115
112
  </div>
@@ -36,10 +36,22 @@ let OpenaiChatAdapter = class OpenaiChatAdapter {
36
36
  return openIaInput;
37
37
  }
38
38
  mapConectionMessage(item) {
39
- if (!item.text) {
40
- throw new Error('System message content is empty');
39
+ const content = [];
40
+ if (item.text)
41
+ content.push({ type: 'input_text', text: item.text });
42
+ if (item.images) {
43
+ for (const image of item.images) {
44
+ content.push({
45
+ type: 'input_image',
46
+ image_url: image.publicUrl ?? image.base64Url,
47
+ detail: 'auto',
48
+ });
49
+ }
50
+ }
51
+ if (content.length === 0) {
52
+ throw new Error('message content is empty');
41
53
  }
42
- return { role: 'user', content: item.text };
54
+ return { role: 'user', content };
43
55
  }
44
56
  mapBotMessage(item) {
45
57
  if (!item.text) {
@@ -16,7 +16,7 @@ let WabotChatAdapter = class WabotChatAdapter {
16
16
  }
17
17
  }
18
18
  async nextItems(req) {
19
- const response = await fetch(this.baseUrl + '/chat-bot/next-item', {
19
+ const response = await fetch(this.baseUrl + '/chat-bot/next-items', {
20
20
  method: 'post',
21
21
  headers: {
22
22
  Authorization: `Api-Key ${this.apiKey}`,
@@ -10,6 +10,9 @@ class Chat extends Entity {
10
10
  isGroup() {
11
11
  return this.data.type === 'GROUP';
12
12
  }
13
+ get connections() {
14
+ return this.data.connections;
15
+ }
13
16
  hasConnection(connection) {
14
17
  for (const con of this.data.connections) {
15
18
  if (con.channelName === connection.channelName && con.id === connection.id) {
@@ -444,6 +444,7 @@ declare class Chat extends Entity<IChatData> {
444
444
  constructor(data: IChatData);
445
445
  isPrivate(): boolean;
446
446
  isGroup(): boolean;
447
+ get connections(): IChatConnection[];
447
448
  hasConnection(connection: IChatConnection): boolean;
448
449
  private validatePrivateChat;
449
450
  private validateGroupChat;
@@ -581,10 +582,25 @@ declare class MindsetOperator implements IMindset {
581
582
  functionErrorToString(error: any): Promise<string>;
582
583
  }
583
584
 
585
+ interface IChatMessagesPublicImage extends IStorableData {
586
+ name?: string;
587
+ publicUrl: string;
588
+ base64Url?: undefined;
589
+ mimeType: string;
590
+ }
591
+ interface IChatMessagesPrivateImage extends IStorableData {
592
+ name?: string;
593
+ publicUrl?: undefined;
594
+ base64Url: string;
595
+ mimeType: string;
596
+ }
597
+ type IChatMessageImage = IChatMessagesPrivateImage | IChatMessagesPublicImage;
598
+
584
599
  interface IChatMessage extends IStorableData {
585
600
  senderId?: string;
586
601
  senderName?: string;
587
602
  text?: string;
603
+ images?: IChatMessageImage[];
588
604
  }
589
605
 
590
606
  interface IFunctionCall extends IStorableData {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wabot-dev/framework",
3
- "version": "0.2.5",
3
+ "version": "0.3.0",
4
4
  "description": "Framework for IA Chat Bots",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -56,7 +56,7 @@
56
56
  "grammy": "^1.36.0",
57
57
  "html-to-text": "^9.0.5",
58
58
  "jsonwebtoken": "^9.0.2",
59
- "openai": "^4.93.0",
59
+ "openai": "^6.10.0",
60
60
  "pg": "^8.15.6",
61
61
  "reflect-metadata": "^0.2.2",
62
62
  "short-uuid": "^5.2.0",