Skip to content

Commit

Permalink
Merge pull request #25 from subquery/fixes-20241106
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
stwiname authored Nov 5, 2024
2 parents 3a1b861 + 4e98501 commit 5b22102
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 8 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
subquery-delegator
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- RagTool parameters naming missmatch (#25)

### Changed
- Docker: Exclude submodule, remove default project argument (#25)

## [0.0.3] - 2024-11-05
### Changed
Expand Down
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ WORKDIR /ai-app
COPY . .
RUN deno cache ./src/index.ts

ENTRYPOINT ["./src/index.ts"]

CMD ["-p","/ai-app"]
ENTRYPOINT ["./src/index.ts"]
7 changes: 6 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import type { ISandbox } from "./sandbox/sandbox.ts";
import * as lancedb from "@lancedb/lancedb";
import type { IPFSClient } from "./ipfs.ts";
import { Loader } from "./loader.ts";
import { fromFileUrlSafe, getPrompt } from "./util.ts";
import { fromFileUrlSafe, getPrompt, getVersion } from "./util.ts";
import { getLogger } from "./logger.ts";

const logger = await getLogger("app");

export async function runApp(config: {
projectPath: string;
Expand All @@ -25,6 +28,8 @@ export async function runApp(config: {
streamKeepAlive: number;
cacheDir?: string;
}): Promise<void> {
logger.info(`Subql AI Framework (${await getVersion()})`);

const model = new Ollama({ host: config.host });

const loader = new Loader(
Expand Down
5 changes: 2 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import yargs, {

import { IPFSClient } from "./ipfs.ts";
import ora from "ora";
import { getPrompt, setSpinner } from "./util.ts";
import denoCfg from "../deno.json" with { type: "json" };
import { getPrompt, getVersion, setSpinner } from "./util.ts";
import { initLogger } from "./logger.ts";

const DEFAULT_PORT = 7827;
Expand Down Expand Up @@ -73,7 +72,7 @@ function ipfsFromArgs(
yargs(Deno.args)
.env("SUBQL_AI")
.scriptName("subql-ai")
.version(denoCfg.version)
.version(await getVersion())
.command(
"$0",
"Run a SubQuery AI app",
Expand Down
3 changes: 3 additions & 0 deletions src/subcommands/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getDefaultSandbox } from "../sandbox/index.ts";
import type { ProjectManifest } from "../project/project.ts";
import type { IPFSClient } from "../ipfs.ts";
import { Loader } from "../loader.ts";
import { getVersion } from "../util.ts";

type StaticProject = ProjectManifest & {
tools?: string[];
Expand Down Expand Up @@ -38,6 +39,8 @@ export async function projectInfo(
const [_, manifest] = await loader.getManifest();
const staticProject = await getProjectJson(manifest, loader);

console.log(`Subql AI Framework (${await getVersion()})`);

if (json) {
console.log(JSON.stringify(
staticProject,
Expand Down
2 changes: 1 addition & 1 deletion src/tools/ragTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class RagTool extends FunctionTool {
type: "object",
required: ["query"],
properties: {
account: {
query: {
type: "string",
description: "A search string, generally the users prompt",
},
Expand Down
8 changes: 8 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,11 @@ export function timeout(ms: number): Promise<void> {
setTimeout(() => resolve(), ms);
});
}

export async function getVersion(): Promise<string> {
const { default: denoCfg } = await import("../deno.json", {
with: { type: "json" },
});

return denoCfg.version;
}

0 comments on commit 5b22102

Please sign in to comment.