Skip to content

Commit

Permalink
Fix #28 (#29)
Browse files Browse the repository at this point in the history
* Fix #28

* Add test coverage
  • Loading branch information
chaosrealm authored Jul 12, 2024
1 parent be10557 commit 29ca780
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cortex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ test("can configure, get, and delete and Cortexes", async () => {
overrides: {
companyInfo: "a very good company that does AI stuff",
companyName: "Cortex Click, Inc. --test",
inheritRules: false,
},
};

let cortex = await testClient.configureCortex(cortexName, cortexConfig);

cortex = await testClient.getCortex(cortexName);
expect(cortex.config.catalogs).toStrictEqual(cortexConfig.catalogs);
expect(cortex.config.overrides?.inheritRules).toBe(true); // test input doesn't specify `inheritRules`, should be true by default
// TODO - check all the properties

// delete the cortex
await cortex.delete();
// assert that the get failes
// assert that the get fails
await expect(async () => {
await testClient.getCortex(cortexName);
}).rejects.toThrowError("Failed to get cortex: Not Found");
Expand Down
4 changes: 2 additions & 2 deletions cortex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class Cortex {
overrides: {
companyInfo: body.companyInfo,
companyName: body.companyName,
inheritRules: !!body.inheritRules,
inheritRules: body.inheritRules === false ? false : true,
},
};
return new Cortex(config, apiClient, name);
Expand All @@ -156,7 +156,7 @@ export class Cortex {
examples: config.chatConfig?.examples,
greeting: config.chatConfig?.greeting,
intro: config.chatConfig?.intro,
inheritRules: !!config.overrides?.inheritRules,
inheritRules: config.overrides?.inheritRules === false ? false : true,
public: !!config.public,
instructions: config.instructions,
personality: config.customizations?.personality,
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 29ca780

Please sign in to comment.