Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 4589ce7

Browse files
authored
Merge branch 'dev' into chore/models-api
2 parents 2691cfc + 5684fe6 commit 4589ce7

File tree

12 files changed

+511
-38
lines changed

12 files changed

+511
-38
lines changed

README.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ Cortex releases 2 preview versions for advanced users to try new features early
285285
#### Windows
286286

287287
1. Clone the Cortex.cpp repository [here](https://github.com/janhq/cortex.cpp).
288-
2. Navigate to the `engine > vcpkg` folder.
288+
2. Navigate to the `engine` folder.
289289
3. Configure the vpkg:
290290

291291
```bash
@@ -294,16 +294,16 @@ cd vcpkg
294294
vcpkg install
295295
```
296296

297-
4. Build the Cortex.cpp inside the `build` folder:
297+
4. Build the Cortex.cpp inside the `engine/build` folder:
298298

299299
```bash
300300
mkdir build
301301
cd build
302-
cmake .. -DBUILD_SHARED_LIBS=OFF -DCMAKE_TOOLCHAIN_FILE=path_to_vcpkg_folder/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static
302+
cmake .. -DBUILD_SHARED_LIBS=OFF -DCMAKE_TOOLCHAIN_FILE=path_to_vcpkg_folder_in_cortex_repo/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static
303+
cmake --build . --config Release
303304
```
304305

305-
5. Use Visual Studio with the C++ development kit to build the project using the files generated in the `build` folder.
306-
6. Verify that Cortex.cpp is installed correctly by getting help information.
306+
5. Verify that Cortex.cpp is installed correctly by getting help information.
307307

308308
```sh
309309
cortex -h
@@ -312,7 +312,7 @@ cortex -h
312312
#### MacOS
313313

314314
1. Clone the Cortex.cpp repository [here](https://github.com/janhq/cortex.cpp).
315-
2. Navigate to the `engine > vcpkg` folder.
315+
2. Navigate to the `engine` folder.
316316
3. Configure the vpkg:
317317

318318
```bash
@@ -321,17 +321,16 @@ cd vcpkg
321321
vcpkg install
322322
```
323323

324-
4. Build the Cortex.cpp inside the `build` folder:
324+
4. Build the Cortex.cpp inside the `engine/build` folder:
325325

326326
```bash
327327
mkdir build
328328
cd build
329-
cmake .. -DCMAKE_TOOLCHAIN_FILE=path_to_vcpkg_folder/vcpkg/scripts/buildsystems/vcpkg.cmake
329+
cmake .. -DCMAKE_TOOLCHAIN_FILE=path_to_vcpkg_folder_in_cortex_repo/vcpkg/scripts/buildsystems/vcpkg.cmake
330330
make -j4
331331
```
332332

333-
5. Use Visual Studio with the C++ development kit to build the project using the files generated in the `build` folder.
334-
6. Verify that Cortex.cpp is installed correctly by getting help information.
333+
5. Verify that Cortex.cpp is installed correctly by getting help information.
335334

336335
```sh
337336
cortex -h
@@ -340,7 +339,7 @@ cortex -h
340339
#### Linux
341340

342341
1. Clone the Cortex.cpp repository [here](https://github.com/janhq/cortex.cpp).
343-
2. Navigate to the `engine > vcpkg` folder.
342+
2. Navigate to the `engine` folder.
344343
3. Configure the vpkg:
345344

346345
```bash
@@ -349,17 +348,16 @@ cd vcpkg
349348
vcpkg install
350349
```
351350

352-
4. Build the Cortex.cpp inside the `build` folder:
351+
4. Build the Cortex.cpp inside the `engine/build` folder:
353352

354353
```bash
355354
mkdir build
356355
cd build
357-
cmake .. -DCMAKE_TOOLCHAIN_FILE=path_to_vcpkg_folder/vcpkg/scripts/buildsystems/vcpkg.cmake
356+
cmake .. -DCMAKE_TOOLCHAIN_FILE=path_to_vcpkg_folder_in_cortex_repo/vcpkg/scripts/buildsystems/vcpkg.cmake
358357
make -j4
359358
```
360359

361-
5. Use Visual Studio with the C++ development kit to build the project using the files generated in the `build` folder.
362-
6. Verify that Cortex.cpp is installed correctly by getting help information.
360+
5. Verify that Cortex.cpp is installed correctly by getting help information.
363361

364362
```sh
365363
cortex -h

docs/docs/architecture/cortex-db.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/docs/architecture/cortex-db.mdx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: cortex.db
3+
description: cortex.db Overview.
4+
slug: "cortex-db"
5+
---
6+
7+
import Tabs from "@theme/Tabs";
8+
import TabItem from "@theme/TabItem";
9+
10+
:::warning
11+
🚧 Cortex.cpp is currently under development. Our documentation outlines the intended behavior of Cortex, which may not yet be fully implemented in the codebase.
12+
:::
13+
14+
This document outlines the architecture of the database designed to store and manage various types of entities and their associated metadata.
15+
16+
## Table Structure
17+
### models Table
18+
The `models` table is designed to hold metadata about various AI models. Below is the structure of the table:
19+
20+
| Column Name | Data Type | Description |
21+
|--------------------|-----------|---------------------------------------------------------|
22+
| model_id | TEXT | A unique identifier for each model (Primary Key). |
23+
| author_repo_id | TEXT | The identifier for the repository where the model is stored. |
24+
| branch_name | TEXT | The branch name in the repository that contains the model. |
25+
| path_to_model_yaml | TEXT | The file path to the YAML configuration file for the model. |

docs/docs/architecture/cortexrc.mdx

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,37 @@ Cortex.cpp supports reading its configuration from a file called `.cortexrc`. Us
1616
## File Location
1717
The configuration file is stored in the following locations:
1818

19-
- **Windows**:
20-
- Stable: `C:\Users\<username>\.cortexrc`
21-
- Beta: `C:\Users\<username>\.cortexrc-beta`
22-
- Nighty: `C:\Users\<username>\.cortexrc-nightly`
23-
- **Linux**:
24-
- Stable: `/home/<username>/.cortexrc`
25-
- Beta: `/home/<username>/.cortexrc-beta`
26-
- Nighty: `/home/<username>/.cortexrc-nightly`
27-
- **macOS**:
28-
- Stable: `/Users/<username>/.cortexrc`
29-
- Beta: `/Users/<username>/.cortexrc-beta`
30-
- Nighty: `/Users/<username>/.cortexrc-nightly`
19+
- **Windows**: `C:\Users\<username>\.cortexrc`
20+
- **Linux**: `/home/<username>/.cortexrc`
21+
- **macOS**: `/Users/<username>/.cortexrc`
3122

3223
## Configuration Parameters
3324
You can configure the following parameters in the `.cortexrc` file:
3425
| Parameter | Description | Default Value |
3526
|------------------|--------------------------------------------------|--------------------------------|
3627
| `dataFolderPath` | Path to the folder where `.cortexrc` located. | User's home folder. |
37-
| `apiServerHost` | Host address for the Cortex.cpp API server. | `127.0.0.1` |
38-
| `apiServerPort` | Port number for the Cortex.cpp API server. | `39281` |
28+
| `apiServerHost` | Host address for the Cortex.cpp API server. | `127.0.0.1` |
29+
| `apiServerPort` | Port number for the Cortex.cpp API server. | `39281` |
30+
| `logFolderPath` | Path the folder where logs are located | User's home folder. |
31+
| `logLlamaCppPath` | The llama-cpp engine . | `./logs/cortex.log` |
32+
| `logTensorrtLLMPath` | The tensorrt-llm engine log file path. | `./logs/cortex.log` |
33+
| `logOnnxPath` | The onnxruntime engine log file path. | `./logs/cortex.log` |
34+
| `maxLogLines` | The maximum log lines that write to file. | `100000` |
35+
| `checkedForUpdateAt` | The last time for checking updates. | `0` |
36+
| `latestRelease` | The lastest release vesion. | Empty string |
37+
| `huggingFaceToken` | HuggingFace token. | Empty string |
3938

4039
Example of the `.cortexrc` file:
4140
```
41+
logFolderPath: /Users/<username>/cortexcpp
42+
logLlamaCppPath: ./logs/cortex.log
43+
logTensorrtLLMPath: ./logs/cortex.log
44+
logOnnxPath: ./logs/cortex.log
4245
dataFolderPath: /Users/<username>/cortexcpp
46+
maxLogLines: 100000
4347
apiServerHost: 127.0.0.1
4448
apiServerPort: 39281
49+
checkedForUpdateAt: 1730501224
50+
latestRelease: v1.0.1
51+
huggingFaceToken: ""
4552
```

docs/docs/architecture/updater.mdx

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: Updater
3+
description: Updater Overview.
4+
slug: "updater"
5+
---
6+
7+
import Tabs from "@theme/Tabs";
8+
import TabItem from "@theme/TabItem";
9+
10+
:::warning
11+
🚧 Cortex.cpp is currently under development. Our documentation outlines the intended behavior of Cortex, which may not yet be fully implemented in the codebase.
12+
:::
13+
14+
This document outlines the architectural design for a C++ updater responsible for downloading and executing installers for two binaries: CLI and Server.
15+
16+
## Overview
17+
18+
The updater is designed to check for available updates, download the necessary installer files, and execute them to update the CLI and Server binaries. The architecture consists of several key components that work together to achieve this functionality.
19+
20+
## Components
21+
22+
### 1. **Version Management Module**
23+
24+
- **Purpose**: Responsible for checking the current version of the installed binaries and determining if updates are available.
25+
- **Responsibilities**:
26+
- Retrieve the current version from local installations.
27+
- Fetch the latest version information from a remote source, latest version information is saved to `.cortexrc`.
28+
- Determine if an update is necessary based on version comparison.
29+
30+
### 2. **Installer Download Manager**
31+
32+
- **Purpose**: Handles downloading the installer files from specified URLs.
33+
- **Responsibilities**:
34+
- Manage HTTP requests to fetch installer files.
35+
- Handle errors during download.
36+
- Save downloaded installers in a temporary directory.
37+
38+
### 3. **Installer Execution Module**
39+
40+
- **Purpose**: Executes the downloaded installer files to perform updates.
41+
- **Responsibilities**:
42+
- Launch the installer with appropriate command-line arguments.
43+
- Monitor the installation process and capture any output or errors.
44+
- Ensure that installation completes successfully before proceeding.
45+
46+
### 4. **User Interface (CLI)**
47+
48+
- **Purpose**: Provides a command-line interface for users to initiate updates and view status messages.
49+
- **Responsibilities**:
50+
- Display current version information for CLI and Server: `cortex -v`
51+
- Inform users about available updates and progress during downloading and installation.
52+
- Handle user input for initiating updates: `(sudo) cortex update`
53+
54+
## Workflow
55+
56+
1. **Initialization**:
57+
- The updater starts and initializes all necessary modules.
58+
59+
2. **Version Check**:
60+
- The Version Management Module retrieves the current versions of both CLI and Server from local installations.
61+
- It fetches the latest version information from a remote source.
62+
63+
3. **Update Decision**:
64+
- If newer versions are available, the updater proceeds to download the installers; otherwise, it informs the user that no updates are necessary.
65+
66+
4. **Download Process**:
67+
- The Installer Download Manager downloads the latest installer files using HTTP requests.
68+
- Progress is reported back to the User Interface.
69+
70+
5. **Installer Execution**:
71+
- Once downloaded, the Installer Execution Module runs the installer with silent mode.
72+
- It monitors the installation process, capturing any output or errors.
73+
74+
6. **Completion Notification**:
75+
- After successful installation, the User Interface notifies users of completion or any issues encountered during installation.
76+
- Logs are updated with relevant information about the update process.

0 commit comments

Comments
 (0)