Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
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
60 changes: 30 additions & 30 deletions .github/workflows/cortex-cpp-quality-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,36 +106,36 @@ jobs:
cd engine
make run-unit-tests

- name: Run e2e tests
if: runner.os != 'Windows' && github.event.pull_request.draft == false
run: |
cd engine
cp build/cortex build/cortex-nightly
cp build/cortex build/cortex-beta
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install requests
python e2e-test/main.py
rm build/cortex-nightly
rm build/cortex-beta
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


- name: Run e2e tests
if: runner.os == 'Windows' && github.event.pull_request.draft == false
run: |
cd engine
cp build/cortex.exe build/cortex-nightly.exe
cp build/cortex.exe build/cortex-beta.exe
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install requests
python e2e-test/main.py
rm build/cortex-nightly.exe
rm build/cortex-beta.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Run e2e tests
# if: runner.os != 'Windows' && github.event.pull_request.draft == false
# run: |
# cd engine
# cp build/cortex build/cortex-nightly
# cp build/cortex build/cortex-beta
# python -m pip install --upgrade pip
# python -m pip install pytest
# python -m pip install requests
# python e2e-test/main.py
# rm build/cortex-nightly
# rm build/cortex-beta
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


# - name: Run e2e tests
# if: runner.os == 'Windows' && github.event.pull_request.draft == false
# run: |
# cd engine
# cp build/cortex.exe build/cortex-nightly.exe
# cp build/cortex.exe build/cortex-beta.exe
# python -m pip install --upgrade pip
# python -m pip install pytest
# python -m pip install requests
# python e2e-test/main.py
# rm build/cortex-nightly.exe
# rm build/cortex-beta.exe
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Pre-package
run: |
Expand Down
7 changes: 6 additions & 1 deletion engine/commands/cortex_upd_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ inline std::string GetRole() {
#if defined(_WIN32)
return "";
#else
return "sudo ";
// not root
if (getuid()) {
return "sudo ";
} else {
return "";
}
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions engine/services/model_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ cpp::result<std::string, std::string> ModelService::HandleCortexsoModel(

std::vector<std::string> options{};
for (const auto& branch : branches.value()) {
if (branch.name != "main") {
options.emplace_back(branch.name);
if (branch.second.name != "main") {
options.emplace_back(branch.second.name);
}
}
if (options.empty()) {
Expand Down
14 changes: 7 additions & 7 deletions engine/test/components/test_huggingface_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ TEST_F(HuggingFaceUtilTestSuite, TestGetModelRepositoryBranches) {
auto branches =
huggingface_utils::GetModelRepositoryBranches("cortexso", "tinyllama");

EXPECT_EQ(branches.value().size(), 3);
EXPECT_EQ(branches.value()[0].name, "gguf");
EXPECT_EQ(branches.value()[0].ref, "refs/heads/gguf");
EXPECT_EQ(branches.value()[1].name, "1b-gguf");
EXPECT_EQ(branches.value()[1].ref, "refs/heads/1b-gguf");
EXPECT_EQ(branches.value()[2].name, "main");
EXPECT_EQ(branches.value()[2].ref, "refs/heads/main");
EXPECT_GE(branches.value().size(), 3);
EXPECT_EQ(branches.value()["main"].name, "main");
EXPECT_EQ(branches.value()["main"].ref, "refs/heads/main");
EXPECT_EQ(branches.value()["1b-gguf"].name, "1b-gguf");
EXPECT_EQ(branches.value()["1b-gguf"].ref, "refs/heads/1b-gguf");
EXPECT_EQ(branches.value()["gguf"].name, "gguf");
EXPECT_EQ(branches.value()["gguf"].ref, "refs/heads/gguf");
}

TEST_F(HuggingFaceUtilTestSuite, TestGetHuggingFaceModelRepoInfoSuccessfully) {
Expand Down
9 changes: 5 additions & 4 deletions engine/utils/huggingface_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ struct HuggingFaceModelRepoInfo {
std::string createdAt;
};

inline cpp::result<std::vector<HuggingFaceBranch>, std::string>
inline cpp::result<std::unordered_map<std::string, HuggingFaceBranch>,
std::string>
GetModelRepositoryBranches(const std::string& author,
const std::string& modelName) {
if (author.empty() || modelName.empty()) {
Expand All @@ -65,14 +66,14 @@ GetModelRepositoryBranches(const std::string& author,
}

auto branches_json = result.value()["branches"];
std::vector<HuggingFaceBranch> branches{};
std::unordered_map<std::string, HuggingFaceBranch> branches{};

for (const auto& branch : branches_json) {
branches.push_back(HuggingFaceBranch{
branches[branch["name"]] = HuggingFaceBranch{
.name = branch["name"],
.ref = branch["ref"],
.targetCommit = branch["targetCommit"],
});
};
}

return branches;
Expand Down
Loading