@wabot-dev/framework 0.2.0-beta.14 → 0.2.0-beta.16
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/dist/src/addon/chat-bot/anthropic/AnthropicChatAdapter.js +18 -20
- package/dist/src/addon/chat-bot/deepseek/DeepSeekChatAdapter.js +2 -2
- package/dist/src/addon/chat-bot/google/GoogleChatAdapter.js +81 -70
- package/dist/src/addon/chat-bot/openia/OpenaiChatAdapter.js +43 -19
- package/dist/src/addon/chat-bot/wabot/WabotChatAdapter.js +1 -1
- package/dist/src/feature/chat-bot/ChatAdapter.js +1 -1
- package/dist/src/feature/chat-bot/ChatBot.js +14 -10
- package/dist/src/index.d.ts +17 -15
- package/package.json +4 -4
|
@@ -13,7 +13,7 @@ let AnthropicChatAdapter = class AnthropicChatAdapter {
|
|
|
13
13
|
const apiKey = this.env.requireString('ANTHROPIC_API_KEY');
|
|
14
14
|
this.anthropic = new Anthropic({ apiKey });
|
|
15
15
|
}
|
|
16
|
-
async
|
|
16
|
+
async nextItems(req) {
|
|
17
17
|
const tools = req.tools.map((x) => this.mapTool(x));
|
|
18
18
|
const messages = this.mapChatItems(req.prevItems);
|
|
19
19
|
const request = {
|
|
@@ -96,24 +96,6 @@ let AnthropicChatAdapter = class AnthropicChatAdapter {
|
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
mapResponse(response) {
|
|
99
|
-
let chatItem;
|
|
100
|
-
const content = response.content[0];
|
|
101
|
-
if (content.type === 'text') {
|
|
102
|
-
chatItem = { type: 'botMessage', botMessage: { text: content.text } };
|
|
103
|
-
}
|
|
104
|
-
else if (content.type === 'tool_use') {
|
|
105
|
-
chatItem = {
|
|
106
|
-
type: 'functionCall',
|
|
107
|
-
functionCall: {
|
|
108
|
-
id: content.id,
|
|
109
|
-
name: content.name,
|
|
110
|
-
arguments: JSON.stringify(content.input),
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
throw new Error('Not supported Claude Response');
|
|
116
|
-
}
|
|
117
99
|
let usage;
|
|
118
100
|
if (response.usage) {
|
|
119
101
|
usage = {
|
|
@@ -124,7 +106,23 @@ let AnthropicChatAdapter = class AnthropicChatAdapter {
|
|
|
124
106
|
else {
|
|
125
107
|
throw new Error('Unable to found usage info');
|
|
126
108
|
}
|
|
127
|
-
|
|
109
|
+
const nextItems = [];
|
|
110
|
+
for (const content of response.content) {
|
|
111
|
+
if (content.type === 'text' && content.text) {
|
|
112
|
+
nextItems.push({ type: 'botMessage', botMessage: { text: content.text } });
|
|
113
|
+
}
|
|
114
|
+
else if (content.type === 'tool_use') {
|
|
115
|
+
nextItems.push({
|
|
116
|
+
type: 'functionCall',
|
|
117
|
+
functionCall: {
|
|
118
|
+
id: content.id,
|
|
119
|
+
name: content.name,
|
|
120
|
+
arguments: JSON.stringify(content.input),
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return { usage, nextItems };
|
|
128
126
|
}
|
|
129
127
|
};
|
|
130
128
|
AnthropicChatAdapter = __decorate([
|
|
@@ -18,7 +18,7 @@ class DeepSeekChatAdapter {
|
|
|
18
18
|
baseURL,
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
async
|
|
21
|
+
async nextItems(req) {
|
|
22
22
|
const deepSeekInput = [];
|
|
23
23
|
deepSeekInput.push({ role: 'system', content: req.systemPrompt });
|
|
24
24
|
deepSeekInput.push(...this.mapChatItems(req.prevItems));
|
|
@@ -130,7 +130,7 @@ class DeepSeekChatAdapter {
|
|
|
130
130
|
else {
|
|
131
131
|
throw new Error('Unable to found usage info');
|
|
132
132
|
}
|
|
133
|
-
return { chatItem, usage };
|
|
133
|
+
return { nextItems: [chatItem], usage };
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
|
@@ -2,122 +2,133 @@ import { __decorate, __metadata } from 'tslib';
|
|
|
2
2
|
import { Env } from '../../../core/env/Env.js';
|
|
3
3
|
import { singleton } from '../../../core/injection/index.js';
|
|
4
4
|
import { Logger } from '../../../core/logger/Logger.js';
|
|
5
|
-
import
|
|
5
|
+
import { Random } from '../../../core/random/Random.js';
|
|
6
|
+
import { GoogleGenAI } from '@google/genai';
|
|
6
7
|
|
|
7
8
|
let GoogleChatAdapter = class GoogleChatAdapter {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
logger = new Logger('wabot:google-chat-adapter');
|
|
9
|
+
ai;
|
|
10
|
+
logger = new Logger('wabot:google-chat-adapter-v2');
|
|
11
11
|
constructor(env) {
|
|
12
|
-
this.
|
|
13
|
-
const apiKey = this.env.requireString('GOOGLE_API_KEY');
|
|
14
|
-
this.openai = new OpenAI({
|
|
15
|
-
apiKey,
|
|
16
|
-
baseURL: 'https://generativelanguage.googleapis.com/v1beta/openai/',
|
|
17
|
-
});
|
|
12
|
+
this.ai = new GoogleGenAI({ apiKey: env.requireString('GOOGLE_API_KEY') });
|
|
18
13
|
}
|
|
19
|
-
async
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const
|
|
14
|
+
async nextItems(req) {
|
|
15
|
+
const contents = [];
|
|
16
|
+
contents.push({ role: 'user', parts: [{ text: req.systemPrompt }] });
|
|
17
|
+
contents.push(...this.mapChatItems(req.prevItems));
|
|
18
|
+
const functionDeclarations = req.tools.map((x) => this.mapTool(x));
|
|
19
|
+
const response = await this.ai.models.generateContent({
|
|
25
20
|
model: req.model,
|
|
26
|
-
|
|
27
|
-
tools,
|
|
28
|
-
};
|
|
29
|
-
const response = await this.openai.chat.completions.create(request);
|
|
21
|
+
contents,
|
|
22
|
+
config: { tools: [{ functionDeclarations }] },
|
|
23
|
+
});
|
|
30
24
|
return this.mapResponse(response);
|
|
31
25
|
}
|
|
32
26
|
mapChatItems(chatItems) {
|
|
33
|
-
const
|
|
27
|
+
const contents = [];
|
|
34
28
|
for (const chatItem of chatItems) {
|
|
35
29
|
switch (chatItem.type) {
|
|
36
30
|
case 'humanMessage':
|
|
37
|
-
|
|
31
|
+
contents.push(this.mapHumanMessage(chatItem.humanMessage));
|
|
38
32
|
break;
|
|
39
33
|
case 'botMessage':
|
|
40
|
-
|
|
34
|
+
contents.push(this.mapBotMessage(chatItem.botMessage));
|
|
41
35
|
break;
|
|
42
36
|
case 'functionCall':
|
|
43
|
-
|
|
37
|
+
contents.push(...this.mapFunctionCall(chatItem.functionCall));
|
|
44
38
|
break;
|
|
45
39
|
}
|
|
46
40
|
}
|
|
47
|
-
return
|
|
41
|
+
return contents;
|
|
48
42
|
}
|
|
49
43
|
mapHumanMessage(item) {
|
|
50
44
|
if (!item.text) {
|
|
51
45
|
throw new Error('User message content is empty');
|
|
52
46
|
}
|
|
53
|
-
return { role: 'user',
|
|
47
|
+
return { role: 'user', parts: [{ text: item.text }] };
|
|
54
48
|
}
|
|
55
49
|
mapBotMessage(item) {
|
|
56
50
|
if (!item.text) {
|
|
57
51
|
throw new Error('Bot message content is empty');
|
|
58
52
|
}
|
|
59
|
-
return { role: '
|
|
53
|
+
return { role: 'model', parts: [{ text: item.text }] };
|
|
60
54
|
}
|
|
61
55
|
mapFunctionCall(item) {
|
|
62
56
|
return [
|
|
57
|
+
{
|
|
58
|
+
role: 'model',
|
|
59
|
+
parts: [
|
|
60
|
+
{
|
|
61
|
+
functionCall: {
|
|
62
|
+
id: item.id,
|
|
63
|
+
name: item.name,
|
|
64
|
+
args: JSON.parse(item.arguments ?? '{}'),
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
63
69
|
{
|
|
64
70
|
role: 'function',
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
parts: [
|
|
72
|
+
{
|
|
73
|
+
functionResponse: {
|
|
74
|
+
id: item.id,
|
|
75
|
+
name: item.name,
|
|
76
|
+
response: { output: item.result ?? '' },
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
],
|
|
67
80
|
},
|
|
68
81
|
];
|
|
69
82
|
}
|
|
70
83
|
mapTool(tool) {
|
|
71
84
|
return {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
description: param.description,
|
|
83
|
-
},
|
|
84
|
-
}), {}),
|
|
85
|
-
required: tool.parameters.map((param) => param.name),
|
|
86
|
-
additionalProperties: false,
|
|
87
|
-
}
|
|
85
|
+
name: tool.name,
|
|
86
|
+
description: tool.description,
|
|
87
|
+
parametersJsonSchema: {
|
|
88
|
+
type: 'object',
|
|
89
|
+
properties: tool.parameters.reduce((prev, param) => ({
|
|
90
|
+
...prev,
|
|
91
|
+
[param.name]: { type: param.type, description: param.description },
|
|
92
|
+
}), {}),
|
|
93
|
+
required: tool.parameters.map((param) => param.name),
|
|
94
|
+
additionalProperties: false,
|
|
88
95
|
},
|
|
89
96
|
};
|
|
90
97
|
}
|
|
91
98
|
mapResponse(response) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (responseText) {
|
|
95
|
-
chatItem = { type: 'botMessage', botMessage: { text: responseText } };
|
|
99
|
+
if (!response.candidates || !response.candidates.length) {
|
|
100
|
+
throw new Error('No candidates in response');
|
|
96
101
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
id: responseFunctionCall[0].id,
|
|
102
|
-
name: responseFunctionCall[0].function.name,
|
|
103
|
-
arguments: responseFunctionCall[0].function.arguments,
|
|
104
|
-
},
|
|
105
|
-
};
|
|
102
|
+
if (!response.usageMetadata ||
|
|
103
|
+
!response.usageMetadata.promptTokenCount ||
|
|
104
|
+
!response.usageMetadata.candidatesTokenCount) {
|
|
105
|
+
throw new Error('Not usage metadata');
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
const content = response.candidates.find((x) => x.content)?.content;
|
|
108
|
+
if (!content) {
|
|
109
|
+
throw new Error('Candidates has no content');
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
111
|
+
const nextItems = [];
|
|
112
|
+
for (const part of content.parts ?? []) {
|
|
113
|
+
if (part.text) {
|
|
114
|
+
nextItems.push({ type: 'botMessage', botMessage: { text: part.text } });
|
|
115
|
+
}
|
|
116
|
+
if (part.functionCall) {
|
|
117
|
+
const { id, name, args } = part.functionCall;
|
|
118
|
+
if (!name) {
|
|
119
|
+
throw new Error('invalid function call');
|
|
120
|
+
}
|
|
121
|
+
nextItems.push({
|
|
122
|
+
type: 'functionCall',
|
|
123
|
+
functionCall: { id: id ?? Random.alphaNumericLowerCase(10), name, arguments: args && JSON.stringify(args) },
|
|
124
|
+
});
|
|
125
|
+
}
|
|
119
126
|
}
|
|
120
|
-
|
|
127
|
+
let usage = {
|
|
128
|
+
inputTokens: response.usageMetadata.promptTokenCount,
|
|
129
|
+
outputTokens: response.usageMetadata.candidatesTokenCount,
|
|
130
|
+
};
|
|
131
|
+
return { usage, nextItems };
|
|
121
132
|
}
|
|
122
133
|
};
|
|
123
134
|
GoogleChatAdapter = __decorate([
|
|
@@ -6,7 +6,7 @@ import { singleton } from '../../../core/injection/index.js';
|
|
|
6
6
|
let OpenaiChatAdapter = class OpenaiChatAdapter {
|
|
7
7
|
openai = new OpenAI();
|
|
8
8
|
logger = new Logger('wabot:openai-chat-adapter');
|
|
9
|
-
async
|
|
9
|
+
async nextItems(req) {
|
|
10
10
|
const openIaInput = [];
|
|
11
11
|
openIaInput.push({ role: 'system', content: req.systemPrompt });
|
|
12
12
|
openIaInput.push(...this.mapChatItems(req.prevItems));
|
|
@@ -80,23 +80,6 @@ let OpenaiChatAdapter = class OpenaiChatAdapter {
|
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
mapResponse(response) {
|
|
83
|
-
let chatItem;
|
|
84
|
-
if (response.output_text) {
|
|
85
|
-
chatItem = { type: 'botMessage', botMessage: { text: response.output_text } };
|
|
86
|
-
}
|
|
87
|
-
else if (response.output && response.output[0]?.type == 'function_call') {
|
|
88
|
-
chatItem = {
|
|
89
|
-
type: 'functionCall',
|
|
90
|
-
functionCall: {
|
|
91
|
-
id: response.output[0].call_id,
|
|
92
|
-
name: response.output[0].name,
|
|
93
|
-
arguments: response.output[0].arguments,
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
throw new Error('Not supported OpenIA Response');
|
|
99
|
-
}
|
|
100
83
|
let usage;
|
|
101
84
|
if (response.usage) {
|
|
102
85
|
usage = {
|
|
@@ -107,7 +90,48 @@ let OpenaiChatAdapter = class OpenaiChatAdapter {
|
|
|
107
90
|
else {
|
|
108
91
|
throw new Error('Unable to found usage info');
|
|
109
92
|
}
|
|
110
|
-
|
|
93
|
+
const nextItems = [];
|
|
94
|
+
for (const output of response.output) {
|
|
95
|
+
if (output.type === 'message') {
|
|
96
|
+
for (const content of output.content) {
|
|
97
|
+
if (content.type === 'output_text' && content.text) {
|
|
98
|
+
nextItems.push({ type: 'botMessage', botMessage: { text: content.text } });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else if (output.type === 'function_call') {
|
|
103
|
+
nextItems.push({
|
|
104
|
+
type: 'functionCall',
|
|
105
|
+
functionCall: { id: output.call_id, name: output.name, arguments: output.arguments },
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return { usage, nextItems };
|
|
110
|
+
// let chatItem: IChatItem
|
|
111
|
+
// if (response.output_text) {
|
|
112
|
+
// chatItem = { type: 'botMessage', botMessage: { text: response.output_text } }
|
|
113
|
+
// } else if (response.output && response.output[0]?.type == 'function_call') {
|
|
114
|
+
// chatItem = {
|
|
115
|
+
// type: 'functionCall',
|
|
116
|
+
// functionCall: {
|
|
117
|
+
// id: response.output[0].call_id,
|
|
118
|
+
// name: response.output[0].name,
|
|
119
|
+
// arguments: response.output[0].arguments,
|
|
120
|
+
// },
|
|
121
|
+
// }
|
|
122
|
+
// } else {
|
|
123
|
+
// throw new Error('Not supported OpenIA Response')
|
|
124
|
+
// }
|
|
125
|
+
// let usage: ILanguageModelUsage
|
|
126
|
+
// if (response.usage) {
|
|
127
|
+
// usage = {
|
|
128
|
+
// inputTokens: response.usage.input_tokens,
|
|
129
|
+
// outputTokens: response.usage.output_tokens,
|
|
130
|
+
// }
|
|
131
|
+
// } else {
|
|
132
|
+
// throw new Error('Unable to found usage info')
|
|
133
|
+
// }
|
|
134
|
+
// return { chatItem, usage }
|
|
111
135
|
}
|
|
112
136
|
};
|
|
113
137
|
OpenaiChatAdapter = __decorate([
|
|
@@ -15,7 +15,7 @@ let WabotChatAdapter = class WabotChatAdapter {
|
|
|
15
15
|
this.baseUrl = this.baseUrl.substring(0, this.baseUrl.length - 1);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
async
|
|
18
|
+
async nextItems(req) {
|
|
19
19
|
const response = await fetch(this.baseUrl + '/chat-bot/next-item', {
|
|
20
20
|
method: 'post',
|
|
21
21
|
headers: {
|
|
@@ -41,23 +41,27 @@ let ChatBot = class ChatBot {
|
|
|
41
41
|
throw new Error(`Invalid ${this.mindset.constructor.name} - llms not found`);
|
|
42
42
|
}
|
|
43
43
|
const llm = llms[0];
|
|
44
|
-
const {
|
|
44
|
+
const { nextItems: newItemsData } = await this.adapter.nextItems({
|
|
45
45
|
model: llm.model,
|
|
46
46
|
provider: llm.provider,
|
|
47
47
|
systemPrompt,
|
|
48
48
|
tools,
|
|
49
49
|
prevItems: prevItems.map((x) => x.getData()),
|
|
50
50
|
});
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
for (const newItemData of newItemsData) {
|
|
52
|
+
if (newItemData.type === 'functionCall') {
|
|
53
|
+
newItemData.functionCall.result = await this.mindset.callFunction(newItemData.functionCall.name, newItemData.functionCall.arguments ?? '{}');
|
|
54
|
+
}
|
|
55
|
+
else if (newItemData.type === 'botMessage') {
|
|
56
|
+
newItemData.botMessage.senderName = identity.name;
|
|
57
|
+
}
|
|
58
|
+
const newChatItem = new ChatItem(newItemData);
|
|
59
|
+
await this.memory.create(newChatItem);
|
|
60
|
+
if (newItemData.type === 'botMessage') {
|
|
61
|
+
callback(newChatItem.botMessage);
|
|
62
|
+
}
|
|
53
63
|
}
|
|
54
|
-
|
|
55
|
-
newItemData.botMessage.senderName = identity.name;
|
|
56
|
-
}
|
|
57
|
-
const newChatItem = new ChatItem(newItemData);
|
|
58
|
-
await this.memory.create(newChatItem);
|
|
59
|
-
if (newChatItem.type === 'botMessage') {
|
|
60
|
-
callback(newChatItem.botMessage);
|
|
64
|
+
if (newItemsData.length == 0 || newItemsData[newItemsData.length - 1].type === 'botMessage') {
|
|
61
65
|
return;
|
|
62
66
|
}
|
|
63
67
|
this.processLoop(callback);
|
package/dist/src/index.d.ts
CHANGED
|
@@ -615,24 +615,24 @@ interface ILanguageModelUsage {
|
|
|
615
615
|
outputTokens: number;
|
|
616
616
|
}
|
|
617
617
|
|
|
618
|
-
interface
|
|
618
|
+
interface IChatAdapterNextItemsReq {
|
|
619
619
|
model: string;
|
|
620
620
|
systemPrompt: string;
|
|
621
621
|
tools: IMindsetTool[];
|
|
622
622
|
prevItems: IChatItem[];
|
|
623
623
|
}
|
|
624
|
-
interface
|
|
625
|
-
|
|
624
|
+
interface IChatAdapterNextItemsRes {
|
|
625
|
+
nextItems: IChatItem[];
|
|
626
626
|
usage: ILanguageModelUsage;
|
|
627
627
|
}
|
|
628
628
|
interface IChatAdapter {
|
|
629
|
-
|
|
629
|
+
nextItems(req: IChatAdapterNextItemsReq): Promise<IChatAdapterNextItemsRes>;
|
|
630
630
|
}
|
|
631
631
|
|
|
632
632
|
declare class ChatAdapter implements IChatAdapter {
|
|
633
|
-
|
|
633
|
+
nextItems(req: IChatAdapterNextItemsReq & {
|
|
634
634
|
provider?: string;
|
|
635
|
-
}): Promise<
|
|
635
|
+
}): Promise<IChatAdapterNextItemsRes>;
|
|
636
636
|
}
|
|
637
637
|
|
|
638
638
|
type IChatItemData = IEntityData & IChatItem;
|
|
@@ -1175,7 +1175,7 @@ declare class AnthropicChatAdapter implements IChatAdapter {
|
|
|
1175
1175
|
private anthropic;
|
|
1176
1176
|
private logger;
|
|
1177
1177
|
constructor(env: Env);
|
|
1178
|
-
|
|
1178
|
+
nextItems(req: IChatAdapterNextItemsReq): Promise<IChatAdapterNextItemsRes>;
|
|
1179
1179
|
private mapChatItems;
|
|
1180
1180
|
private mapHumanMessage;
|
|
1181
1181
|
private mapBotMessage;
|
|
@@ -1188,7 +1188,7 @@ declare class DeepSeekChatAdapter implements IChatAdapter {
|
|
|
1188
1188
|
private deepSeek;
|
|
1189
1189
|
private logger;
|
|
1190
1190
|
constructor();
|
|
1191
|
-
|
|
1191
|
+
nextItems(req: IChatAdapterNextItemsReq): Promise<IChatAdapterNextItemsRes>;
|
|
1192
1192
|
private mapChatItems;
|
|
1193
1193
|
private mapHumanMessage;
|
|
1194
1194
|
private mapBotMessage;
|
|
@@ -1197,12 +1197,14 @@ declare class DeepSeekChatAdapter implements IChatAdapter {
|
|
|
1197
1197
|
private mapResponse;
|
|
1198
1198
|
}
|
|
1199
1199
|
|
|
1200
|
+
interface GoogleChatAdapterV2Options {
|
|
1201
|
+
apiKey?: string;
|
|
1202
|
+
}
|
|
1200
1203
|
declare class GoogleChatAdapter implements IChatAdapter {
|
|
1201
|
-
private
|
|
1202
|
-
private
|
|
1203
|
-
private logger;
|
|
1204
|
+
private ai;
|
|
1205
|
+
private readonly logger;
|
|
1204
1206
|
constructor(env: Env);
|
|
1205
|
-
|
|
1207
|
+
nextItems(req: IChatAdapterNextItemsReq): Promise<IChatAdapterNextItemsRes>;
|
|
1206
1208
|
private mapChatItems;
|
|
1207
1209
|
private mapHumanMessage;
|
|
1208
1210
|
private mapBotMessage;
|
|
@@ -1214,7 +1216,7 @@ declare class GoogleChatAdapter implements IChatAdapter {
|
|
|
1214
1216
|
declare class OpenaiChatAdapter implements IChatAdapter {
|
|
1215
1217
|
private openai;
|
|
1216
1218
|
private logger;
|
|
1217
|
-
|
|
1219
|
+
nextItems(req: IChatAdapterNextItemsReq): Promise<IChatAdapterNextItemsRes>;
|
|
1218
1220
|
private mapChatItems;
|
|
1219
1221
|
private mapConectionMessage;
|
|
1220
1222
|
private mapBotMessage;
|
|
@@ -1256,7 +1258,7 @@ declare class WabotChatAdapter implements IChatAdapter {
|
|
|
1256
1258
|
private baseUrl;
|
|
1257
1259
|
private logger;
|
|
1258
1260
|
constructor(env: Env);
|
|
1259
|
-
|
|
1261
|
+
nextItems(req: IChatAdapterNextItemsReq): Promise<IChatAdapterNextItemsRes>;
|
|
1260
1262
|
}
|
|
1261
1263
|
|
|
1262
1264
|
declare function cmd(): (target: object, propertyKey: string | symbol) => void;
|
|
@@ -1623,4 +1625,4 @@ declare function HtmlModule(options: IHtmlModuleOptions): {
|
|
|
1623
1625
|
new (): {};
|
|
1624
1626
|
};
|
|
1625
1627
|
|
|
1626
|
-
export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyHandshakeGuardMiddleware, ApiKeyRepository, Async, Auth, Chat, ChatAdapter, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, CmdChannel, Command, CommandMetadataStore, Container, ControllerMetadataStore, CustomError, DeepSeekChatAdapter, EXPRESS_REQ, EXPRESS_RES, Entity, Env, EnvWhatsAppRepository, ExpressProvider, GoogleChatAdapter, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type
|
|
1628
|
+
export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyHandshakeGuardMiddleware, ApiKeyRepository, Async, Auth, Chat, ChatAdapter, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, CmdChannel, Command, CommandMetadataStore, Container, ControllerMetadataStore, CustomError, DeepSeekChatAdapter, EXPRESS_REQ, EXPRESS_RES, Entity, Env, EnvWhatsAppRepository, ExpressProvider, GoogleChatAdapter, type GoogleChatAdapterV2Options, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterNextItemsReq, type IChatAdapterNextItemsRes, type IChatBot, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatItem, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatRepository, type IChatType, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConstructor, type ICrudRepository, type ICustomErrorData, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IFunctionCall, type IFunctionCallItem, type IGenerateApiKeyReq, type IGenerateApiKeyRes, type IGetWhatsAppTemplateRequest, type IHandshakeMiddleware, type IHandshakeMiddlewareMetadata, type IHtmlModuleOptions, type IHumanMessageItem, type IJobData, type IJobEvent, type IJobEventListener, type IJobRepository, type IJwtRefreshTokenData, type IJwtRefreshTokenRepository, type ILanguageModelUsage, type IListenWhatsAppMessageRequest, type IMessageContext, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetDecoration, type IMindsetFunctionConfig, type IMindsetFunctionDecoration, type IMindsetFunctionMetadata, type IMindsetFunctionParamMetadata, type IMindsetIdentity, type IMindsetLlm, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleDecoration, type IMindsetModuleMetadata, type IMindsetTool, type IMindsetToolParameter, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IMoneyData, type IParamConfig, type IParamDecoration, type IPersistentData, type IPgRepositoryConfig, type IPrimitive, type IPropertyValidatorInfo, type IReceivedMessage, type IRemoteApiKeyFetcher, type IRestControllerConfig, type IRestControllerMetadata, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type ISocketChannelConfig, type ISocketChannelReceivedMessage, type ISocketControllerConfig, type ISocketControllerMetadata, type ISocketEventConfig, type ISocketEventMetadata, type IStorableData, type ITelegramChannelConfig, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateInputShape, type IValidateIsInOptions, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppCloudContact, type IWhatsAppCloudMessage, type IWhatsAppCloudMessageMetadata, type IWhatsAppCloudTemplate, type IWhatsAppCloudTemplateComponent, type IWhatsAppCloudTemplateMessage, type IWhatsAppCloudTemplateParameter, type IWhatsAppCloudTemplateResponse, type IWhatsAppCloudWebhookPayload, type IWhatsAppData, type IWhatsAppMessageListener, type IWhatsAppProxyListenMessageEventData, type IWhatsAppProxyListenMessageEventReq, type IWhatsAppProxyMessage, type IWhatsAppProxyMessageContent, type IWhatsAppProxyMessageEventReq, type IWhatsAppProxySendMessageEventReq, type IWhatsAppRepository, type IWhatsAppSenderOptions, type IWhatsappChannelConfig, type IchatControllerConfig, Job, JobRepository, JobRunner, JobsEventsHub, Jwt, JwtAccessAndRefreshTokenDto, JwtConfig, JwtGuardMiddleware, JwtHandshakeGuardMiddleware, JwtRefreshToken, JwtRefreshTokenRepository, JwtSigner, JwtTokenDto, Lifecycle, Logger, MINDSET_DECORATION_MINDSET, MINDSET_FUNCTION_DECORATION_FUNCTION, MINDSET_MODULE_DECORATION_MODULE, Mapper, Mindset, MindsetMetadataStore, MindsetOperator, Money, MoneyDto, OpenaiChatAdapter, PARAM_DECORATION_IS_OPTIONAL, PARAM_DECORATION_PARAM, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCrudRepository, PgJobRepository, PgJwtRefreshTokenRepository, PgRepositoryBase, PgWhatsAppRepository, RamChatMemory, RamChatRepository, Random, RemoteApiKeyRepository, RestControllerMetadataStore, SocketChannel, SocketChannelConfig, SocketChannelReceivedMessage, SocketControllerMetadataStore, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, ValidationMetadataStore, WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT, WabotChatAdapter, WhatsApp, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByCloudApi, WhatsAppReceiverByWabotProxy, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByWabotProxy, WhatsAppWabotProxyConnection, WhatsappChannelConfig, apiKeyGuard, apiKeyHandshakeGuard, chatBot, chatController, chatItemTypeOptions, cmd, command, commandHandler, container, handshakeMiddlewares, inject, injectable, isArray, isBoolean, isDate, isIn, isModel, isNotEmpty, isNumber, isOptional, isPresent, isString, jwtGuard, jwtHandshakeGuard, max, middleware, min, mindset, mindsetFunction, mindsetModule, modelInfo, onDelete, onGet, onPost, onPut, onSocketEvent, param, readJsonFromFile, restController, runAsyncCommandHandlers, runChatControllers, runRestControllers, runSocketControllers, scoped, singleton, socket, socketController, telegram, validateAndTransform, validateArray, validateIsBoolean, validateIsDate, validateIsIn, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsString, validateMax, validateMin, validateModel, whatsApp, writeJsonToFile };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wabot-dev/framework",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.16",
|
|
4
4
|
"description": "Framework for IA Chat Bots",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "rollup --config rollup.config.ts --configPlugin typescript && tsup --dts-only --format esm --out-dir dist/src src/index.ts",
|
|
14
14
|
"test:units": "node --import @yucacodes/ts/src/custom-import.mjs --test './src/**/*.unit.test.ts'",
|
|
15
|
-
"test:integration": "node --import @yucacodes/ts/src/custom-import.mjs --test './src/**/*.integration.test.ts'",
|
|
15
|
+
"test:integration": "node --import ./env.mjs --import @yucacodes/ts/src/custom-import.mjs --test './src/**/*.integration.test.ts'",
|
|
16
16
|
"fmt": "prettier --write .",
|
|
17
17
|
"fmt:check": "prettier --check .",
|
|
18
18
|
"types:check": "tsc --noEmit",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"@types/big.js": "^6.2.2",
|
|
38
38
|
"@types/debug": "^4.1.12",
|
|
39
39
|
"@types/express": "^5.0.1",
|
|
40
|
-
"@types/jsonwebtoken": "^9.0.10",
|
|
41
|
-
"@types/pg": "^8.11.14",
|
|
42
40
|
"@types/html-to-text": "^9.0.4",
|
|
41
|
+
"@types/jsonwebtoken": "^9.0.10",
|
|
43
42
|
"@types/node": "22.14.1",
|
|
43
|
+
"@types/pg": "^8.11.14",
|
|
44
44
|
"@yucacodes/ts": "^0.0.4",
|
|
45
45
|
"big.js": "^7.0.1",
|
|
46
46
|
"body-parser": "^2.2.0",
|