@digipair/skill-chatbot 0.1.6 → 0.1.7
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/index.cjs2.js
CHANGED
@@ -40928,7 +40928,7 @@ let ChatbotService = class ChatbotService {
|
|
40928
40928
|
}
|
40929
40929
|
return results;
|
40930
40930
|
}
|
40931
|
-
async updateSummary(baseUrl, session, messages, options) {
|
40931
|
+
async updateSummary(baseUrl, prompt, session, messages, options) {
|
40932
40932
|
const [summary] = await this.searchDocuments(baseUrl, session, `is_parent = true and userQuery() order by date desc limit 1`, {
|
40933
40933
|
query: 'role:"system"'
|
40934
40934
|
});
|
@@ -40939,15 +40939,6 @@ let ChatbotService = class ChatbotService {
|
|
40939
40939
|
});
|
40940
40940
|
const history1 = messages.sort((a, b)=>a - b).map(({ role, content })=>`${role}: ${content}`).join('\n');
|
40941
40941
|
const date = messages.reduce((acc, { date })=>Math.max(acc, date), 0);
|
40942
|
-
const prompt = `
|
40943
|
-
Résumé de l'historique la conversation:
|
40944
|
-
${summary.content}
|
40945
|
-
|
40946
|
-
Nouveaux messages:
|
40947
|
-
${history1}
|
40948
|
-
|
40949
|
-
Résumer dans un texte court, précis et concis l'historique de la conversation en prenant en compte les nouveaux messages.
|
40950
|
-
`;
|
40951
40942
|
const chain = RunnableSequence.from([
|
40952
40943
|
PromptTemplate.fromTemplate(prompt),
|
40953
40944
|
model
|
@@ -40969,12 +40960,12 @@ let ChatbotService = class ChatbotService {
|
|
40969
40960
|
document
|
40970
40961
|
]);
|
40971
40962
|
}
|
40972
|
-
async updateHistory(baseUrl, session, memory, options) {
|
40963
|
+
async updateHistory(baseUrl, promptSummary, session, memory, options) {
|
40973
40964
|
// add new messages
|
40974
40965
|
const documents = await this.prepareHistory(memory);
|
40975
40966
|
await this.pushDocuments(baseUrl, session, documents);
|
40976
40967
|
// update summary
|
40977
|
-
await this.updateSummary(baseUrl, session, memory, options);
|
40968
|
+
await this.updateSummary(baseUrl, promptSummary, session, memory, options);
|
40978
40969
|
}
|
40979
40970
|
async history(params, _pins, context) {
|
40980
40971
|
var _context_private;
|
@@ -41053,7 +41044,14 @@ let ChatbotService = class ChatbotService {
|
|
41053
41044
|
var _context_private, _context_private1, _input_boost;
|
41054
41045
|
const session = `${context.request.digipair}-${context.request.body.userId}`;
|
41055
41046
|
var _context_private_OLLAMA_SERVER, _context_private_VESPA_SERVER;
|
41056
|
-
const { modelName = 'mistral', temperature = 0, baseUrlOllama = (_context_private_OLLAMA_SERVER = (_context_private = context.private) == null ? void 0 : _context_private.OLLAMA_SERVER) != null ? _context_private_OLLAMA_SERVER : OLLAMA_SERVER, baseUrlVespa = (_context_private_VESPA_SERVER = (_context_private1 = context.private) == null ? void 0 : _context_private1.VESPA_SERVER) != null ? _context_private_VESPA_SERVER : VESPA_SERVER,
|
41047
|
+
const { modelName = 'mistral', temperature = 0, baseUrlOllama = (_context_private_OLLAMA_SERVER = (_context_private = context.private) == null ? void 0 : _context_private.OLLAMA_SERVER) != null ? _context_private_OLLAMA_SERVER : OLLAMA_SERVER, baseUrlVespa = (_context_private_VESPA_SERVER = (_context_private1 = context.private) == null ? void 0 : _context_private1.VESPA_SERVER) != null ? _context_private_VESPA_SERVER : VESPA_SERVER, promptSummary = `
|
41048
|
+
Résumé de l'historique la conversation:
|
41049
|
+
{summary}
|
41050
|
+
|
41051
|
+
Nouveaux messages:
|
41052
|
+
{history}
|
41053
|
+
|
41054
|
+
Résumer dans un texte court, précis et concis l'historique de la conversation en prenant en compte les nouveaux messages.`, assistant, command, sources, logs } = params;
|
41057
41055
|
const input = context.request.body;
|
41058
41056
|
const date = Date.now();
|
41059
41057
|
var _input_inputs;
|
@@ -41091,7 +41089,7 @@ let ChatbotService = class ChatbotService {
|
|
41091
41089
|
date: date + index
|
41092
41090
|
}));
|
41093
41091
|
// Asynchronous history update
|
41094
|
-
this.updateHistory(baseUrlVespa, session, memory, {
|
41092
|
+
this.updateHistory(baseUrlVespa, promptSummary, session, memory, {
|
41095
41093
|
modelName,
|
41096
41094
|
temperature,
|
41097
41095
|
baseUrl: baseUrlOllama
|
package/index.esm2.js
CHANGED
@@ -40906,7 +40906,7 @@ let ChatbotService = class ChatbotService {
|
|
40906
40906
|
}
|
40907
40907
|
return results;
|
40908
40908
|
}
|
40909
|
-
async updateSummary(baseUrl, session, messages, options) {
|
40909
|
+
async updateSummary(baseUrl, prompt, session, messages, options) {
|
40910
40910
|
const [summary] = await this.searchDocuments(baseUrl, session, `is_parent = true and userQuery() order by date desc limit 1`, {
|
40911
40911
|
query: 'role:"system"'
|
40912
40912
|
});
|
@@ -40917,15 +40917,6 @@ let ChatbotService = class ChatbotService {
|
|
40917
40917
|
});
|
40918
40918
|
const history1 = messages.sort((a, b)=>a - b).map(({ role, content })=>`${role}: ${content}`).join('\n');
|
40919
40919
|
const date = messages.reduce((acc, { date })=>Math.max(acc, date), 0);
|
40920
|
-
const prompt = `
|
40921
|
-
Résumé de l'historique la conversation:
|
40922
|
-
${summary.content}
|
40923
|
-
|
40924
|
-
Nouveaux messages:
|
40925
|
-
${history1}
|
40926
|
-
|
40927
|
-
Résumer dans un texte court, précis et concis l'historique de la conversation en prenant en compte les nouveaux messages.
|
40928
|
-
`;
|
40929
40920
|
const chain = RunnableSequence.from([
|
40930
40921
|
PromptTemplate.fromTemplate(prompt),
|
40931
40922
|
model
|
@@ -40947,12 +40938,12 @@ let ChatbotService = class ChatbotService {
|
|
40947
40938
|
document
|
40948
40939
|
]);
|
40949
40940
|
}
|
40950
|
-
async updateHistory(baseUrl, session, memory, options) {
|
40941
|
+
async updateHistory(baseUrl, promptSummary, session, memory, options) {
|
40951
40942
|
// add new messages
|
40952
40943
|
const documents = await this.prepareHistory(memory);
|
40953
40944
|
await this.pushDocuments(baseUrl, session, documents);
|
40954
40945
|
// update summary
|
40955
|
-
await this.updateSummary(baseUrl, session, memory, options);
|
40946
|
+
await this.updateSummary(baseUrl, promptSummary, session, memory, options);
|
40956
40947
|
}
|
40957
40948
|
async history(params, _pins, context) {
|
40958
40949
|
var _context_private;
|
@@ -41031,7 +41022,14 @@ let ChatbotService = class ChatbotService {
|
|
41031
41022
|
var _context_private, _context_private1, _input_boost;
|
41032
41023
|
const session = `${context.request.digipair}-${context.request.body.userId}`;
|
41033
41024
|
var _context_private_OLLAMA_SERVER, _context_private_VESPA_SERVER;
|
41034
|
-
const { modelName = 'mistral', temperature = 0, baseUrlOllama = (_context_private_OLLAMA_SERVER = (_context_private = context.private) == null ? void 0 : _context_private.OLLAMA_SERVER) != null ? _context_private_OLLAMA_SERVER : OLLAMA_SERVER, baseUrlVespa = (_context_private_VESPA_SERVER = (_context_private1 = context.private) == null ? void 0 : _context_private1.VESPA_SERVER) != null ? _context_private_VESPA_SERVER : VESPA_SERVER,
|
41025
|
+
const { modelName = 'mistral', temperature = 0, baseUrlOllama = (_context_private_OLLAMA_SERVER = (_context_private = context.private) == null ? void 0 : _context_private.OLLAMA_SERVER) != null ? _context_private_OLLAMA_SERVER : OLLAMA_SERVER, baseUrlVespa = (_context_private_VESPA_SERVER = (_context_private1 = context.private) == null ? void 0 : _context_private1.VESPA_SERVER) != null ? _context_private_VESPA_SERVER : VESPA_SERVER, promptSummary = `
|
41026
|
+
Résumé de l'historique la conversation:
|
41027
|
+
{summary}
|
41028
|
+
|
41029
|
+
Nouveaux messages:
|
41030
|
+
{history}
|
41031
|
+
|
41032
|
+
Résumer dans un texte court, précis et concis l'historique de la conversation en prenant en compte les nouveaux messages.`, assistant, command, sources, logs } = params;
|
41035
41033
|
const input = context.request.body;
|
41036
41034
|
const date = Date.now();
|
41037
41035
|
var _input_inputs;
|
@@ -41069,7 +41067,7 @@ let ChatbotService = class ChatbotService {
|
|
41069
41067
|
date: date + index
|
41070
41068
|
}));
|
41071
41069
|
// Asynchronous history update
|
41072
|
-
this.updateHistory(baseUrlVespa, session, memory, {
|
41070
|
+
this.updateHistory(baseUrlVespa, promptSummary, session, memory, {
|
41073
41071
|
modelName,
|
41074
41072
|
temperature,
|
41075
41073
|
baseUrl: baseUrlOllama
|
package/package.json
CHANGED
File without changes
|
File without changes
|