@difizen/libro-ai-native 0.2.41-next.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.
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/es/ai-native-code-block.d.ts +4 -0
- package/es/ai-native-code-block.d.ts.map +1 -0
- package/es/ai-native-code-block.js +176 -0
- package/es/ai-native-command-contribution.d.ts +16 -0
- package/es/ai-native-command-contribution.d.ts.map +1 -0
- package/es/ai-native-command-contribution.js +297 -0
- package/es/ai-native-command.d.ts +5 -0
- package/es/ai-native-command.d.ts.map +1 -0
- package/es/ai-native-command.js +17 -0
- package/es/ai-native-for-cell-view.d.ts +20 -0
- package/es/ai-native-for-cell-view.d.ts.map +1 -0
- package/es/ai-native-for-cell-view.js +190 -0
- package/es/ai-native-output-top.d.ts +6 -0
- package/es/ai-native-output-top.d.ts.map +1 -0
- package/es/ai-native-output-top.js +37 -0
- package/es/ai-native-service.d.ts +13 -0
- package/es/ai-native-service.d.ts.map +1 -0
- package/es/ai-native-service.js +75 -0
- package/es/ai-side-toolbar-selector.d.ts +3 -0
- package/es/ai-side-toolbar-selector.d.ts.map +1 -0
- package/es/ai-side-toolbar-selector.js +47 -0
- package/es/chat-slot-contribution.d.ts +15 -0
- package/es/chat-slot-contribution.d.ts.map +1 -0
- package/es/chat-slot-contribution.js +71 -0
- package/es/chat-view.d.ts +15 -0
- package/es/chat-view.d.ts.map +1 -0
- package/es/chat-view.js +114 -0
- package/es/error-output-model.d.ts +8 -0
- package/es/error-output-model.d.ts.map +1 -0
- package/es/error-output-model.js +140 -0
- package/es/icon.d.ts +4 -0
- package/es/icon.d.ts.map +1 -0
- package/es/icon.js +92 -0
- package/es/index.d.ts +6 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +5 -0
- package/es/index.less +297 -0
- package/es/libro-ai-msg-item-model.d.ts +18 -0
- package/es/libro-ai-msg-item-model.d.ts.map +1 -0
- package/es/libro-ai-msg-item-model.js +85 -0
- package/es/libro-ai-native-chat-service.d.ts +8 -0
- package/es/libro-ai-native-chat-service.d.ts.map +1 -0
- package/es/libro-ai-native-chat-service.js +157 -0
- package/es/libro-ai-native-chat-view.d.ts +42 -0
- package/es/libro-ai-native-chat-view.d.ts.map +1 -0
- package/es/libro-ai-native-chat-view.js +88 -0
- package/es/libro-ai-native-color-registry.d.ts +6 -0
- package/es/libro-ai-native-color-registry.d.ts.map +1 -0
- package/es/libro-ai-native-color-registry.js +46 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +28 -0
- package/es/protocol.d.ts +10 -0
- package/es/protocol.d.ts.map +1 -0
- package/es/protocol.js +1 -0
- package/es/utils.js +114 -0
- package/package.json +74 -0
- package/src/ai-native-code-block.tsx +138 -0
- package/src/ai-native-command-contribution.tsx +248 -0
- package/src/ai-native-command.ts +23 -0
- package/src/ai-native-for-cell-view.tsx +156 -0
- package/src/ai-native-output-top.tsx +43 -0
- package/src/ai-native-service.ts +39 -0
- package/src/ai-side-toolbar-selector.tsx +51 -0
- package/src/chat-slot-contribution.ts +36 -0
- package/src/chat-view.tsx +141 -0
- package/src/error-output-model.tsx +103 -0
- package/src/icon.tsx +80 -0
- package/src/index.less +330 -0
- package/src/index.spec.ts +8 -0
- package/src/index.ts +5 -0
- package/src/libro-ai-msg-item-model.ts +69 -0
- package/src/libro-ai-native-chat-service.ts +95 -0
- package/src/libro-ai-native-chat-view.tsx +54 -0
- package/src/libro-ai-native-color-registry.ts +33 -0
- package/src/module.ts +44 -0
- package/src/protocol.ts +18 -0
- package/src/utils.tsx +115 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { CloseOutlined } from '@ant-design/icons';
|
|
2
|
+
import {
|
|
3
|
+
LibroContextKey,
|
|
4
|
+
LibroSlotManager,
|
|
5
|
+
LibroSlotView,
|
|
6
|
+
} from '@difizen/libro-jupyter';
|
|
7
|
+
import type { DisplayView, LibroView } from '@difizen/libro-jupyter';
|
|
8
|
+
import type { ConfigurationService } from '@difizen/mana-app';
|
|
9
|
+
import {
|
|
10
|
+
BaseView,
|
|
11
|
+
prop,
|
|
12
|
+
transient,
|
|
13
|
+
view,
|
|
14
|
+
inject,
|
|
15
|
+
ViewManager,
|
|
16
|
+
useInject,
|
|
17
|
+
ViewInstance,
|
|
18
|
+
ViewRender,
|
|
19
|
+
} from '@difizen/mana-app';
|
|
20
|
+
import { useRef } from 'react';
|
|
21
|
+
|
|
22
|
+
import { LibroAINativeService } from './ai-native-service.js';
|
|
23
|
+
import { LibroAiNativeChatView } from './libro-ai-native-chat-view.js';
|
|
24
|
+
import type { AiNativeChatViewOption } from './protocol.js';
|
|
25
|
+
import { cancelCellAIClassname } from './utils.js';
|
|
26
|
+
|
|
27
|
+
export const ChatRender = () => {
|
|
28
|
+
const containRef = useRef<HTMLDivElement>(null);
|
|
29
|
+
const libroChatView = useInject<LibroChatView>(ViewInstance);
|
|
30
|
+
const libroSlotManager = useInject<LibroSlotManager>(LibroSlotManager);
|
|
31
|
+
const libroContextKey = useInject<LibroContextKey>(LibroContextKey);
|
|
32
|
+
const libroAINativeService = useInject<LibroAINativeService>(LibroAINativeService);
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
className="chat-container"
|
|
36
|
+
ref={containRef}
|
|
37
|
+
onFocus={() => {
|
|
38
|
+
libroContextKey.disableCommandMode();
|
|
39
|
+
}}
|
|
40
|
+
onBlur={() => {
|
|
41
|
+
libroContextKey.enableCommandMode();
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
<div className="chat-header">
|
|
45
|
+
<div className="chat-title">Libro AI</div>
|
|
46
|
+
<div className="chat-right-toolbar">
|
|
47
|
+
<div className="chat-type">
|
|
48
|
+
{libroChatView.chatView?.isCellChat ? 'Focused Cell' : 'General Chat'}
|
|
49
|
+
</div>
|
|
50
|
+
<div>
|
|
51
|
+
<CloseOutlined
|
|
52
|
+
className="chat-close-icon"
|
|
53
|
+
onClick={async () => {
|
|
54
|
+
if (libroChatView.parent) {
|
|
55
|
+
if (libroChatView.chatView?.cell) {
|
|
56
|
+
const libroAINativeForCellView =
|
|
57
|
+
await libroAINativeService.getOrCreateLibroAINativeForCellView(
|
|
58
|
+
libroChatView.chatView.cell.id,
|
|
59
|
+
libroChatView.chatView.cell,
|
|
60
|
+
);
|
|
61
|
+
if (!libroAINativeForCellView.showAI) {
|
|
62
|
+
cancelCellAIClassname(libroChatView.chatView.cell);
|
|
63
|
+
libroAINativeService.cellAIChatMap.set(
|
|
64
|
+
libroChatView.chatView.cell.id,
|
|
65
|
+
false,
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
libroAINativeService.showChatMap.set(libroChatView.parent.id, false);
|
|
71
|
+
const slotview = libroSlotManager.slotViewManager.getSlotView(
|
|
72
|
+
libroSlotManager.getSlotName(libroChatView.parent, 'right'),
|
|
73
|
+
);
|
|
74
|
+
if (slotview instanceof LibroSlotView) {
|
|
75
|
+
slotview.revertActive();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
{libroChatView.chatView && (
|
|
84
|
+
<ViewRender view={libroChatView.chatView}></ViewRender>
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
@transient()
|
|
91
|
+
@view('libro-chat-view')
|
|
92
|
+
export class LibroChatView extends BaseView implements DisplayView {
|
|
93
|
+
parent: LibroView | undefined = undefined;
|
|
94
|
+
protected configurationService: ConfigurationService;
|
|
95
|
+
@inject(ViewManager) viewManager: ViewManager;
|
|
96
|
+
@inject(LibroAINativeService) libroAINativeService: LibroAINativeService;
|
|
97
|
+
|
|
98
|
+
override view = ChatRender;
|
|
99
|
+
|
|
100
|
+
@prop()
|
|
101
|
+
chatView: LibroAiNativeChatView;
|
|
102
|
+
|
|
103
|
+
@prop()
|
|
104
|
+
isDisplay = true;
|
|
105
|
+
|
|
106
|
+
async setAINativeChatView(option: AiNativeChatViewOption) {
|
|
107
|
+
if (this.chatView?.cell) {
|
|
108
|
+
if (this.chatView?.cell.id === option.cell?.id) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const libroAINativeForCellView =
|
|
112
|
+
await this.libroAINativeService.getOrCreateLibroAINativeForCellView(
|
|
113
|
+
this.chatView.cell.id,
|
|
114
|
+
this.chatView.cell,
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
if (
|
|
118
|
+
this.libroAINativeService.cellAIChatMap.get(this.chatView.cell.id) &&
|
|
119
|
+
!libroAINativeForCellView.showAI
|
|
120
|
+
) {
|
|
121
|
+
cancelCellAIClassname(this.chatView.cell);
|
|
122
|
+
this.libroAINativeService.cellAIChatMap.set(this.chatView.cell.id, false);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
this.viewManager
|
|
127
|
+
.getOrCreateView(LibroAiNativeChatView, option)
|
|
128
|
+
.then((chatView) => {
|
|
129
|
+
chatView.libro = this.parent;
|
|
130
|
+
if (option.isCellChat && option.cell) {
|
|
131
|
+
chatView.cell = option.cell;
|
|
132
|
+
this.libroAINativeService.cellAIChatMap.set(option.cell.id, true);
|
|
133
|
+
}
|
|
134
|
+
this.chatView = chatView;
|
|
135
|
+
return;
|
|
136
|
+
})
|
|
137
|
+
.catch(() => {
|
|
138
|
+
//
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { IError, IRenderMimeRegistry } from '@difizen/libro-jupyter';
|
|
2
|
+
import { concatMultilineString } from '@difizen/libro-jupyter';
|
|
3
|
+
import {
|
|
4
|
+
ErrorOutputModel,
|
|
5
|
+
defaultSanitizer,
|
|
6
|
+
RenderMimeRegistry,
|
|
7
|
+
renderText,
|
|
8
|
+
} from '@difizen/libro-jupyter';
|
|
9
|
+
import { prop, transient } from '@difizen/mana-app';
|
|
10
|
+
import { getOrigin, useInject, view, ViewInstance } from '@difizen/mana-app';
|
|
11
|
+
import { l10n } from '@difizen/mana-l10n';
|
|
12
|
+
import { Button } from 'antd';
|
|
13
|
+
import { forwardRef, createRef, useEffect } from 'react';
|
|
14
|
+
|
|
15
|
+
import './index.less';
|
|
16
|
+
import { LibroAINativeService } from './ai-native-service.js';
|
|
17
|
+
import { AIIcon } from './icon.js';
|
|
18
|
+
import { addCellAIClassname } from './utils.js';
|
|
19
|
+
|
|
20
|
+
const AIErrorOutputModelRender = forwardRef<HTMLDivElement>(
|
|
21
|
+
function ErrorOutputModelRender(_props, ref) {
|
|
22
|
+
const output = useInject<AIErrorOutputModel>(ViewInstance);
|
|
23
|
+
const model = getOrigin(output);
|
|
24
|
+
const source = getOrigin(output).raw as IError;
|
|
25
|
+
const defaultRenderMime = useInject<IRenderMimeRegistry>(RenderMimeRegistry);
|
|
26
|
+
const traceback = source.traceback.join('\n');
|
|
27
|
+
const defaultRenderMimeType = defaultRenderMime.preferredMimeType(model);
|
|
28
|
+
const streamRef = createRef<HTMLDivElement>();
|
|
29
|
+
const libroAINativeService = useInject<LibroAINativeService>(LibroAINativeService);
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
renderText({
|
|
33
|
+
host: streamRef.current as HTMLDivElement,
|
|
34
|
+
sanitizer: defaultSanitizer,
|
|
35
|
+
source: traceback,
|
|
36
|
+
mimeType: defaultRenderMimeType || '',
|
|
37
|
+
});
|
|
38
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
39
|
+
}, []);
|
|
40
|
+
const handleShowErrorDetail = () => {
|
|
41
|
+
output.showErrorDetail = !output.showErrorDetail;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const handleFixWithAI = async () => {
|
|
45
|
+
const libroAINativeForCellView =
|
|
46
|
+
await libroAINativeService.getOrCreateLibroAINativeForCellView(
|
|
47
|
+
output.cell.id,
|
|
48
|
+
getOrigin(output.cell),
|
|
49
|
+
);
|
|
50
|
+
addCellAIClassname(output.cell);
|
|
51
|
+
libroAINativeForCellView.showAI = true;
|
|
52
|
+
|
|
53
|
+
libroAINativeForCellView.chatStream({
|
|
54
|
+
chat_key: 'LLM:debug',
|
|
55
|
+
content: `代码为:\n${output.cell.model.value}\n报错为:\n${concatMultilineString(source.traceback)}`,
|
|
56
|
+
language: l10n.getLang(),
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div ref={ref} className="libro-error-container">
|
|
62
|
+
<div className="libro-text-render-container">
|
|
63
|
+
<div className="libro-error-label libro-text-render">
|
|
64
|
+
<pre>
|
|
65
|
+
<span className="ansi-red-fg">{source.ename}</span>
|
|
66
|
+
{': ' + source.evalue}
|
|
67
|
+
</pre>
|
|
68
|
+
<div className="libro-error-output-btn-container">
|
|
69
|
+
<Button
|
|
70
|
+
className="libro-ai-native-fix-button"
|
|
71
|
+
icon={<AIIcon />}
|
|
72
|
+
onClick={handleFixWithAI}
|
|
73
|
+
>
|
|
74
|
+
Fix with AI
|
|
75
|
+
</Button>
|
|
76
|
+
<Button
|
|
77
|
+
className="libro-show-error-detail-button"
|
|
78
|
+
danger
|
|
79
|
+
onClick={handleShowErrorDetail}
|
|
80
|
+
>
|
|
81
|
+
{output.showErrorDetail ? 'Hide' : 'Show'} error details
|
|
82
|
+
</Button>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
<div className="libro-text-render-container">
|
|
87
|
+
<div
|
|
88
|
+
className="libro-text-render"
|
|
89
|
+
ref={streamRef}
|
|
90
|
+
style={{ display: `${output.showErrorDetail ? 'block' : 'none'} ` }}
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
},
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
@transient()
|
|
99
|
+
@view('libro-error-output-model')
|
|
100
|
+
export class AIErrorOutputModel extends ErrorOutputModel {
|
|
101
|
+
override view = AIErrorOutputModelRender;
|
|
102
|
+
@prop() showChat = false;
|
|
103
|
+
}
|
package/src/icon.tsx
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export const AIIcon: React.FC = () => (
|
|
2
|
+
<svg
|
|
3
|
+
width="16px"
|
|
4
|
+
height="16px"
|
|
5
|
+
viewBox="0 0 16 16"
|
|
6
|
+
version="1.1"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
9
|
+
className="libro-ai-icon"
|
|
10
|
+
>
|
|
11
|
+
<g
|
|
12
|
+
id="libro-copilot-1"
|
|
13
|
+
stroke="none"
|
|
14
|
+
strokeWidth="1"
|
|
15
|
+
fill="none"
|
|
16
|
+
fillRule="evenodd"
|
|
17
|
+
>
|
|
18
|
+
<g id="libro-copilot-2" transform="translate(-1347.000000, -186.000000)">
|
|
19
|
+
<g id="libro-copilot-3" transform="translate(1339.000000, 144.000000)">
|
|
20
|
+
<g id="libro-copilot-4" transform="translate(8.000000, 42.000000)">
|
|
21
|
+
<rect id="libro-copilot-5" x="0" y="0" width="16" height="16" />
|
|
22
|
+
<g
|
|
23
|
+
id="libro-copilot-6"
|
|
24
|
+
transform="translate(0.300772, 0.470588)"
|
|
25
|
+
fill="#BB50E1"
|
|
26
|
+
className="libro-ai-inner-icon"
|
|
27
|
+
>
|
|
28
|
+
<path
|
|
29
|
+
d="M4.6251825,4.23305674 C5.89323061,5.80889295 7.29789772,6.58398704 8.83918382,6.55833903 C10.3804699,6.53269102 11.9554683,5.70801334 13.5641789,4.08430598 C11.9274189,5.7798156 11.0970322,7.34910485 11.0730185,8.79217375 C11.0490049,10.2352426 11.8298081,11.6456189 13.4154281,13.0233024 C11.8157864,11.6647772 10.2918193,10.9975649 8.84352682,11.0216655 C7.39523433,11.045766 5.93953597,11.7625619 4.47643174,13.1720531 C5.87320041,11.7759156 6.58428719,10.3145081 6.60969211,8.78783075 C6.63509702,7.26115339 5.97359381,5.74289539 4.6251825,4.23305674 Z"
|
|
30
|
+
id="libro-copilot-5"
|
|
31
|
+
transform="translate(9.020305, 8.628180) rotate(45.000000) translate(-9.020305, -8.628180) "
|
|
32
|
+
/>
|
|
33
|
+
<path
|
|
34
|
+
d="M6.17780613,0.532367865 C6.5102071,0.945451143 6.8784208,1.14863115 7.28244726,1.14190788 C7.68647371,1.13518462 8.09933736,0.919006974 8.5210382,0.493374948 C8.09198462,0.937828925 7.87431041,1.34919601 7.86801558,1.72747621 C7.86172075,2.1057564 8.06639732,2.47546667 8.48204528,2.83660701 C8.06272172,2.48048877 7.6632352,2.30558846 7.28358571,2.31190607 C6.90393623,2.31822369 6.52234539,2.50612164 6.13881322,2.87559993 C6.50495646,2.50962212 6.69135785,2.12653473 6.69801739,1.72633775 C6.70467693,1.32614077 6.53127318,0.928150813 6.17780613,0.532367865 Z"
|
|
35
|
+
id="libro-copilot-8"
|
|
36
|
+
transform="translate(7.329926, 1.684487) rotate(45.000000) translate(-7.329926, -1.684487) "
|
|
37
|
+
/>
|
|
38
|
+
<path
|
|
39
|
+
d="M1.02530107,2.42653997 C1.6654807,3.22210777 2.37463303,3.61341741 3.15275805,3.6004689 C3.93088308,3.58752039 4.72602788,3.17117825 5.53819246,2.3514425 C4.71186704,3.20742794 4.29264265,3.99969048 4.28051927,4.72823011 C4.26839589,5.45676975 4.6625878,6.16880434 5.46309499,6.86433388 C4.65550888,6.17847653 3.88612743,5.84163148 3.15495064,5.85379875 C2.42377385,5.86596601 1.68885817,6.22784354 0.950203604,6.93943135 C1.65536837,6.2345852 2.01436364,5.49678726 2.02718942,4.72603753 C2.0400152,3.9552878 1.70605242,3.18878861 1.02530107,2.42653997 Z"
|
|
40
|
+
id="libro-copilot-9"
|
|
41
|
+
transform="translate(3.244198, 4.645437) rotate(45.000000) translate(-3.244198, -4.645437) "
|
|
42
|
+
/>
|
|
43
|
+
</g>
|
|
44
|
+
</g>
|
|
45
|
+
</g>
|
|
46
|
+
</g>
|
|
47
|
+
</g>
|
|
48
|
+
</svg>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export const AILoadding: React.FC = () => {
|
|
52
|
+
return (
|
|
53
|
+
<svg
|
|
54
|
+
width="14px"
|
|
55
|
+
height="14px"
|
|
56
|
+
viewBox="0 0 14 14"
|
|
57
|
+
version="1.1"
|
|
58
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
59
|
+
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
60
|
+
className="libro-lab-loadding"
|
|
61
|
+
>
|
|
62
|
+
<g id="整体框架部分" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
63
|
+
<g
|
|
64
|
+
id="1.1容器加载中-关闭提示"
|
|
65
|
+
transform="translate(-1362.000000, -879.000000)"
|
|
66
|
+
fill="#bd74e8"
|
|
67
|
+
>
|
|
68
|
+
<g id="编组-20" transform="translate(0.000000, 872.000000)">
|
|
69
|
+
<g id="编组-3" transform="translate(1302.000000, 5.000000)">
|
|
70
|
+
<path
|
|
71
|
+
d="M67,2 C70.8659932,2 74,5.13400675 74,9 C74,12.6840981 71.1539658,15.7034692 67.5405741,15.9794369 C67.4622857,15.9934347 67.3819096,16 67.3,16 C66.4715729,16 65.8,15.3284271 65.8,14.5 C65.8,13.6715729 66.4715729,13 67.3,13 L67.301026,12.9888432 C69.3695589,12.8349382 71,11.1078741 71,9 C71,6.790861 69.209139,5 67,5 C64.8578046,5 63.1089211,6.68396847 63.0048953,8.80035966 L63,9 C63,9.82842712 62.3284271,10.5 61.5,10.5 C60.6715729,10.5 60,9.82842712 60,9 C60,5.13400675 63.1340068,2 67,2 Z"
|
|
72
|
+
id="形状结合"
|
|
73
|
+
></path>
|
|
74
|
+
</g>
|
|
75
|
+
</g>
|
|
76
|
+
</g>
|
|
77
|
+
</g>
|
|
78
|
+
</svg>
|
|
79
|
+
);
|
|
80
|
+
};
|
package/src/index.less
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
@ant-prefix: ant;
|
|
2
|
+
|
|
3
|
+
.libro-error-output-btn-container {
|
|
4
|
+
display: flex;
|
|
5
|
+
|
|
6
|
+
.libro-ai-native-fix-button {
|
|
7
|
+
height: 24px;
|
|
8
|
+
width: 118px;
|
|
9
|
+
margin-top: 16px;
|
|
10
|
+
margin-right: 16px;
|
|
11
|
+
padding: unset;
|
|
12
|
+
background: var(--mana-color-bg-container);
|
|
13
|
+
border-color: var(--mana-libro-ai-native-color);
|
|
14
|
+
|
|
15
|
+
span {
|
|
16
|
+
display: flex;
|
|
17
|
+
font-family: ArialMT;
|
|
18
|
+
font-size: 12px;
|
|
19
|
+
color: var(--mana-libro-ai-native-color);
|
|
20
|
+
line-height: 22px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&:hover {
|
|
24
|
+
color: var(--mana-libro-ai-native-color) !important;
|
|
25
|
+
border-color: var(--mana-libro-ai-native-color) !important;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.libro-cell-right-toolbar {
|
|
31
|
+
.libro-ai-icon {
|
|
32
|
+
g {
|
|
33
|
+
fill: none !important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.libro-ai-inner-icon {
|
|
37
|
+
fill: var(--mana-libro-ai-native-color) !important;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.libro-side-toolbar-ai-select-menu {
|
|
43
|
+
.@{ant-prefix}-popover-content {
|
|
44
|
+
width: 120px;
|
|
45
|
+
height: 72px;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.libro-ai-native-cell-chat-icon {
|
|
50
|
+
svg {
|
|
51
|
+
color: var(--mana-libro-ai-native-color);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.libro-view-content-right {
|
|
56
|
+
.libro-slot-container {
|
|
57
|
+
height: 100%;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.chat-header {
|
|
62
|
+
padding: 8px 16px;
|
|
63
|
+
height: 40px;
|
|
64
|
+
display: flex;
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
|
|
67
|
+
.chat-title {
|
|
68
|
+
font-size: 16px;
|
|
69
|
+
font-weight: 600;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.chat-container {
|
|
74
|
+
border: 1px solid var(--mana-libro-ai-native-color);
|
|
75
|
+
box-shadow: var(--mana-libro-ai-native-box-shadow) 0 0 0 2px;
|
|
76
|
+
border-radius: 6px;
|
|
77
|
+
margin: 16px 0;
|
|
78
|
+
height: calc(100% - 32px);
|
|
79
|
+
width: 460px;
|
|
80
|
+
|
|
81
|
+
.chat {
|
|
82
|
+
height: calc(100% - 40px);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.chat-type {
|
|
87
|
+
margin-right: 6px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.chat-close-icon {
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.chat-input-upload {
|
|
95
|
+
display: none;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.chat-input-iconBottom {
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.chat-input-searchInput:focus-within {
|
|
104
|
+
border-color: var(--mana-libro-ai-native-color);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.chat-input-sendButton {
|
|
108
|
+
margin: unset;
|
|
109
|
+
background-color: var(--mana-libro-ai-native-color);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.chat-right-toolbar {
|
|
113
|
+
display: flex;
|
|
114
|
+
color: var(--mana-libro-tip-font-color);
|
|
115
|
+
|
|
116
|
+
.@{ant-prefix}-switch.@{ant-prefix}-switch-checked {
|
|
117
|
+
background: var(--mana-libro-ai-native-color);
|
|
118
|
+
|
|
119
|
+
&:hover {
|
|
120
|
+
background: var(--mana-libro-ai-native-color);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.libro-dnd-cell:has(.ai-cell-focus) {
|
|
126
|
+
&.active {
|
|
127
|
+
border: 1px solid var(--mana-libro-ai-native-color);
|
|
128
|
+
box-shadow: var(--mana-libro-ai-native-box-shadow) 0 0 0 2px;
|
|
129
|
+
|
|
130
|
+
.libro-cell-input-collapser,
|
|
131
|
+
.libro-cell-output-collapser,
|
|
132
|
+
.libro-cell-collapser {
|
|
133
|
+
background: var(--mana-libro-ai-native-color);
|
|
134
|
+
opacity: 1;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&.error {
|
|
138
|
+
border: 1px solid var(--mana-libro-ai-native-color);
|
|
139
|
+
box-shadow: var(--mana-libro-ai-native-box-shadow) 0 0 0 2px;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&.error {
|
|
144
|
+
border: 1px solid var(--mana-libro-ai-native-color);
|
|
145
|
+
box-shadow: var(--mana-libro-ai-native-box-shadow) 0 0 0 2px;
|
|
146
|
+
|
|
147
|
+
.libro-cell-input-collapser,
|
|
148
|
+
.libro-cell-output-collapser,
|
|
149
|
+
.libro-cell-collapser {
|
|
150
|
+
background: var(--mana-libro-ai-native-color);
|
|
151
|
+
opacity: 1;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&.active.command-mode {
|
|
156
|
+
border: 1px solid var(--mana-libro-ai-native-color);
|
|
157
|
+
box-shadow: unset;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.libro-ai-native-debug-code-btn-container {
|
|
162
|
+
margin-top: 12px;
|
|
163
|
+
|
|
164
|
+
.@{ant-prefix}-btn-variant-outlined {
|
|
165
|
+
height: 24px;
|
|
166
|
+
margin-right: 6px;
|
|
167
|
+
font-size: 13px;
|
|
168
|
+
border-color: var(--mana-libro-ai-native-color);
|
|
169
|
+
color: var(--mana-libro-ai-native-color);
|
|
170
|
+
&.@{ant-prefix}-btn-color-primary {
|
|
171
|
+
box-shadow: unset;
|
|
172
|
+
|
|
173
|
+
&:hover {
|
|
174
|
+
border-color: var(--mana-libro-ai-native-color) !important;
|
|
175
|
+
color: var(--mana-libro-ai-native-color) !important;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.libro-ai-native-for-cell-cancel-btn {
|
|
182
|
+
width: 78px;
|
|
183
|
+
|
|
184
|
+
&.@{ant-prefix}-btn-variant-outlined {
|
|
185
|
+
border-color: var(--mana-libro-ai-native-color);
|
|
186
|
+
color: var(--mana-libro-ai-native-color);
|
|
187
|
+
|
|
188
|
+
&:hover {
|
|
189
|
+
border-color: var(--mana-libro-ai-native-color) !important;
|
|
190
|
+
color: var(--mana-libro-ai-native-color) !important;
|
|
191
|
+
|
|
192
|
+
&.error {
|
|
193
|
+
border-color: var(--mana-libro-error-color) !important;
|
|
194
|
+
color: var(--mana-libro-error-color) !important;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&.error {
|
|
199
|
+
border-color: var(--mana-libro-error-color);
|
|
200
|
+
color: var(--mana-libro-error-color);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.libro-ai-native-output-top {
|
|
206
|
+
padding: 0 24px;
|
|
207
|
+
|
|
208
|
+
.chat-msg-md-message {
|
|
209
|
+
color: var(--mana-libro-llm-response-output-text-color);
|
|
210
|
+
width: calc(100% - 78px);
|
|
211
|
+
margin-right: 12px;
|
|
212
|
+
|
|
213
|
+
code {
|
|
214
|
+
font-size: 13px;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.chat-msg-md-code-pre {
|
|
220
|
+
:global {
|
|
221
|
+
.md-code-pre {
|
|
222
|
+
margin: 0 !important;
|
|
223
|
+
padding: 1.5em !important;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.chat-msg-md-code-wrap {
|
|
229
|
+
border-radius: 4px;
|
|
230
|
+
position: relative;
|
|
231
|
+
margin: 12px 0;
|
|
232
|
+
|
|
233
|
+
pre {
|
|
234
|
+
overflow-x: auto;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.chat-msg-md-code-lang {
|
|
239
|
+
position: absolute;
|
|
240
|
+
top: 9px;
|
|
241
|
+
right: 28px;
|
|
242
|
+
color: var(--mana-libro-llm-response-output-text-color);
|
|
243
|
+
opacity: 0.8;
|
|
244
|
+
font-size: 13px;
|
|
245
|
+
line-height: 16px;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.chat-msg-md-code-copy {
|
|
249
|
+
font-size: 13px;
|
|
250
|
+
cursor: pointer;
|
|
251
|
+
position: absolute;
|
|
252
|
+
top: 9px;
|
|
253
|
+
right: 4px;
|
|
254
|
+
color: var(--mana-libro-llm-response-output-text-color);
|
|
255
|
+
opacity: 0.8;
|
|
256
|
+
|
|
257
|
+
&:hover {
|
|
258
|
+
opacity: 1;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.chat-msg-md-code-code {
|
|
263
|
+
display: inline;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.libro-ai-native-for-cell-container {
|
|
267
|
+
display: flex;
|
|
268
|
+
padding-top: 18px;
|
|
269
|
+
justify-content: space-between;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.libro-llm-syntax-highlighter {
|
|
273
|
+
code {
|
|
274
|
+
background-color: unset;
|
|
275
|
+
padding: unset;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
padding: 12px;
|
|
279
|
+
background-color: var(--mana-libro-input-background) !important;
|
|
280
|
+
color: var(--mana-libro-llm-response-output-text-color);
|
|
281
|
+
font-family:
|
|
282
|
+
system-ui,
|
|
283
|
+
-apple-system,
|
|
284
|
+
blinkmacsystemfont,
|
|
285
|
+
'Segoe UI',
|
|
286
|
+
helvetica,
|
|
287
|
+
arial,
|
|
288
|
+
sans-serif,
|
|
289
|
+
'Apple Color Emoji',
|
|
290
|
+
'Segoe UI Emoji',
|
|
291
|
+
'Segoe UI Symbol';
|
|
292
|
+
font-size: 13px;
|
|
293
|
+
|
|
294
|
+
.token.comment {
|
|
295
|
+
color: var(--mana-libro-editor-comment-color);
|
|
296
|
+
font-style: italic;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.token.string {
|
|
300
|
+
color: var(--mana-libro-editor-string-color) !important;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.token.keyword {
|
|
304
|
+
color: var(--mana-libro-editor-keyword-color);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.token.function {
|
|
308
|
+
color: var(--mana-libro-editor-def-color);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.token.number {
|
|
312
|
+
color: var(--mana-libro-editor-number-color);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.token.operator {
|
|
316
|
+
color: var(--mana-libro-editor-operator-color);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.token.class-name {
|
|
320
|
+
color: var(--mana-libro-editor-class-color);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.token.constant {
|
|
324
|
+
color: var(--mana-libro-editor-class-color);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.libro-ai-native-for-cell-error {
|
|
329
|
+
color: var(--mana-libro-error-color);
|
|
330
|
+
}
|