@jupyter-ai/persona-manager 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,6 +22,11 @@ To create and register a custom AI persona:
22
22
  ```python
23
23
  from jupyter_ai_persona_manager import BasePersona, PersonaDefaults
24
24
  from jupyterlab_chat.models import Message
25
+ import os
26
+
27
+ # Path to avatar file in your package
28
+ AVATAR_PATH = os.path.join(os.path.dirname(__file__), "assets", "avatar.svg")
29
+
25
30
 
26
31
  class MyCustomPersona(BasePersona):
27
32
  @property
@@ -29,7 +34,7 @@ class MyCustomPersona(BasePersona):
29
34
  return PersonaDefaults(
30
35
  name="MyPersona",
31
36
  description="A helpful custom assistant",
32
- avatar_path="/api/ai/static/custom-avatar.svg",
37
+ avatar_path=AVATAR_PATH, # Absolute path to avatar file
33
38
  system_prompt="You are a helpful assistant specialized in...",
34
39
  )
35
40
 
@@ -39,6 +44,8 @@ class MyCustomPersona(BasePersona):
39
44
  self.send_message(response)
40
45
  ```
41
46
 
47
+ **Avatar Path**: The `avatar_path` should be an absolute path to an image file (SVG, PNG, or JPG) within your package. The avatar will be automatically served at `/api/ai/avatars/{filename}`. If multiple personas use the same filename, the first one found will be served.
48
+
42
49
  ### 2. Register via Entry Points
43
50
 
44
51
  Add to your package's `pyproject.toml`:
@@ -85,6 +92,11 @@ For development and local customization, personas can be loaded from the `.jupyt
85
92
  ```python
86
93
  from jupyter_ai_persona_manager import BasePersona, PersonaDefaults
87
94
  from jupyterlab_chat.models import Message
95
+ import os
96
+
97
+ # Path to avatar file (in same directory as persona file)
98
+ AVATAR_PATH = os.path.join(os.path.dirname(__file__), "avatar.svg")
99
+
88
100
 
89
101
  class MyLocalPersona(BasePersona):
90
102
  @property
@@ -92,7 +104,7 @@ class MyLocalPersona(BasePersona):
92
104
  return PersonaDefaults(
93
105
  name="Local Dev Assistant",
94
106
  description="A persona for local development",
95
- avatar_path="/api/ai/static/jupyternaut.svg",
107
+ avatar_path=AVATAR_PATH,
96
108
  system_prompt="You help with local development tasks.",
97
109
  )
98
110
 
@@ -100,6 +112,8 @@ class MyLocalPersona(BasePersona):
100
112
  self.send_message(f"Local persona received: {message.body}")
101
113
  ```
102
114
 
115
+ **Note**: Place your avatar file (e.g., `avatar.svg`) in the same directory as your persona file.
116
+
103
117
  ### Refreshing Personas
104
118
 
105
119
  Use the `/refresh-personas` slash command in any chat to reload personas without restarting JupyterLab:
package/lib/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import { requestAPI } from './handler';
2
1
  /**
3
2
  * Initialization data for the @jupyter-ai/persona-manager extension.
4
3
  */
@@ -8,13 +7,6 @@ const plugin = {
8
7
  autoStart: true,
9
8
  activate: (app) => {
10
9
  console.log('JupyterLab extension @jupyter-ai/persona-manager is activated!');
11
- requestAPI('health')
12
- .then(data => {
13
- console.log(data);
14
- })
15
- .catch(reason => {
16
- console.error(`The jupyter_ai_persona_manager server extension appears to be missing.\n${reason}`);
17
- });
18
10
  }
19
11
  };
20
12
  export default plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter-ai/persona-manager",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "The core manager & registry for AI personas in Jupyter AI",
5
5
  "keywords": [
6
6
  "jupyter",
package/src/index.ts CHANGED
@@ -3,8 +3,6 @@ import {
3
3
  JupyterFrontEndPlugin
4
4
  } from '@jupyterlab/application';
5
5
 
6
- import { requestAPI } from './handler';
7
-
8
6
  /**
9
7
  * Initialization data for the @jupyter-ai/persona-manager extension.
10
8
  */
@@ -16,16 +14,6 @@ const plugin: JupyterFrontEndPlugin<void> = {
16
14
  console.log(
17
15
  'JupyterLab extension @jupyter-ai/persona-manager is activated!'
18
16
  );
19
-
20
- requestAPI<any>('health')
21
- .then(data => {
22
- console.log(data);
23
- })
24
- .catch(reason => {
25
- console.error(
26
- `The jupyter_ai_persona_manager server extension appears to be missing.\n${reason}`
27
- );
28
- });
29
17
  }
30
18
  };
31
19