Skip to content

Commit

Permalink
feat: add host option for ollama provider
Browse files Browse the repository at this point in the history
  • Loading branch information
tychenjiajun committed Sep 7, 2024
1 parent 8d6af65 commit 8b74732
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 231 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "exif-ai",
"version": "2.0.0",
"version": "2.0.1",
"description": "A Node.js CLI and library that uses Ollama or ZhipuAI to intelligently write image description to exif metadata by it's content.",
"homepage": "https://github.com/tychenjiajun/exif-ai",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion src/exif-ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const program = new Command();
const options = program.opts();

program
.version("2.0.0")
.version("2.0.1")
.description(getText("description") ?? "")
.requiredOption("-a, --api-provider <name>", getText("api-provider"))
.option("-i, --input <file>", getText("input"))
Expand Down
72 changes: 0 additions & 72 deletions src/provider/ollama.js

This file was deleted.

8 changes: 7 additions & 1 deletion src/provider/ollama.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
#!/usr/bin/env node
import ollama from "ollama";
import { Ollama } from "ollama";

export async function getDescription({
buffer,
model = "moondream",
prompt = "Describe image.",
providerArgs,
}: {
buffer: Buffer;
model?: string;
prompt?: string;
providerArgs?: string[];
}) {
const ollama = new Ollama({
host: providerArgs?.[0],
});

try {
const response = await ollama.chat({
model,
Expand Down
155 changes: 0 additions & 155 deletions src/provider/zhipu.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/provider/zhipu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ export async function getDescription({
console.error("An error occurred while getting the description:", error);
throw error; // Re-throw the error to be handled by the caller
}
}
}

0 comments on commit 8b74732

Please sign in to comment.