Skip to content

Commit

Permalink
feat: model check
Browse files Browse the repository at this point in the history
  • Loading branch information
akastercomcom committed Sep 20, 2023
1 parent ee5a97f commit 9cdc4b2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ainize.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as NodeCache from "node-cache";
import Middleware from "./middlewares/middleware";
import { DEFAULT_BILLING_CONFIG, getBlockChainEndpoint } from "./constants";
import { DEFAULT_BILLING_CONFIG, Path, getBlockChainEndpoint } from "./constants";
import Handler from "./handlers/handler";
import AppController from "./controllers/appController";
import Model from "./model";
Expand Down Expand Up @@ -66,7 +66,12 @@ export default class Ainize {
return this.model(modelName);
}

model(modelName: string): Model {
async model(modelName: string): Promise<Model> {
const modelPath = Path.app(modelName).root();
const modelData = await this.ain.getValue(modelPath);
if(!modelData) {
throw new Error("Model not found");
}
return new Model(modelName);
}

Expand Down

0 comments on commit 9cdc4b2

Please sign in to comment.