Skip to content

Commit

Permalink
server/llm: first steps towards supporting ollama
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldschilly committed Feb 23, 2024
1 parent db74cf7 commit fd4a48e
Show file tree
Hide file tree
Showing 13 changed files with 641 additions and 54 deletions.
4 changes: 4 additions & 0 deletions src/packages/frontend/components/language-model-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { unreachable } from "@cocalc/util/misc";
import AIAvatar from "./ai-avatar";
import GoogleGeminiLogo from "./google-gemini-avatar";
import GooglePalmLogo from "./google-palm-avatar";
import OllamaAvatar from "./ollama-avatar";
import OpenAIAvatar from "./openai-avatar";

export function LanguageModelVendorAvatar(
Expand Down Expand Up @@ -40,6 +41,9 @@ export function LanguageModelVendorAvatar(
return fallback();
}
}
case "ollama":
return <OllamaAvatar size={size} style={style} />;

default:
unreachable(vendor);
return fallback();
Expand Down
33 changes: 33 additions & 0 deletions src/packages/frontend/components/ollama-avatar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { CSS } from "../app-framework";
import ollamaPng from "./ollama.png";

export default function OllamaAvatar({
size = 64,
style,
}: {
size: number;
style?: CSS;
}) {
// render the ollamaPng (a square png image with transparent background) with the given size and background color

return (
<div
style={{
width: size,
height: size,
display: "inline-block",
position: "relative",
}}
>
<img
src={ollamaPng}
style={{
width: size,
height: size,
backgroundColor: "transparent",
...style,
}}
/>
</div>
);
}
Binary file added src/packages/frontend/components/ollama.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/packages/next/components/openai/vendor-status-check.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ export function VendorStatusCheck({ vendor }: { vendor: Vendor }): JSX.Element {
.
</>
);
case "ollama":
return (
<>
This Ollama based API endpoint does not have a status page. If you are
experiencing issues you have to check with the API service directly or
try again later.
</>
);
default:
unreachable(vendor);
}
Expand Down
Loading

0 comments on commit fd4a48e

Please sign in to comment.