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

fix: #3515 - The default assistant instructions are ignored #3721

Merged
merged 2 commits into from
Sep 24, 2024

Conversation

louis-jan
Copy link
Contributor

Describe Your Changes

Fixed the issue #3515

Default instructions are no longer read from the configuration file when launching a new thread on linux.
I tried to remove the ~/jan file, remove my .AppImage file and install it from deb source (with today latest version) then fill again the "instructions" field in ~/jan/assistant/jan/assistant.json . Nothing work. I have to copy / paste my instructions from one thread to another instead of just spawning a new thread and go with my "all purpose for my needs" dev instructions.

Fixes Issues

Changes made

New Tests in useCreateNewThread.test.ts

  1. Creating a New Thread:

    • Test Case: it('should create a new thread')
    • Description: This test mocks the dependencies and verifies that the requestCreateNewThread function properly sets up and saves a new thread. Expectations include checking that specific atoms were set and that the extensionManager.get method was called.
  2. Creating a New Thread with Instructions:

    • Test Case: it('should create a new thread with instructions')
    • Description: This test mocks the dependencies and adds an instruction to the new assistant. The test expects the new assistant to have the correct instruction and that the necessary atoms were set.
  3. Creating a New Thread with Previous Instructions:

    • Test Case: it('should create a new thread with previous instructions')
    • Description: Similar to the previous test, this test uses previous instructions from another assistant. The test ensures that the correct instructions are copied and the atoms were set.
  4. Creating an Empty Thread (With Warning Toast):

    • Test Case: it('should show a warning toast if trying to create an empty thread')
    • Description: This test simulates a situation where creating a thread is not possible due to missing required data. The expectation is that a warning toast is shown.
  5. Updating Thread Metadata:

    • Test Case: it('should update thread metadata')
    • Description: This test mocks the dependencies and checks if the metadata of an existing thread can be updated successfully.

Code Change

  1. Modification in useCreateNewThread.ts:
    • The variable instructions is now initialized with assistant.instructions instead of undefined.
    • Before:
      let instructions: string | undefined = undefined
    • After:
      let instructions: string | undefined = assistant.instructions

This change reflects the behavior where the instructions of the assistant are directly used if they are available.

@github-actions github-actions bot added the type: bug Something isn't working label Sep 23, 2024
Copy link
Contributor

Barecheck - Code coverage report

Total: 62.56%

Your code coverage diff: 0.54% ▴

Uncovered files and lines
FileLines
web/hooks/useCreateNewThread.ts42, 44, 49-50, 53-54

@louis-jan louis-jan merged commit 36c1306 into dev Sep 24, 2024
9 checks passed
@louis-jan louis-jan deleted the fix/3515-default-instruction-does-not-work branch September 24, 2024 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: Default instruction from ~/jan/assistants/jan/assistant.json no longer work on linux
2 participants