jupyter-chat-components 0.4.1 → 0.5.0

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.
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { IComponentProps } from '../token';
3
+ export interface IErrorProps extends IComponentProps {
4
+ errorMessage: string;
5
+ title?: string;
6
+ }
7
+ export declare const ErrorMessage: React.FC<IErrorProps>;
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { errorIcon } from '../icons';
3
+ export const ErrorMessage = ({ errorMessage, title = 'Error' }) => {
4
+ return (React.createElement("div", { className: "jp-ai-error-message" },
5
+ React.createElement("div", { className: "jp-ai-error-icon" },
6
+ React.createElement(errorIcon.react, { tag: "span", width: "18px", height: "18px" })),
7
+ React.createElement("div", { className: "jp-ai-error-body" },
8
+ React.createElement("div", { className: "jp-ai-error-title" }, title),
9
+ React.createElement("div", { className: "jp-ai-error-text" }, errorMessage))));
10
+ };
@@ -1,3 +1,4 @@
1
+ export * from './error';
1
2
  export * from './inline-diff';
2
3
  export * from './message-queue';
3
4
  export * from './tool-call';
@@ -1,3 +1,4 @@
1
+ export * from './error';
1
2
  export * from './inline-diff';
2
3
  export * from './message-queue';
3
4
  export * from './tool-call';
package/lib/factory.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { nullTranslator } from '@jupyterlab/translation';
2
2
  import { ReactWidget } from '@jupyterlab/ui-components';
3
3
  import * as React from 'react';
4
- import { GroupedToolCalls, InlineDiff, MessageQueue, ToolCall } from './components';
4
+ import { GroupedToolCalls, InlineDiff, MessageQueue, ToolCall, ErrorMessage } from './components';
5
5
  import { ComponentRegistry } from './registry';
6
6
  /**
7
7
  * The default mime type for the extension.
@@ -94,5 +94,6 @@ export class RendererFactory {
94
94
  this.registry.add('grouped-tool-calls', GroupedToolCalls);
95
95
  this.registry.add('inline-diff', InlineDiff);
96
96
  this.registry.add('message-queue', MessageQueue);
97
+ this.registry.add('error', ErrorMessage);
97
98
  }
98
99
  }
package/lib/icons.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { LabIcon } from '@jupyterlab/ui-components';
2
+ export declare const errorIcon: LabIcon;
package/lib/icons.js ADDED
@@ -0,0 +1,5 @@
1
+ import { LabIcon } from '@jupyterlab/ui-components';
2
+ export const errorIcon = new LabIcon({
3
+ name: 'jupyter-chat:error',
4
+ svgstr: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-1-7v2h2v-2h-2zm0-8v6h2V7h-2z"/></svg>'
5
+ });
package/lib/index.d.ts CHANGED
@@ -8,4 +8,5 @@ export * from './token';
8
8
  export * from './factory';
9
9
  export * from './registry';
10
10
  export * from './components';
11
+ export * from './icons';
11
12
  export default factory;
package/lib/index.js CHANGED
@@ -20,4 +20,5 @@ export * from './token';
20
20
  export * from './factory';
21
21
  export * from './registry';
22
22
  export * from './components';
23
+ export * from './icons';
23
24
  export default factory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jupyter-chat-components",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Components to displayed in jupyter chat",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -61,6 +61,7 @@
61
61
  "@jupyterlab/rendermime": "^4.5.0",
62
62
  "@jupyterlab/rendermime-interfaces": "^3.8.0",
63
63
  "@jupyterlab/translation": "^4.5.0",
64
+ "@jupyterlab/ui-components": "^4.5.0",
64
65
  "@lumino/coreutils": "^2.2.2",
65
66
  "@lumino/widgets": "^2.1.0",
66
67
  "diff": "^8.0.0"
@@ -0,0 +1,26 @@
1
+ import * as React from 'react';
2
+
3
+ import { IComponentProps } from '../token';
4
+ import { errorIcon } from '../icons';
5
+
6
+ export interface IErrorProps extends IComponentProps {
7
+ errorMessage: string;
8
+ title?: string;
9
+ }
10
+
11
+ export const ErrorMessage: React.FC<IErrorProps> = ({
12
+ errorMessage,
13
+ title = 'Error'
14
+ }) => {
15
+ return (
16
+ <div className="jp-ai-error-message">
17
+ <div className="jp-ai-error-icon">
18
+ <errorIcon.react tag="span" width="18px" height="18px" />
19
+ </div>
20
+ <div className="jp-ai-error-body">
21
+ <div className="jp-ai-error-title">{title}</div>
22
+ <div className="jp-ai-error-text">{errorMessage}</div>
23
+ </div>
24
+ </div>
25
+ );
26
+ };
@@ -1,3 +1,4 @@
1
+ export * from './error';
1
2
  export * from './inline-diff';
2
3
  export * from './message-queue';
3
4
  export * from './tool-call';
package/src/factory.tsx CHANGED
@@ -12,7 +12,8 @@ import {
12
12
  GroupedToolCalls,
13
13
  InlineDiff,
14
14
  MessageQueue,
15
- ToolCall
15
+ ToolCall,
16
+ ErrorMessage
16
17
  } from './components';
17
18
 
18
19
  import { ComponentRegistry } from './registry';
@@ -162,6 +163,7 @@ export class RendererFactory implements IComponentsRendererFactory {
162
163
  this.registry.add('grouped-tool-calls', GroupedToolCalls);
163
164
  this.registry.add('inline-diff', InlineDiff);
164
165
  this.registry.add('message-queue', MessageQueue);
166
+ this.registry.add('error', ErrorMessage);
165
167
  }
166
168
 
167
169
  createRenderer = (options: IRenderMime.IRendererOptions) => {
package/src/icons.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { LabIcon } from '@jupyterlab/ui-components';
2
+
3
+ export const errorIcon = new LabIcon({
4
+ name: 'jupyter-chat:error',
5
+ svgstr:
6
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-1-7v2h2v-2h-2zm0-8v6h2V7h-2z"/></svg>'
7
+ });
package/src/index.ts CHANGED
@@ -32,5 +32,6 @@ export * from './token';
32
32
  export * from './factory';
33
33
  export * from './registry';
34
34
  export * from './components';
35
+ export * from './icons';
35
36
 
36
37
  export default factory;
package/style/base.css CHANGED
@@ -644,3 +644,44 @@ details[open].jp-ai-tool-call-item summary::after,
644
644
  .jp-chat-message-queue-bubble:hover .jp-chat-message-queue-remove {
645
645
  opacity: 1;
646
646
  }
647
+
648
+ /* Error Component Styling */
649
+ .jp-ai-error-message {
650
+ display: flex;
651
+ align-items: flex-start;
652
+ gap: 12px;
653
+ background-color: var(--jp-layout-color2);
654
+ border: 1px solid var(--jp-border-color1);
655
+ border-left: 4px solid var(--jp-error-color1);
656
+ border-radius: 6px;
657
+ padding: 12px 16px;
658
+ margin: 8px 0;
659
+ box-shadow: var(--jp-elevation-z2);
660
+ color: var(--jp-ui-font-color1);
661
+ }
662
+
663
+ .jp-ai-error-icon {
664
+ color: var(--jp-error-color1);
665
+ }
666
+
667
+ .jp-ai-error-body {
668
+ display: flex;
669
+ flex-direction: column;
670
+ gap: 4px;
671
+ }
672
+
673
+ .jp-ai-error-title {
674
+ font-family: var(--jp-ui-font-family);
675
+ font-size: var(--jp-ui-font-size1);
676
+ font-weight: 600;
677
+ color: var(--jp-error-color1);
678
+ }
679
+
680
+ .jp-ai-error-text {
681
+ font-family: var(--jp-ui-font-family);
682
+ font-size: var(--jp-ui-font-size1);
683
+ word-break: break-word;
684
+ white-space: pre-wrap;
685
+ color: var(--jp-ui-font-color2);
686
+ line-height: 1.4;
687
+ }