@resolveio/server-lib 22.3.204 → 22.3.205
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/methods/ai-terminal.js +22 -7
- package/methods/ai-terminal.js.map +1 -1
- package/package.json +1 -1
package/methods/ai-terminal.js
CHANGED
|
@@ -7045,22 +7045,37 @@ function resolveAssistantDataIntentDateWindow(message) {
|
|
|
7045
7045
|
var year_1 = Number(boundedEndMatch[3]) || now.getUTCFullYear();
|
|
7046
7046
|
var start = /\b(?:this|current)\s+month\b/.test(text)
|
|
7047
7047
|
? new Date(Date.UTC(year_1, endMonth, 1, 0, 0, 0, 0)).toISOString()
|
|
7048
|
-
:
|
|
7048
|
+
: /\b(?:this|current)\s+year\b|\bytd\b|\byear\s+to\s+date\b/.test(text)
|
|
7049
|
+
? new Date(Date.UTC(year_1, 0, 1, 0, 0, 0, 0)).toISOString()
|
|
7050
|
+
: undefined;
|
|
7049
7051
|
return {
|
|
7050
7052
|
start: start,
|
|
7051
7053
|
end: new Date(Date.UTC(year_1, endMonth, endDay, 23, 59, 59, 999)).toISOString(),
|
|
7052
7054
|
year: year_1
|
|
7053
7055
|
};
|
|
7054
7056
|
}
|
|
7057
|
+
var boundedEndMonthMatch = text.match(/\b(?:until|through|thru|to)\s+(january|jan|february|feb|march|mar|april|apr|may|june|jun|july|jul|august|aug|september|sep|october|oct|november|nov|december|dec)(?:,?\s+([0-9]{4}))?\b/);
|
|
7058
|
+
if (boundedEndMonthMatch) {
|
|
7059
|
+
var endMonth = monthNames[boundedEndMonthMatch[1]];
|
|
7060
|
+
var year_2 = Number(boundedEndMonthMatch[2]) || now.getUTCFullYear();
|
|
7061
|
+
var start = /\b(?:this|current)\s+year\b|\bytd\b|\byear\s+to\s+date\b/.test(text)
|
|
7062
|
+
? new Date(Date.UTC(year_2, 0, 1, 0, 0, 0, 0)).toISOString()
|
|
7063
|
+
: undefined;
|
|
7064
|
+
return {
|
|
7065
|
+
start: start,
|
|
7066
|
+
end: new Date(Date.UTC(year_2, endMonth + 1, 0, 23, 59, 59, 999)).toISOString(),
|
|
7067
|
+
year: year_2
|
|
7068
|
+
};
|
|
7069
|
+
}
|
|
7055
7070
|
var monthMatch = text.match(/\b(january|jan|february|feb|march|mar|april|apr|may|june|jun|july|jul|august|aug|september|sep|october|oct|november|nov|december|dec)\s+([0-9]{4})\b/);
|
|
7056
7071
|
if (monthMatch) {
|
|
7057
7072
|
var month = monthNames[monthMatch[1]];
|
|
7058
|
-
var
|
|
7059
|
-
if (Number.isFinite(
|
|
7073
|
+
var year_3 = Number(monthMatch[2]);
|
|
7074
|
+
if (Number.isFinite(year_3) && month >= 0) {
|
|
7060
7075
|
return {
|
|
7061
|
-
start: new Date(Date.UTC(
|
|
7062
|
-
end: new Date(Date.UTC(
|
|
7063
|
-
year:
|
|
7076
|
+
start: new Date(Date.UTC(year_3, month, 1, 0, 0, 0, 0)).toISOString(),
|
|
7077
|
+
end: new Date(Date.UTC(year_3, month + 1, 0, 23, 59, 59, 999)).toISOString(),
|
|
7078
|
+
year: year_3
|
|
7064
7079
|
};
|
|
7065
7080
|
}
|
|
7066
7081
|
}
|
|
@@ -7663,7 +7678,7 @@ function buildAssistantDataRequestClassifierMessages(params) {
|
|
|
7663
7678
|
'Do not create MongoDB pipelines, queries, field paths, or collections.',
|
|
7664
7679
|
'Preserve every explicit grouping phrase: "by month by chemical" must produce two requested_breakdowns, one for month and one for chemical.',
|
|
7665
7680
|
'Interpret "by", "per", "break down by", and "group by" as requested_breakdowns.',
|
|
7666
|
-
'Interpret date phrases like "this month", "last month", "until June 12", and "last 6 months" as date_range or filters when clear.',
|
|
7681
|
+
'Interpret date phrases like "this month", "last month", "until June 12", "through May", "past 30 days", and "last 6 months" as date_range or filters when clear.',
|
|
7667
7682
|
'For time breakdowns, set type="time" and granularity to one of year, quarter, month, week, day, date.',
|
|
7668
7683
|
'For configured dimensions, set type="entity" and dimension to the candidate dimension id.',
|
|
7669
7684
|
'If unsure, include an ambiguity instead of guessing.',
|