-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remote engine management (#4364)
* feat: remote engine management * chore: fix linter issue * chore: remove unused imports * fix: populate engines, models and legacy settings (#4403) * fix: populate engines, models and legacy settings * chore: legacy logics update configured remote engine * fix: check exist path before reading * fix: engines and models persist - race condition * chore: update issue state * test: update test cases * chore: bring back Cortex extension settings * chore: setup button gear / plus based apikey * chore: fix remote engine from welcome screen * chore: resolve linter issue * chore: support request headers template * chore: update engines using header_template instead of api_key_template * chore: update models on changes * fix: anthropic response template * chore: fix welcome screen and debounce update value input * chore: update engines list on changes * chore: update engines list on change * chore: update desc form add modal remote engines * chore: bump cortex version to latest RC * chore: fix linter * fix: transform payload of Anthropic and OpenAI * fix: typo * fix: openrouter model id for auto routing * chore: remove remote engine URL setting * chore: add cohere engine and model support * fix: should not clean on app launch - models list display issue * fix: local engine check logic * chore: bump app version to latest release 0.5.13 * test: fix failed tests --------- Co-authored-by: Louis <[email protected]>
- Loading branch information
1 parent
6b98f45
commit 2a0601f
Showing
138 changed files
with
1,949 additions
and
4,204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,19 @@ | ||
import { getEngineConfiguration } from './config'; | ||
import { getAppConfigurations, defaultAppConfig } from './config'; | ||
|
||
import { getJanExtensionsPath } from './config'; | ||
import { getJanDataFolderPath } from './config'; | ||
it('should return undefined for invalid engine ID', async () => { | ||
const config = await getEngineConfiguration('invalid_engine'); | ||
expect(config).toBeUndefined(); | ||
}); | ||
import { getAppConfigurations, defaultAppConfig } from './config' | ||
|
||
import { getJanExtensionsPath, getJanDataFolderPath } from './config' | ||
|
||
it('should return default config when CI is e2e', () => { | ||
process.env.CI = 'e2e'; | ||
const config = getAppConfigurations(); | ||
expect(config).toEqual(defaultAppConfig()); | ||
}); | ||
|
||
process.env.CI = 'e2e' | ||
const config = getAppConfigurations() | ||
expect(config).toEqual(defaultAppConfig()) | ||
}) | ||
|
||
it('should return extensions path when retrieved successfully', () => { | ||
const extensionsPath = getJanExtensionsPath(); | ||
expect(extensionsPath).not.toBeUndefined(); | ||
}); | ||
|
||
const extensionsPath = getJanExtensionsPath() | ||
expect(extensionsPath).not.toBeUndefined() | ||
}) | ||
|
||
it('should return data folder path when retrieved successfully', () => { | ||
const dataFolderPath = getJanDataFolderPath(); | ||
expect(dataFolderPath).not.toBeUndefined(); | ||
}); | ||
const dataFolderPath = getJanDataFolderPath() | ||
expect(dataFolderPath).not.toBeUndefined() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
import { getSystemResourceInfo } from './resource'; | ||
import { getSystemResourceInfo } from './resource' | ||
|
||
it('should return the correct system resource information with a valid CPU count', async () => { | ||
const mockCpuCount = 4; | ||
jest.spyOn(require('./config'), 'physicalCpuCount').mockResolvedValue(mockCpuCount); | ||
const logSpy = jest.spyOn(require('./logger'), 'log').mockImplementation(() => {}); | ||
|
||
const result = await getSystemResourceInfo(); | ||
const result = await getSystemResourceInfo() | ||
|
||
expect(result).toEqual({ | ||
numCpuPhysicalCore: mockCpuCount, | ||
memAvailable: 0, | ||
}); | ||
expect(logSpy).toHaveBeenCalledWith(`[CORTEX]::CPU information - ${mockCpuCount}`); | ||
}); | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,7 @@ | ||
import { SystemResourceInfo } from '../../types' | ||
import { physicalCpuCount } from './config' | ||
import { log } from './logger' | ||
|
||
export const getSystemResourceInfo = async (): Promise<SystemResourceInfo> => { | ||
const cpu = await physicalCpuCount() | ||
log(`[CORTEX]::CPU information - ${cpu}`) | ||
|
||
return { | ||
numCpuPhysicalCore: cpu, | ||
memAvailable: 0, // TODO: this should not be 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.