Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/v2/cli.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Command, OptionValues } from "commander";
import { Client } from "./client.js";
import { PathInput } from "../input/index.js";
import * as console from "console";
import { Client, InputSource, PathInput, UrlInput } from "@/index.js";
import { BaseInference } from "@/v2/parsing/inference/index.js";
import { BaseProduct } from "@/v2/product/baseProduct.js";
import {
Expand Down Expand Up @@ -37,7 +36,12 @@ async function enqueueAndGetInference(
options: OptionValues
): Promise<void> {
const mindeeClient = initClient(options);
const inputSource = new PathInput({ inputPath: inputPath });
let inputSource: InputSource;
if (inputPath.startsWith("https://")) {
inputSource = new UrlInput({ url: inputPath });
} else {
inputSource = new PathInput({ inputPath: inputPath });
}
const response = await mindeeClient.enqueueAndGetResult(
product,
inputSource,
Expand Down Expand Up @@ -71,7 +75,7 @@ function addMainOptions(prog: Command) {
"-m, --model <model_id>",
"Model ID (required)"
);
prog.argument("<input_path>", "full path to the file");
prog.argument("<input_path>", "full path or URL to the file");
}

export function cli() {
Expand Down
3 changes: 3 additions & 0 deletions tests/test_v1_code_samples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ OUTPUT_FILE='../test_code_samples/_test_v1.js'
ACCOUNT=$1
ENDPOINT=$2

if [ -z "${ACCOUNT}" ]; then echo "ACCOUNT is required"; exit 1; fi
if [ -z "${ENDPOINT}" ]; then echo "ENDPOINT is required"; exit 1; fi

rm -fr ../test_code_samples
mkdir ../test_code_samples

Expand Down
2 changes: 1 addition & 1 deletion tests/test_v2_code_samples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ do
sed -i "s/MY_MODEL_ID/${MINDEE_V2_SE_TESTS_CROP_MODEL_ID}/" $OUTPUT_FILE
fi

if echo "${f}" | grep -q "v2_extraction.txt"
if echo "${f}" | grep -q "v2_extraction"
then
sed -i "s/MY_MODEL_ID/${MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID}/" $OUTPUT_FILE
fi
Expand Down