Skip to content

Commit

Permalink
update version
Browse files Browse the repository at this point in the history
  • Loading branch information
lixun910 committed Jan 28, 2025
1 parent a0755d3 commit 4095915
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 73 deletions.
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openassistant/common",
"version": "0.0.5",
"version": "0.0.6",
"description": "Common utilities for OpenAssistant",
"author": "Xun Li<[email protected]>",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/duckdb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openassistant/duckdb",
"version": "0.0.6",
"version": "0.0.7",
"description": "The duckdb SQL query addon for OpenAssistant",
"author": "Xun Li<[email protected]>",
"license": "MIT",
Expand Down
8 changes: 5 additions & 3 deletions packages/duckdb/src/query.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ type QueryDuckDBFunctionContext = {
getValues: (datasetName: string, variableName: string) => unknown[];
duckDB?: duckdb.AsyncDuckDB;
onSelected?: OnSelectedCallback;
isDraggable?: boolean;
config: {
isDraggable?: boolean;
};
};

type ValueOf<T> = T[keyof T];
Expand Down Expand Up @@ -241,7 +243,7 @@ export async function queryDuckDBCallbackFunction({
}

// get the context values
const { getValues, onSelected, isDraggable } = functionContext;
const { getValues, onSelected, config } = functionContext;

// if the variable names contain 'row_index', ignore it
// the row_index will be added later based on the columnData length
Expand Down Expand Up @@ -279,7 +281,7 @@ export async function queryDuckDBCallbackFunction({
sql,
dbTableName,
onSelected,
isDraggable,
isDraggable: Boolean(config.isDraggable),
},
};
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion packages/echarts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openassistant/echarts",
"version": "0.0.6",
"version": "0.0.7",
"author": "Xun Li<[email protected]>",
"description": "The echarts addon for OpenAssistant",
"main": "./dist/index.esm.js",
Expand Down
25 changes: 14 additions & 11 deletions packages/echarts/src/histogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import { histogramCallbackMessage, HistogramDataProps } from './histogram-plot';
* @param variableName - The name of the variable.
* @returns The values of the variable.
*/
type GetValues = (datasetName: string, variableName: string) => Promise<number[]>;
type GetValues = (
datasetName: string,
variableName: string
) => Promise<number[]>;

/**
* The callback function can be used to sync the selections of the histogram plot with the original dataset.
Expand All @@ -29,14 +32,14 @@ type OnSelectedCallback = (
* The context of the histogram function.
* @param getValues - Get the values of a variable from the dataset. See {@link GetValues} for more details.
* @param onSelected - The callback function can be used to sync the selections of the histogram plot with the original dataset. See {@link OnSelectedCallback} for more details.
* @param theme - The theme of the histogram plot. The possible values are 'light' and 'dark'.
* @param isDraggable - Whether the histogram plot is draggable e.g. to a dashboard.
* @param config - The configuration of the histogram plot.
* @param config.theme - The theme of the histogram plot. The possible values are 'light' and 'dark'.
* @param config.isDraggable - Whether the histogram plot is draggable e.g. to a dashboard.
*/
export type HistogramFunctionContext = {
getValues: GetValues;
onSelected?: OnSelectedCallback;
theme?: string;
isDraggable?: boolean;
config?: { isDraggable?: boolean; theme?: string };
};

type ValueOf<T> = T[keyof T];
Expand Down Expand Up @@ -124,9 +127,9 @@ async function histogramCallbackFunction({
functionName,
functionArgs,
functionContext,
}: CallbackFunctionProps): Promise<CustomFunctionOutputProps<
HistogramOutputResult, HistogramOutputData
>> {
}: CallbackFunctionProps): Promise<
CustomFunctionOutputProps<HistogramOutputResult, HistogramOutputData>
> {
if (!isHistogramFunctionArgs(functionArgs)) {
return {
type: 'error',
Expand All @@ -151,7 +154,7 @@ async function histogramCallbackFunction({
};
}

const { getValues, onSelected, theme, isDraggable } =
const { getValues, onSelected, config } =
functionContext as HistogramFunctionContext;

let values;
Expand Down Expand Up @@ -190,8 +193,8 @@ async function histogramCallbackFunction({
histogramData,
barDataIndexes,
onSelected,
theme,
isDraggable,
theme: config?.theme || 'dark',
isDraggable: Boolean(config?.isDraggable),
},
};
} catch (error) {
Expand Down
7 changes: 3 additions & 4 deletions packages/echarts/src/scatterplot/callback-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ export async function ScatterplotCallbackFunction({
};
}

const { getValues, filteredIndex, onSelected, theme, isDraggable } =
functionContext;
const { getValues, filteredIndex, onSelected, config } = functionContext;

let values: { x: number[]; y: number[] };

Expand Down Expand Up @@ -197,10 +196,10 @@ export async function ScatterplotCallbackFunction({
onSelected,
filteredIndex,
regressionResults,
theme,
theme: config?.theme || 'dark',
showLoess: false,
showRegressionLine: true,
isDraggable,
isDraggable: Boolean(config?.isDraggable),
},
};
} catch (error) {
Expand Down
7 changes: 4 additions & 3 deletions packages/echarts/src/scatterplot/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,16 @@ type OnSelectedCallback = (
*
* @param getValues - Get the values of two variables from the dataset. See {@link GetValues} for more details.
* @param onSelected - The callback function can be used to sync the selections of the scatterplot with the original dataset. See {@link OnSelectedCallback} for more details.
* @param theme - The theme of the scatterplot. The possible values are 'light' and 'dark'.
* @param filteredIndex - The indices of the selected points.
* @param config - The configuration of the scatterplot.
* @param config.isDraggable - The flag to indicate if the scatterplot is draggable.
* @param config.theme - The theme of the scatterplot. The possible values are 'light' and 'dark'.
*/
export type ScatterplotFunctionContext = {
getValues: GetValues;
onSelected: OnSelectedCallback;
filteredIndex?: number[];
theme?: string;
isDraggable?: boolean;
config?: { isDraggable?: boolean; theme?: string };
};

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/keplergl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openassistant/keplergl",
"version": "0.0.6",
"version": "0.0.7",
"author": "Xun Li<[email protected]>",
"description": "The mapping addon with Kepler.gl for OpenAssistant",
"main": "dist/index.esm.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/keplergl/src/map-layer/callback-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export async function CreateMapCallbackFunction({

try {
// get the dataset from the function context
const { getDataset, isDraggable } = functionContext;
const { getDataset, config } = functionContext;

const dataContent = getDataset({ datasetName });

Expand Down Expand Up @@ -111,7 +111,7 @@ export async function CreateMapCallbackFunction({
data: {
datasetName,
datasetForKepler,
isDraggable,
isDraggable: Boolean(config?.isDraggable),
},
};
} catch (error) {
Expand Down
9 changes: 8 additions & 1 deletion packages/keplergl/src/map-layer/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ export type GetDatasetForCreateMapFunctionArgs = {
datasetName: string;
};

/**
* The context for the createMap function.
* @param getDataset - The function to get the dataset.
* @param config - The configuration of the map.
* @param config.isDraggable - Whether the map is draggable.
* @param config.theme - The theme of the map.
*/
export type MapLayerFunctionContext = {
getDataset: ({ datasetName }: GetDatasetForCreateMapFunctionArgs) => unknown;
isDraggable: boolean;
config?: { isDraggable?: boolean; theme?: string };
};

type ValueOf<T> = T[keyof T];
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openassistant/ui",
"version": "0.0.7",
"version": "0.0.8",
"description": "Chat UI components for OpenAssistant",
"author": "Xun Li<[email protected]>",
"license": "MIT",
Expand Down
14 changes: 6 additions & 8 deletions playground/components/chat/assistant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ async function getScatterplotValuesFromDataset(
}
}

const IS_DRAGGABLE = true;

export default function Assistant({
screenCaptured,
setScreenCaptured,
Expand Down Expand Up @@ -79,6 +77,8 @@ export default function Assistant({
];
}, []);

const componentConfig = { isDraggable: true, theme: 'light' };

const myFunctions = useMemo(
() => [
createMapFunctionDefinition({
Expand All @@ -89,7 +89,7 @@ export default function Assistant({
}
return SAMPLE_DATASETS[datasetName];
},
isDraggable: IS_DRAGGABLE,
config: componentConfig,
}),
queryDuckDBFunctionDefinition({
getValues: (datasetName: string, variableName: string) => {
Expand All @@ -102,17 +102,15 @@ export default function Assistant({
);
}
},
isDraggable: IS_DRAGGABLE,
config: componentConfig,
}),
histogramFunctionDefinition({
getValues: getValuesFromMyDatasets,
theme: 'light',
isDraggable: IS_DRAGGABLE,
config: componentConfig,
}),
scatterplotFunctionDefinition({
getValues: getScatterplotValuesFromDataset,
theme: 'light',
isDraggable: IS_DRAGGABLE,
config: componentConfig,
}),
],
[SAMPLE_DATASETS]
Expand Down
12 changes: 6 additions & 6 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
"@loaders.gl/core": "^4.3.3",
"@loaders.gl/schema": "^4.3.3",
"@nextui-org/theme": "^2.4.4",
"@openassistant/common": "^0.0.5",
"@openassistant/core": "^0.0.6",
"@openassistant/duckdb": "^0.0.6",
"@openassistant/echarts": "^0.0.6",
"@openassistant/keplergl": "^0.0.6",
"@openassistant/ui": "^0.0.6",
"@openassistant/common": "^0.0.6",
"@openassistant/core": "^0.0.7",
"@openassistant/duckdb": "^0.0.7",
"@openassistant/echarts": "^0.0.7",
"@openassistant/keplergl": "^0.0.7",
"@openassistant/ui": "^0.0.8",
"apache-arrow": "^13.0.0",
"axios": "^1.7.9",
"echarts": "^5.5.1",
Expand Down
Loading

0 comments on commit 4095915

Please sign in to comment.