Akarshan 7762cea10a
feat: Distinguish and preserve embedding model sessions
This commit introduces a new field, `is_embedding`, to the `SessionInfo` structure to clearly mark sessions running dedicated embedding models.

Key changes:
- Adds `is_embedding` to the `SessionInfo` interface in `AIEngine.ts` and the Rust backend.
- Updates the `loadLlamaModel` command signatures to pass this new flag.
- Modifies the llama.cpp extension's **auto-unload logic** to explicitly **filter out** and **not unload** any currently loaded embedding models when a new text generation model is loaded. This is a critical performance fix to prevent the embedding model (e.g., used for RAG) from being repeatedly reloaded.

Also includes minor code style cleanup/reformatting in `jan-provider-web/provider.ts` for improved readability.
2025-10-08 20:03:35 +05:30
..
2025-07-02 12:28:38 +07:00
2025-07-10 21:23:04 +07:00
2024-02-15 08:38:05 +07:00
2025-07-12 20:15:45 +07:00

@janhq/core

This module includes functions for communicating with core APIs, registering app extensions, and exporting type definitions.

Usage

Import the package

// Web / extension runtime
import * as core from '@janhq/core'

Build an Extension

  1. Download an extension template, for example, https://github.com/menloresearch/extension-template.

  2. Update the source code:

    1. Open index.ts in your code editor.

    2. Rename the extension class from SampleExtension to your preferred extension name.

    3. Import modules from the core package.

      import * as core from '@janhq/core'
      
    4. In the onLoad() method, add your code:

      // Example of listening to app events and providing customized inference logic:
      import * as core from '@janhq/core'
      
      export default class MyExtension extends BaseExtension {
        // On extension load
        onLoad() {
          core.events.on(MessageEvent.OnMessageSent, (data) => MyExtension.inference(data, this))
        }
      
        // Customized inference logic
        private static inference(incomingMessage: MessageRequestData) {
          // Prepare customized message content
          const content: ThreadContent = {
            type: ContentType.Text,
            text: {
              value: "I'm Jan Assistant!",
              annotations: [],
            },
          }
      
          // Modify message and send out
          const outGoingMessage: ThreadMessage = {
            ...incomingMessage,
            content,
          }
        }
      }
      
  3. Build the extension:

    1. Navigate to the extension directory.
    2. Install dependencies.
      yarn install
      
    3. Compile the source code. The following command keeps running in the terminal and rebuilds the extension when you modify the source code.
      yarn build
      
    4. Select the generated .tgz from Jan > Settings > Extension > Manual Installation.