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

Conversation

@namchuai
Copy link
Contributor

@namchuai namchuai commented Apr 23, 2024

Description

This PR refactors the Jan Server API into Cortex-JS, implemented using the Nest framework and structured according to the Clean Architecture.

src
├── domain                                       // Contains domain-related logic
│   ├── models                                   // Contains domain models
│   │   └── [context].interface.ts               // Interface files for domain models
│   └── repositories                             // Contains repository interfaces for interacting with data
├── infrastructure                               // Contains infrastructure-related logic
│   ├── controllers                              // Contains controllers for handling HTTP requests
│   ├── database                                 // Contains database-related logic (Framework-dependent)
│   ├── dtos                                     // Contains Data Transfer Objects (DTOs)
│   │   └── [context]                            // Specific context for DTOs (Framework-dependent)
│   │       └── *.dto.ts                         // DTO files for the specified context
│   └── entities                                 // Contains entity classes
│       └── [context].entity.ts                  // Entity files for the specified context (Framework-dependent)
└── usecases                                     // Contains use case logic
    └── [context]                                // Specific context for use cases
        └── [context].usecases.ts                // Use case files for the specified context

Introduces 3 levels of Providers and Extensions:

  1. Internal Providers: Cortex-CPP, an internal reference that can access all use cases, repositories, and entities.
  2. Core Extensions: Pre-installed extensions that require no additional actions.
  3. External Extensions: The deployer can set an ENV to point to external extensions at runtime.
├── extensions                                  // Contains extensions-related logic
│   └── [core-extension-module]                 // Core extension module folder
└── infrastructure                              // Contains infrastructure-related logic
    └── providers                                // Contains provider-related logic
        └── cortex                               // Cortex provider folder
            └── cortex-provider-impl             // Cortex provider implementation folder

There are 3 commands supported:

// to pull a model
cortex pull {model_id}

// to start the cpp engine
cortex start

// to load a certain model
cortex load {model_json}

// Serve as API Server
cortex serve

@namchuai namchuai force-pushed the feat/add-cortex-js branch 2 times, most recently from 30009c9 to 0215ae1 Compare April 24, 2024 04:04
@louis-jan
Copy link
Contributor

louis-jan commented Apr 24, 2024

#2784

@louis-jan louis-jan changed the base branch from main to dev April 26, 2024 03:07
@namchuai namchuai force-pushed the feat/add-cortex-js branch 3 times, most recently from d0f1539 to 5c4ae19 Compare April 29, 2024 07:57
@louis-jan louis-jan force-pushed the feat/add-cortex-js branch 2 times, most recently from 04b8db0 to 9993a69 Compare May 2, 2024 16:05
@louis-jan louis-jan force-pushed the feat/add-cortex-js branch from 0178bde to 2a20931 Compare May 7, 2024 07:29
@louis-jan louis-jan marked this pull request as ready for review May 13, 2024 02:10
@louis-jan louis-jan merged commit d2c83b4 into dev May 13, 2024
@louis-jan louis-jan changed the title [DRAFT] feat: add cortex-js feat: add cortex-js May 13, 2024
@namchuai namchuai deleted the feat/add-cortex-js branch May 17, 2024 07:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants