Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovidiu Rusu committed Dec 12, 2024
1 parent a3df615 commit 53bbb81
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Unreleased

- Add setup support for external data sources
- Add `sema4ai.dropDataSource` command
- Add Datasources to the UI
- Add `sema4ai.getActionsMetadata` command
Expand Down
13 changes: 4 additions & 9 deletions sema4ai/vscode-client/src/robo/dataSourceHandling.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import { Uri, window, commands } from "vscode";
import { OUTPUT_CHANNEL } from "../channel";
import { logError, OUTPUT_CHANNEL } from "../channel";
import { RobotEntry } from "../viewsCommon";
import { DatasourceInfo } from "../protocols";
import { langServer } from "../extension";
import { startDataServerAndGetInfo } from "../dataExtension";

function isExternalDatasource(datasource: DatasourceInfo): boolean {
const externalEngines = ["custom", "files", "models"];
const isEngineExternal =
!externalEngines.includes(datasource.engine) && !datasource.engine.startsWith("prediction");

const isMissingModelAndTable =
!datasource.model_name && !datasource.created_table && datasource.engine !== "custom";

return isEngineExternal || isMissingModelAndTable;
return !externalEngines.includes(datasource.engine) && !datasource.engine.startsWith("prediction");
}

export const setupDataSource = async (entry?: RobotEntry) => {
Expand All @@ -38,7 +32,8 @@ export const setupDataSource = async (entry?: RobotEntry) => {
try {
await commands.executeCommand("sema4ai-data.database.add");
} catch (e) {
window.showErrorMessage("Could not run setup command. Make sure you have a data server active.");
logError("Could not run setup data source command", e, "ERR_DATA_SOURCE_SETUP");
window.showErrorMessage(`"Could not run setup data source command: ${e.message}"`);
}

return;
Expand Down

0 comments on commit 53bbb81

Please sign in to comment.