Skip to content

Commit

Permalink
Fix for exo with the model list not being at 'data' endpoint but at t…
Browse files Browse the repository at this point in the history
…he res directly; added flake and envrc for nix-based setups
  • Loading branch information
Jens Rabe committed Nov 29, 2024
1 parent 9b62edd commit 18c835d
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 1 deletion.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ _worker.bundle

Modelfile
modelfiles
.direnv
5 changes: 4 additions & 1 deletion app/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,10 @@ async function getOpenAILikeModels(): Promise<ModelInfo[]> {
});
const res = (await response.json()) as any;

return res.data.map((model: any) => ({
// When using the OpenAI-compatible endpoint from Exo, the data is not at `res.data` but `res` directly.
const d = res.data ? res.data : res;

return d.map((model: any) => ({
name: model.id,
label: model.id,
provider: 'OpenAILike',
Expand Down
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
description = "Environment flake";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem(system:
let pkgs = nixpkgs.legacyPackages.${system}; in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs_23
pnpm
];
};
}
);
}

0 comments on commit 18c835d

Please sign in to comment.