Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add Swagger UI Log Message and Update README.md with API Access Information #749

Merged
merged 2 commits into from
Jun 25, 2024

Conversation

l2D
Copy link
Contributor

@l2D l2D commented Jun 22, 2024

Describe Your Changes

  • Add log message to inform about Swagger UI on cortex-js/src/main.ts
  • Update information to access Cortex API Server & Swagger UI on README.md

Fixes Issues

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

l2D added 2 commits June 22, 2024 22:33
…ity at `/api` route

Signed-off-by: l2D <20911264+l2D@users.noreply.github.com>
Signed-off-by: l2D <20911264+l2D@users.noreply.github.com>
Copy link
Contributor

@louis-jan louis-jan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@l2D
Copy link
Contributor Author

l2D commented Jun 22, 2024

I've sometimes found QueryFailedError: SQLITE_BUSY: database is locked error while running the npm run test for cortex-js/ on local.

I'm not sure that the QueryFailedError: SQLITE_IOERR: disk I/O error on https://github.com/janhq/cortex/actions/runs/9626673253/job/26553178329#step:5:73 have related to this. Because I ran some CI runs on forked repository here and not found any issues.

But to address the SQLITE_BUSY: database is locked error, I made a specific modification by adding busyErrorRetry: 1000 to the sqlite-database.providers.ts file, which successfully resolved the issue.

      const dataSource = new DataSource({
        type: 'sqlite',
        busyErrorRetry: 1000, //
        database: sqlitePath,
        synchronize: process.env.NODE_ENV !== 'production',
        entities: [ThreadEntity, AssistantEntity, MessageEntity],
      });

https://github.com/janhq/cortex/blob/f5e6b2f48f61c74e8a81fca11b4ea7bfe39580fa/cortex-js/src/infrastructure/database/sqlite-database.providers.ts#L16-L21

Error log:

npm run test

> @janhq/cortex@0.0.1 test
> jest

 PASS  src/usecases/cortex/cortex.usecases.spec.ts
  ● Console

    console.log
      sqlitePath:  /Users/l2d/JanAI/cortex/cortex-js/src/infrastructure/commanders/test/test_data/cortex.db

      at InstanceWrapper.useFactory [as metatype] (infrastructure/database/sqlite-database.providers.ts:16:15)
          at async Promise.all (index 3)
          at async Promise.all (index 2)

 PASS  src/usecases/chat/chat.usecases.spec.ts (5.259 s)
  ● Console

    console.log
      sqlitePath:  /Users/l2d/JanAI/cortex/cortex-js/src/infrastructure/commanders/test/test_data/cortex.db

      at InstanceWrapper.useFactory [as metatype] (infrastructure/database/sqlite-database.providers.ts:16:15)
          at async Promise.all (index 3)
          at async Promise.all (index 4)

 PASS  src/infrastructure/controllers/chat.controller.spec.ts (5.574 s)
  ● Console

    console.log
      sqlitePath:  /Users/l2d/JanAI/cortex/cortex-js/src/infrastructure/commanders/test/test_data/cortex.db

      at InstanceWrapper.useFactory [as metatype] (infrastructure/database/sqlite-database.providers.ts:16:15)
          at async Promise.all (index 3)
          at async Promise.all (index 4)

 PASS  src/infrastructure/controllers/embeddings.controller.spec.ts (5.64 s)
  ● Console

    console.log
      sqlitePath:  /Users/l2d/JanAI/cortex/cortex-js/src/infrastructure/commanders/test/test_data/cortex.db

      at InstanceWrapper.useFactory [as metatype] (infrastructure/database/sqlite-database.providers.ts:16:15)
          at async Promise.all (index 3)
          at async Promise.all (index 4)

 PASS  src/usecases/models/models.usecases.spec.ts (5.707 s)
  ● Console

    console.log
      sqlitePath:  /Users/l2d/JanAI/cortex/cortex-js/src/infrastructure/commanders/test/test_data/cortex.db

      at InstanceWrapper.useFactory [as metatype] (infrastructure/database/sqlite-database.providers.ts:16:15)
          at async Promise.all (index 3)
          at async Promise.all (index 4)

 PASS  src/infrastructure/controllers/threads.controller.spec.ts (5.898 s)
  ● Console

    console.log
      sqlitePath:  /Users/l2d/JanAI/cortex/cortex-js/src/infrastructure/commanders/test/test_data/cortex.db

      at InstanceWrapper.useFactory [as metatype] (infrastructure/database/sqlite-database.providers.ts:16:15)
          at async Promise.all (index 3)
          at async Promise.all (index 2)

 PASS  src/usecases/assistants/assistants.usecases.spec.ts (5.974 s)
  ● Console

    console.log
      sqlitePath:  /Users/l2d/JanAI/cortex/cortex-js/src/infrastructure/commanders/test/test_data/cortex.db

      at InstanceWrapper.useFactory [as metatype] (infrastructure/database/sqlite-database.providers.ts:16:15)
          at async Promise.all (index 3)
          at async Promise.all (index 4)

 PASS  src/infrastructure/services/file-manager/file-manager.service.spec.ts
 PASS  src/infrastructure/controllers/assistants.controller.spec.ts (6.087 s)
  ● Console

    console.log
      sqlitePath:  /Users/l2d/JanAI/cortex/cortex-js/src/infrastructure/commanders/test/test_data/cortex.db

      at InstanceWrapper.useFactory [as metatype] (infrastructure/database/sqlite-database.providers.ts:16:15)
          at async Promise.all (index 3)
          at async Promise.all (index 4)

 PASS  src/infrastructure/services/download-manager/download-manager.service.spec.ts
 PASS  src/infrastructure/controllers/models.controller.spec.ts (6.27 s)
  ● Console

    console.log
      sqlitePath:  /Users/l2d/JanAI/cortex/cortex-js/src/infrastructure/commanders/test/test_data/cortex.db

      at InstanceWrapper.useFactory [as metatype] (infrastructure/database/sqlite-database.providers.ts:16:15)
          at async Promise.all (index 3)
          at async Promise.all (index 4)

 PASS  src/infrastructure/commanders/test/helpers.command.spec.ts
  ● Console

    console.log
      sqlitePath:  /Users/l2d/JanAI/cortex/cortex-js/src/infrastructure/commanders/test/test_data/cortex.db

      at InstanceWrapper.useFactory [as metatype] (infrastructure/database/sqlite-database.providers.ts:16:15)
          at async Promise.all (index 3)
          at async Promise.all (index 7)

 PASS  src/infrastructure/commanders/test/models.command.spec.ts (6.449 s)
  ● Console

    console.log
      sqlitePath:  /Users/l2d/JanAI/cortex/cortex-js/src/infrastructure/commanders/test/test_data/cortex.db

      at InstanceWrapper.useFactory [as metatype] (infrastructure/database/sqlite-database.providers.ts:16:15)
          at async Promise.all (index 3)
          at async Promise.all (index 7)

 PASS  src/usecases/messages/messages.usecases.spec.ts
  ● Console

    console.log
      sqlitePath:  /Users/l2d/JanAI/cortex/cortex-js/src/infrastructure/commanders/test/test_data/cortex.db

      at InstanceWrapper.useFactory [as metatype] (infrastructure/database/sqlite-database.providers.ts:16:15)
          at async Promise.all (index 3)
          at async Promise.all (index 2)

 FAIL  src/usecases/threads/threads.usecases.spec.ts
  ● Console

    console.log
      sqlitePath:  /Users/l2d/JanAI/cortex/cortex-js/src/infrastructure/commanders/test/test_data/cortex.db

      at InstanceWrapper.useFactory [as metatype] (infrastructure/database/sqlite-database.providers.ts:16:15)
          at async Promise.all (index 3)
          at async Promise.all (index 2)

  ● ThreadsService › should be defined

    QueryFailedError: SQLITE_BUSY: database is locked

      at Statement.handler (driver/sqlite/SqliteQueryRunner.ts:135:29)
      at Statement.replacement (../node_modules/sqlite3/lib/trace.js:25:27)
      at Statement.replacement (../node_modules/sqlite3/lib/trace.js:25:27)
      at Statement.replacement (../node_modules/sqlite3/lib/trace.js:25:27)

Test Suites: 1 failed, 14 passed, 15 total
Tests:       1 failed, 16 passed, 17 total
Snapshots:   0 total
Time:        6.846 s
Ran all test suites.

Ref:

@louis-jan louis-jan merged commit 106a09c into janhq:dev Jun 25, 2024
1 check passed
@louis-jan
Copy link
Contributor

Thank you for the contribution. 🚀

cahyosubroto pushed a commit that referenced this pull request Jun 26, 2024
…ess Information (#749)

Signed-off-by: l2D <20911264+l2D@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: Issues with cli on Linux and Mac
2 participants