Skip to content

Commit

Permalink
update build process for updating models
Browse files Browse the repository at this point in the history
  • Loading branch information
aeltorio committed Oct 18, 2024
1 parent 67e1a29 commit e481994
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dev_server_port": 3000
},
"scripts": {
"build": "webpack --mode production",
"build": "npm run getGroqModels && npx webpack --mode production",
"build:dev": "webpack --mode development",
"dev-server": "webpack serve --mode development",
"getGroqModels": "node --import 'data:text/javascript,import { register } from \"node:module\"; import { pathToFileURL } from \"node:url\"; register(\"ts-node/esm\", pathToFileURL(\"./\"));' ./utils/initModels.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"commit": "4898c7691148c2e8db14fd3e02c7da7a8cca6480",
"date": "2024-10-18 11:55:58 +0200"
"commit": "67e1a29e85e238537e12dca4d54ccdb2ba8897d4",
"date": "2024-10-18 12:51:46 +0200"
}
35 changes: 18 additions & 17 deletions utils/initModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,22 @@ function normalizeModelName(name: string): string {
")";
return retString.trim();
}

const groqModels = getAIModels(groqProvider, apiKey, "llama");
groqModels.then((models) => {
models = models.map((model) => {
model.name = normalizeModelName(model.name);
return model;
});
const newConfig = { ...config };
// replace the models for the Groq provider
newConfig.providers = newConfig.providers.map((provider: AIProvider) => {
if (provider.name === "Groq") {
provider.models = models;
}
return provider;
if (apiKey !== "") {
const groqModels = getAIModels(groqProvider, apiKey, "llama");
groqModels.then((models) => {
models = models.map((model) => {
model.name = normalizeModelName(model.name);
return model;
});
const newConfig = { ...config };
// replace the models for the Groq provider
newConfig.providers = newConfig.providers.map((provider: AIProvider) => {
if (provider.name === "Groq") {
provider.models = models;
}
return provider;
});
//console.log(JSON.stringify(newConfig, null, 2));
writeFileSync("./src/config.json", JSON.stringify(newConfig, null, 2));
});
//console.log(JSON.stringify(newConfig, null, 2));
writeFileSync("./src/config.json", JSON.stringify(newConfig, null, 2));
});
}

0 comments on commit e481994

Please sign in to comment.