@querypanel/node-sdk 1.0.55 → 1.0.56
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 +9 -1
- package/dist/index.cjs +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -191,8 +191,8 @@ type QueryErrorCode = (typeof QueryErrorCode)[keyof typeof QueryErrorCode];
|
|
|
191
191
|
*/
|
|
192
192
|
declare class QueryPipelineError extends Error {
|
|
193
193
|
readonly code: QueryErrorCode;
|
|
194
|
-
readonly details?: Record<string, unknown
|
|
195
|
-
constructor(message: string, code: QueryErrorCode, details?: Record<string, unknown>);
|
|
194
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
195
|
+
constructor(message: string, code: QueryErrorCode, details?: Record<string, unknown> | undefined);
|
|
196
196
|
/**
|
|
197
197
|
* Check if this is a moderation error
|
|
198
198
|
*/
|
|
@@ -741,6 +741,8 @@ interface ChartModifyOptions {
|
|
|
741
741
|
* QueryPanel session ID for context-aware follow-ups.
|
|
742
742
|
* Pass the querypanelSessionId from a previous ask() response
|
|
743
743
|
* to preserve conversation history when modifying charts.
|
|
744
|
+
* If omitted, modifyChart starts a new QueryPanel session and sends
|
|
745
|
+
* the original question with modification hints.
|
|
744
746
|
*/
|
|
745
747
|
querypanelSessionId?: string;
|
|
746
748
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -191,8 +191,8 @@ type QueryErrorCode = (typeof QueryErrorCode)[keyof typeof QueryErrorCode];
|
|
|
191
191
|
*/
|
|
192
192
|
declare class QueryPipelineError extends Error {
|
|
193
193
|
readonly code: QueryErrorCode;
|
|
194
|
-
readonly details?: Record<string, unknown
|
|
195
|
-
constructor(message: string, code: QueryErrorCode, details?: Record<string, unknown>);
|
|
194
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
195
|
+
constructor(message: string, code: QueryErrorCode, details?: Record<string, unknown> | undefined);
|
|
196
196
|
/**
|
|
197
197
|
* Check if this is a moderation error
|
|
198
198
|
*/
|
|
@@ -741,6 +741,8 @@ interface ChartModifyOptions {
|
|
|
741
741
|
* QueryPanel session ID for context-aware follow-ups.
|
|
742
742
|
* Pass the querypanelSessionId from a previous ask() response
|
|
743
743
|
* to preserve conversation history when modifying charts.
|
|
744
|
+
* If omitted, modifyChart starts a new QueryPanel session and sends
|
|
745
|
+
* the original question with modification hints.
|
|
744
746
|
*/
|
|
745
747
|
querypanelSessionId?: string;
|
|
746
748
|
}
|
package/dist/index.js
CHANGED
|
@@ -1414,7 +1414,7 @@ function anonymizeResults(rows) {
|
|
|
1414
1414
|
}
|
|
1415
1415
|
|
|
1416
1416
|
// src/routes/modify.ts
|
|
1417
|
-
function buildModifiedQuestion(originalQuestion, modifications, pipeline) {
|
|
1417
|
+
function buildModifiedQuestion(originalQuestion, modifications, pipeline, hasSessionContext = false) {
|
|
1418
1418
|
const hints = [];
|
|
1419
1419
|
if (modifications.timeGranularity) {
|
|
1420
1420
|
hints.push(`group results by ${modifications.timeGranularity}`);
|
|
@@ -1449,7 +1449,7 @@ function buildModifiedQuestion(originalQuestion, modifications, pipeline) {
|
|
|
1449
1449
|
if (hints.length === 0) {
|
|
1450
1450
|
return originalQuestion;
|
|
1451
1451
|
}
|
|
1452
|
-
if (pipeline === "v2") {
|
|
1452
|
+
if (pipeline === "v2" && hasSessionContext) {
|
|
1453
1453
|
return hints.join(", ");
|
|
1454
1454
|
}
|
|
1455
1455
|
return `${originalQuestion} (${hints.join(", ")})`;
|
|
@@ -1560,6 +1560,7 @@ async function modifyChart(client, queryEngine, input, options, signal) {
|
|
|
1560
1560
|
const tenantId = resolveTenantId5(client, options?.tenantId);
|
|
1561
1561
|
const sessionId = crypto4.randomUUID();
|
|
1562
1562
|
const querypanelSessionId = options?.querypanelSessionId ?? sessionId;
|
|
1563
|
+
const hasQuerypanelSessionContext = !!options?.querypanelSessionId;
|
|
1563
1564
|
const chartType = options?.chartType ?? "vega-lite";
|
|
1564
1565
|
const hasSqlMods = !!input.sqlModifications;
|
|
1565
1566
|
const hasVizMods = !!input.vizModifications;
|
|
@@ -1596,7 +1597,8 @@ async function modifyChart(client, queryEngine, input, options, signal) {
|
|
|
1596
1597
|
const modifiedQuestion = buildModifiedQuestion(
|
|
1597
1598
|
input.question,
|
|
1598
1599
|
input.sqlModifications,
|
|
1599
|
-
options?.pipeline
|
|
1600
|
+
options?.pipeline,
|
|
1601
|
+
hasQuerypanelSessionContext
|
|
1600
1602
|
);
|
|
1601
1603
|
if (options?.pipeline === "v2") {
|
|
1602
1604
|
finalQuestion = modifiedQuestion;
|