@genexus/genexus-ide-ui 1.0.49 → 1.0.50
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/dist/cjs/code-render-9b3efb53.js +50 -0
- package/dist/cjs/code-render-9b3efb53.js.map +1 -0
- package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
- package/dist/cjs/gx-ide-chat-container.cjs.entry.js +11 -2
- package/dist/cjs/gx-ide-chat-container.cjs.entry.js.map +1 -1
- package/dist/cjs/gx-ide-sc-chat-container.cjs.entry.js +7 -44
- package/dist/cjs/gx-ide-sc-chat-container.cjs.entry.js.map +1 -1
- package/dist/cjs/index.cjs.js +9 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/_helpers/chat-container/chat-container.js +27 -3
- package/dist/collection/components/_helpers/chat-container/chat-container.js.map +1 -1
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/showcase/chat-container/chat.showcase.js +6 -3
- package/dist/collection/showcase/chat-container/chat.showcase.js.map +1 -1
- package/dist/components/MERCURY_ASSETS.js +0 -4
- package/dist/components/MERCURY_ASSETS.js.map +1 -1
- package/dist/components/ai-message.js +2 -1
- package/dist/components/ai-message.js.map +1 -1
- package/dist/components/assets-manager.js +5 -0
- package/dist/components/assets-manager.js.map +1 -0
- package/dist/components/chat-container.js +14 -3
- package/dist/components/chat-container.js.map +1 -1
- package/dist/components/code-render.js +47 -0
- package/dist/components/code-render.js.map +1 -0
- package/dist/components/entity-selector.js +2 -1
- package/dist/components/entity-selector.js.map +1 -1
- package/dist/components/gx-ide-create-kb-from-server.js +2 -1
- package/dist/components/gx-ide-create-kb-from-server.js.map +1 -1
- package/dist/components/gx-ide-current-user-info.js +2 -1
- package/dist/components/gx-ide-current-user-info.js.map +1 -1
- package/dist/components/gx-ide-dashboard-home.js +2 -1
- package/dist/components/gx-ide-dashboard-home.js.map +1 -1
- package/dist/components/gx-ide-data-selector.js +2 -1
- package/dist/components/gx-ide-data-selector.js.map +1 -1
- package/dist/components/gx-ide-data-type-selector.js +2 -1
- package/dist/components/gx-ide-data-type-selector.js.map +1 -1
- package/dist/components/gx-ide-design-import.js +2 -1
- package/dist/components/gx-ide-design-import.js.map +1 -1
- package/dist/components/gx-ide-kb-manager-export.js +2 -1
- package/dist/components/gx-ide-kb-manager-export.js.map +1 -1
- package/dist/components/gx-ide-kb-manager-import.js +2 -1
- package/dist/components/gx-ide-kb-manager-import.js.map +1 -1
- package/dist/components/gx-ide-manage-module-references-v2.js +2 -1
- package/dist/components/gx-ide-manage-module-references-v2.js.map +1 -1
- package/dist/components/gx-ide-manage-module-references.js +2 -1
- package/dist/components/gx-ide-manage-module-references.js.map +1 -1
- package/dist/components/gx-ide-new-kb.js +2 -1
- package/dist/components/gx-ide-new-kb.js.map +1 -1
- package/dist/components/gx-ide-object-selector.js +2 -1
- package/dist/components/gx-ide-object-selector.js.map +1 -1
- package/dist/components/gx-ide-sc-chat-container.js +8 -46
- package/dist/components/gx-ide-sc-chat-container.js.map +1 -1
- package/dist/components/gx-ide-share-kb.js +2 -1
- package/dist/components/gx-ide-share-kb.js.map +1 -1
- package/dist/components/gx-ide-start-page.js +2 -1
- package/dist/components/gx-ide-start-page.js.map +1 -1
- package/dist/components/gx-ide-welcome-page.js +2 -1
- package/dist/components/gx-ide-welcome-page.js.map +1 -1
- package/dist/components/gx-ide-ww-attributes.js +2 -1
- package/dist/components/gx-ide-ww-attributes.js.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/esm/code-render-79798e42.js +47 -0
- package/dist/esm/code-render-79798e42.js.map +1 -0
- package/dist/esm/genexus-ide-ui.js +1 -1
- package/dist/esm/gx-ide-chat-container.entry.js +11 -2
- package/dist/esm/gx-ide-chat-container.entry.js.map +1 -1
- package/dist/esm/gx-ide-sc-chat-container.entry.js +8 -45
- package/dist/esm/gx-ide-sc-chat-container.entry.js.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js.map +1 -1
- package/dist/genexus-ide-ui/index.esm.js +6 -0
- package/dist/genexus-ide-ui/index.esm.js.map +1 -1
- package/dist/genexus-ide-ui/{p-72867329.entry.js → p-8558e873.entry.js} +43 -99
- package/dist/genexus-ide-ui/p-8558e873.entry.js.map +1 -0
- package/dist/genexus-ide-ui/{p-5afe1477.entry.js → p-c1791757.entry.js} +27 -12
- package/dist/genexus-ide-ui/{p-5afe1477.entry.js.map → p-c1791757.entry.js.map} +1 -1
- package/dist/genexus-ide-ui/p-f3f1e1f6.js +68 -0
- package/dist/genexus-ide-ui/p-f3f1e1f6.js.map +1 -0
- package/dist/types/components/_helpers/chat-container/chat-container.d.ts +5 -1
- package/dist/types/components.d.ts +10 -2
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/genexus-ide-ui/p-72867329.entry.js.map +0 -1
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export { m as mercuryChatMessageRender, a as mercuryCodeRender } from "./p-f3f1e1f6.js";
|
|
2
|
+
|
|
3
|
+
import "./p-49712340.js";
|
|
4
|
+
|
|
5
|
+
import "./p-ad5caf61.js";
|
|
6
|
+
|
|
1
7
|
// Add types from Chameleon, without importing any JS in the final bundle.
|
|
2
8
|
// Don't use 'import "@genexus/chameleon-controls-library"'
|
|
3
9
|
typeof import("./p-df182fc1.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["import"],"sources":["src/index.ts"],"sourcesContent":["export * from \"./components\";\n\n// Add types from Chameleon, without importing any JS in the final bundle.\n// Don't use 'import \"@genexus/chameleon-controls-library\"'\ntypeof import(\"@genexus/chameleon-controls-library/dist/types/index\");\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["import"],"sources":["src/index.ts"],"sourcesContent":["export * from \"./components\";\n\n// Add types from Chameleon, without importing any JS in the final bundle.\n// Don't use 'import \"@genexus/chameleon-controls-library\"'\ntypeof import(\"@genexus/chameleon-controls-library/dist/types/index\");\nexport {\n mercuryChatMessageRender,\n mercuryCodeRender\n} from \"./components/_helpers/chat-container/code-render\"; // for ch-chat\n"],"mappings":";;;;;;;;OAIOA,OAAO"}
|
|
@@ -1,76 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as e, h as t, H as n } from "./p-49712340.js";
|
|
2
2
|
|
|
3
|
-
import "./p-
|
|
4
|
-
|
|
5
|
-
const a = "message__copied-feedback";
|
|
6
|
-
|
|
7
|
-
const o = "message__copied-feedback-visible";
|
|
8
|
-
|
|
9
|
-
const copy = e => t => {
|
|
10
|
-
t.stopPropagation();
|
|
11
|
-
// 1. Copy message
|
|
12
|
-
navigator.clipboard.writeText(e);
|
|
13
|
-
// 2. Display "copied" message (expects to be the next sibling!)
|
|
14
|
-
const n = t.target.nextSibling;
|
|
15
|
-
const s = n.getAttribute("part");
|
|
16
|
-
if (s === a) {
|
|
17
|
-
n.setAttribute("part", `${a} ${o}`);
|
|
18
|
-
setTimeout((() => {
|
|
19
|
-
n.setAttribute("part", `${a}`);
|
|
20
|
-
}), 1e3);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const copyButton = (t, n, a) => e("button", {
|
|
25
|
-
"aria-label": n,
|
|
26
|
-
title: n,
|
|
27
|
-
class: "button-copy-code",
|
|
28
|
-
type: "button",
|
|
29
|
-
onClick: copy(t),
|
|
30
|
-
part: `message__copy-button ${a}`
|
|
31
|
-
});
|
|
3
|
+
import { m as a } from "./p-f3f1e1f6.js";
|
|
32
4
|
|
|
33
|
-
|
|
34
|
-
class: "code-block-container"
|
|
35
|
-
}, e("div", {
|
|
36
|
-
class: "code-block-header"
|
|
37
|
-
}, copyButton(n.plainText, t, "code-render")), e("ch-code", {
|
|
38
|
-
language: n.language,
|
|
39
|
-
lastNestedChildClass: n.lastNestedChildClass,
|
|
40
|
-
value: n.plainText
|
|
41
|
-
}));
|
|
42
|
-
|
|
43
|
-
const mercuryChatMessageRender = t => n => n.role === "assistant" && n.status === "waiting" ? [ e("span", {
|
|
44
|
-
part: "message__processing"
|
|
45
|
-
}, "Processing request"), e("div", {
|
|
46
|
-
class: "processing-animation",
|
|
47
|
-
part: "processing-animation"
|
|
48
|
-
}) ] : [
|
|
49
|
-
// "copy button" before "role" and "time" to hide both on button:focus
|
|
50
|
-
copyButton(n.content, "Copy code", "common-message"), e("p", {
|
|
51
|
-
part: a
|
|
52
|
-
}, "message copied to clipboard"), e("span", {
|
|
53
|
-
part: `message__role ${n.role}`
|
|
54
|
-
}, n.role === "user" ? "You" : "GeneXus Code Fixer"), e("time", {
|
|
55
|
-
dateTime: n.metadata,
|
|
56
|
-
part: "message__time"
|
|
57
|
-
}, n.metadata), n.role === "user" ? e("span", {
|
|
58
|
-
part: "message__content user"
|
|
59
|
-
}, n.content) : e("ch-markdown-viewer", {
|
|
60
|
-
part: n.role === "assistant" && (n.status === "complete" || !n.status) && !n.parts ? `message__content no-error` : "message__content",
|
|
61
|
-
theme: t,
|
|
62
|
-
showIndicator: false,
|
|
63
|
-
renderCode: mercuryCodeRender("Copy code"),
|
|
64
|
-
value: n.content
|
|
65
|
-
}) ];
|
|
5
|
+
import "./p-ad5caf61.js";
|
|
66
6
|
|
|
67
|
-
const
|
|
7
|
+
const o = "{{ASSISTANT_NAME}}";
|
|
68
8
|
|
|
69
|
-
let
|
|
9
|
+
let s;
|
|
70
10
|
|
|
71
|
-
const
|
|
11
|
+
const r = `\n ### Code block {#code-block}\n To create code blocks, you’ll use three backticks (\` \`\`\` \`) or three tildes (\`~~~\`) on the lines before and after the code block.\n \n \`\`\`\n {\n "firstName": "John",\n "lastName": "Smith",\n "age": 25\n }\n \`\`\`\n \n Another way to create code blocks is to indent every line of the block by at least four spaces or one tab.\n \n <html>\n <head>\n </head>\n </html>\n \n \n #### Syntax Highlighting {#syntax-highlighting}\n This feature allows you to add color highlighting for whatever language your code was written in.\n To add syntax highlighting, specify a language next to the backticks before the fenced code block.\n \n \`\`\`json\n {\n "firstName": "John",\n "lastName": "Smith",\n "age": 25\n }\n \`\`\`\n \n \`\`\`javascript\n import React from 'react'\n import ReactDOM from 'react-dom'\n import Markdown from 'react-markdown'\n import rehypeHighlight from 'rehype-highlight'\n \n const markdown = \`\n # Your markdown here\n \`\n \n ReactDOM.render(\n <Markdown rehypePlugins={[rehypeHighlight]}>{markdown}</Markdown>,\n document.querySelector('#content')\n )\n \`\`\`\n \n ### Horizontal Rules {#horizontal-rules}\n To create a horizontal rule, use three or more asterisks (\`***\`), dashes (\`---\`), or underscores (\`___\`) on a line by themselves.\n `;
|
|
72
12
|
|
|
73
|
-
const
|
|
13
|
+
const i = `\n ### Code block {#code-block}\n To create code blocks, you’ll use three backticks (\` \`\`\` \`) or three tildes (\`~~~\`) on the lines before and after the code block.\n \n \`\`\`json\n {\n "firstName": "John",\n "lastName": "Smith",\n "age": 25\n }\n \`\`\`\n `;
|
|
74
14
|
|
|
75
15
|
const sendChatToLLM = () => {
|
|
76
16
|
// This is a WA to get the chat reference
|
|
@@ -81,20 +21,20 @@ const sendChatToLLM = () => {
|
|
|
81
21
|
content: "Analyzing",
|
|
82
22
|
status: "waiting"
|
|
83
23
|
});
|
|
84
|
-
|
|
24
|
+
s = setTimeout((() => {
|
|
85
25
|
e.updateLastMessage({
|
|
86
26
|
role: "assistant",
|
|
87
27
|
content: "Processing with Chat with LLMs",
|
|
88
28
|
status: "waiting"
|
|
89
29
|
}, "replace");
|
|
90
|
-
|
|
91
|
-
dummyStreaming(e, 20,
|
|
30
|
+
s = setTimeout((() => {
|
|
31
|
+
dummyStreaming(e, 20, r, "replace");
|
|
92
32
|
}), 200);
|
|
93
33
|
}), 200);
|
|
94
34
|
};
|
|
95
35
|
|
|
96
36
|
function dummyStreaming(e, t, n, a) {
|
|
97
|
-
|
|
37
|
+
s = setTimeout((() => {
|
|
98
38
|
const o = t >= n.length;
|
|
99
39
|
e.updateLastMessage({
|
|
100
40
|
role: "assistant",
|
|
@@ -116,12 +56,12 @@ function dummyStreaming(e, t, n, a) {
|
|
|
116
56
|
}), t % 200 === 0 ? 50 : 40);
|
|
117
57
|
}
|
|
118
58
|
|
|
119
|
-
const
|
|
59
|
+
const c = {
|
|
120
60
|
clear: () => new Promise((e => e())),
|
|
121
61
|
sendChatToLLM,
|
|
122
62
|
uploadImage: () => new Promise((e => e(""))),
|
|
123
63
|
stopGeneratingAnswer: () => {
|
|
124
|
-
clearTimeout(
|
|
64
|
+
clearTimeout(s);
|
|
125
65
|
// This is a WA to get the chat reference
|
|
126
66
|
const e = document.querySelector("ch-chat");
|
|
127
67
|
e.updateLastMessage({
|
|
@@ -133,7 +73,7 @@ const d = {
|
|
|
133
73
|
}
|
|
134
74
|
};
|
|
135
75
|
|
|
136
|
-
const
|
|
76
|
+
const d = {
|
|
137
77
|
accessibleName: {
|
|
138
78
|
clearChat: "Clear chat",
|
|
139
79
|
copyResponseButton: "Copy assistant response",
|
|
@@ -149,7 +89,7 @@ const l = {
|
|
|
149
89
|
},
|
|
150
90
|
text: {
|
|
151
91
|
copyCodeButton: "Copy code",
|
|
152
|
-
processing: `Processing with ${
|
|
92
|
+
processing: `Processing with ${o}`,
|
|
153
93
|
sourceFiles: "Source files:"
|
|
154
94
|
}
|
|
155
95
|
};
|
|
@@ -163,10 +103,10 @@ Array.from({
|
|
|
163
103
|
} : {
|
|
164
104
|
id: `index: ${t}`,
|
|
165
105
|
role: "assistant",
|
|
166
|
-
content:
|
|
106
|
+
content: i + `\nindex: ${t}\n` + `index: ${t}\n` + `index: ${t}\n` + `index: ${t}\n` + `index: ${t}\n` + `index: ${t}\n` + `index: ${t}\n`
|
|
167
107
|
}));
|
|
168
108
|
|
|
169
|
-
const
|
|
109
|
+
const l = [ {
|
|
170
110
|
id: "1",
|
|
171
111
|
role: "user",
|
|
172
112
|
content: "Please give me an example about...",
|
|
@@ -216,65 +156,69 @@ const m = [ {
|
|
|
216
156
|
id: "9",
|
|
217
157
|
role: "assistant",
|
|
218
158
|
status: "complete",
|
|
219
|
-
content:
|
|
159
|
+
content: i
|
|
220
160
|
} ];
|
|
221
161
|
|
|
222
|
-
const
|
|
162
|
+
const h = ":host{block-size:100%;display:grid}";
|
|
223
163
|
|
|
224
|
-
var
|
|
164
|
+
var m = undefined && undefined.__classPrivateFieldGet || function(e, t, n, a) {
|
|
225
165
|
if (n === "a" && !a) throw new TypeError("Private accessor was defined without a getter");
|
|
226
166
|
if (typeof t === "function" ? e !== t || !a : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
227
167
|
return n === "m" ? a : n === "a" ? a.call(e) : a ? a.value : t.get(e);
|
|
228
168
|
};
|
|
229
169
|
|
|
230
|
-
var
|
|
170
|
+
var u = undefined && undefined.__classPrivateFieldSet || function(e, t, n, a, o) {
|
|
231
171
|
if (a === "m") throw new TypeError("Private method is not writable");
|
|
232
172
|
if (a === "a" && !o) throw new TypeError("Private accessor was defined without a setter");
|
|
233
173
|
if (typeof t === "function" ? e !== t || !o : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
234
174
|
return a === "a" ? o.call(e, n) : o ? o.value = n : t.set(e, n), n;
|
|
235
175
|
};
|
|
236
176
|
|
|
237
|
-
var g, f;
|
|
177
|
+
var p, g, f;
|
|
238
178
|
|
|
239
179
|
const w = [ "resets/box-sizing", "components/chat" ];
|
|
240
180
|
|
|
241
181
|
const y = class {
|
|
242
|
-
constructor(
|
|
243
|
-
|
|
244
|
-
|
|
182
|
+
constructor(t) {
|
|
183
|
+
e(this, t);
|
|
184
|
+
p.set(this, void 0);
|
|
185
|
+
g.set(this, (() => {
|
|
186
|
+
m(this, p, "f").showCopyConversationMessage();
|
|
187
|
+
}));
|
|
245
188
|
f.set(this, (() => {
|
|
246
|
-
|
|
189
|
+
console.log("delete messages");
|
|
247
190
|
}));
|
|
248
191
|
this.showAdditionalContent = false;
|
|
249
192
|
this.conversationCopied = false;
|
|
250
193
|
}
|
|
251
194
|
render() {
|
|
252
|
-
return
|
|
195
|
+
return t(n, null, t("ch-theme", {
|
|
253
196
|
model: w
|
|
254
|
-
}),
|
|
197
|
+
}), t("gx-ide-chat-container", {
|
|
255
198
|
chatTitle: "GeneXus Assistant",
|
|
256
|
-
copyConversationCallback:
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
199
|
+
copyConversationCallback: m(this, g, "f"),
|
|
200
|
+
deleteConversationCallback: m(this, f, "f"),
|
|
201
|
+
ref: e => u(this, p, e, "f")
|
|
202
|
+
}, t("ch-chat", {
|
|
203
|
+
callbacks: c,
|
|
260
204
|
class: "chat",
|
|
261
205
|
generatingResponse: false,
|
|
262
206
|
loadingState: "all-records-loaded",
|
|
263
207
|
markdownTheme: "mercury/markdown-viewer",
|
|
264
|
-
renderItem:
|
|
208
|
+
renderItem: a("mercury/markdown-viewer"),
|
|
265
209
|
isMobile: false,
|
|
266
|
-
items:
|
|
210
|
+
items: l,
|
|
267
211
|
showAdditionalContent: this.showAdditionalContent,
|
|
268
|
-
translations:
|
|
269
|
-
},
|
|
212
|
+
translations: d
|
|
213
|
+
}, t("div", {
|
|
270
214
|
slot: "additional-content"
|
|
271
215
|
}, "Custom content that is rendered when the chat renders content"))));
|
|
272
216
|
}
|
|
273
217
|
};
|
|
274
218
|
|
|
275
|
-
g = new WeakMap, f = new WeakMap;
|
|
219
|
+
p = new WeakMap, g = new WeakMap, f = new WeakMap;
|
|
276
220
|
|
|
277
|
-
y.style =
|
|
221
|
+
y.style = h;
|
|
278
222
|
|
|
279
223
|
export { y as gx_ide_sc_chat_container };
|
|
280
|
-
//# sourceMappingURL=p-
|
|
224
|
+
//# sourceMappingURL=p-8558e873.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PROCESSING_PLACEHOLDER","timeOut","ASSISTANT_RESPONSE_MARKDOWN","ASSISTANT_RESPONSE_SHORT_MARKDOWN","sendChatToLLM","chatRef","document","querySelector","addNewMessage","id","Date","getTime","role","content","status","setTimeout","updateLastMessage","dummyStreaming","counter","stringToDisplay","mode","streamingCompleted","length","message","substring","files","url","caption","undefined","chatCallbacks","clear","Promise","resolve","uploadImage","stopGeneratingAnswer","clearTimeout","chatTranslations","accessibleName","clearChat","copyResponseButton","downloadCodeButton","imagePicker","removeUploadedImage","sendButton","sendInput","stopGeneratingAnswerButton","placeholder","text","copyCodeButton","processing","sourceFiles","Array","from","_","index","codeFixerRecord","metadata","parts","chatShowcaseCss","CSS_BUNDLES","GxIdeScChatContainer","_GxIdeScChatContainer_chatContainerRef","set","this","_GxIdeScChatContainer_copyConversationCallbackHandler","__classPrivateFieldGet","showCopyConversationMessage","_GxIdeScChatContainer_deleteConversationCallbackHandler","console","log","render","h","Host","model","chatTitle","copyConversationCallback","deleteConversationCallback","ref","el","__classPrivateFieldSet","callbacks","class","generatingResponse","loadingState","markdownTheme","renderItem","mercuryChatMessageRender","isMobile","items","showAdditionalContent","translations","slot"],"sources":["src/showcase/chat-container/callbacks.ts","src/showcase/chat-container/chat-showcase.scss?tag=gx-ide-sc-chat-container&encapsulation=shadow","src/showcase/chat-container/chat.showcase.tsx"],"sourcesContent":["import {\n ChatInternalCallbacks,\n ChatMessage,\n ChatTranslations\n} from \"@genexus/chameleon-controls-library\";\n\nconst PROCESSING_PLACEHOLDER = \"{{ASSISTANT_NAME}}\";\n\nlet timeOut: NodeJS.Timeout;\n\nconst ASSISTANT_RESPONSE_MARKDOWN = `\n ### Code block {#code-block}\n To create code blocks, you’ll use three backticks (\\` \\`\\`\\` \\`) or three tildes (\\`~~~\\`) on the lines before and after the code block.\n \n \\`\\`\\`\n {\n \"firstName\": \"John\",\n \"lastName\": \"Smith\",\n \"age\": 25\n }\n \\`\\`\\`\n \n Another way to create code blocks is to indent every line of the block by at least four spaces or one tab.\n \n <html>\n <head>\n </head>\n </html>\n \n \n #### Syntax Highlighting {#syntax-highlighting}\n This feature allows you to add color highlighting for whatever language your code was written in.\n To add syntax highlighting, specify a language next to the backticks before the fenced code block.\n \n \\`\\`\\`json\n {\n \"firstName\": \"John\",\n \"lastName\": \"Smith\",\n \"age\": 25\n }\n \\`\\`\\`\n \n \\`\\`\\`javascript\n import React from 'react'\n import ReactDOM from 'react-dom'\n import Markdown from 'react-markdown'\n import rehypeHighlight from 'rehype-highlight'\n \n const markdown = \\`\n # Your markdown here\n \\`\n \n ReactDOM.render(\n <Markdown rehypePlugins={[rehypeHighlight]}>{markdown}</Markdown>,\n document.querySelector('#content')\n )\n \\`\\`\\`\n \n ### Horizontal Rules {#horizontal-rules}\n To create a horizontal rule, use three or more asterisks (\\`***\\`), dashes (\\`---\\`), or underscores (\\`___\\`) on a line by themselves.\n `;\n\nconst ASSISTANT_RESPONSE_SHORT_MARKDOWN = `\n ### Code block {#code-block}\n To create code blocks, you’ll use three backticks (\\` \\`\\`\\` \\`) or three tildes (\\`~~~\\`) on the lines before and after the code block.\n \n \\`\\`\\`json\n {\n \"firstName\": \"John\",\n \"lastName\": \"Smith\",\n \"age\": 25\n }\n \\`\\`\\`\n `;\n\nconst sendChatToLLM = () => {\n // This is a WA to get the chat reference\n const chatRef = document.querySelector(\"ch-chat\") as HTMLChChatElement;\n\n chatRef.addNewMessage({\n id: `${new Date().getTime()}`,\n role: \"assistant\",\n content: \"Analyzing\",\n status: \"waiting\"\n });\n\n timeOut = setTimeout(() => {\n chatRef.updateLastMessage(\n {\n role: \"assistant\",\n content: \"Processing with Chat with LLMs\",\n status: \"waiting\"\n },\n \"replace\"\n );\n\n timeOut = setTimeout(() => {\n dummyStreaming(chatRef, 20, ASSISTANT_RESPONSE_MARKDOWN, \"replace\");\n }, 200);\n }, 200);\n};\n\nfunction dummyStreaming(\n chatRef: HTMLChChatElement,\n counter: number,\n stringToDisplay: string,\n mode: \"concat\" | \"replace\"\n) {\n timeOut = setTimeout(\n () => {\n const streamingCompleted = counter >= stringToDisplay.length;\n\n chatRef.updateLastMessage(\n {\n role: \"assistant\",\n content: {\n message: stringToDisplay.substring(counter - 20, counter),\n files: streamingCompleted\n ? [\n {\n url: \"https://next.genexus.ai\",\n caption: \"Mars Exploration Contract\"\n },\n {\n url: \"https://gx-chameleon.netlify.app\",\n caption: \"Venus Exploration Contract\"\n }\n ]\n : undefined\n },\n status: streamingCompleted ? \"complete\" : \"streaming\"\n },\n mode\n );\n\n if (!streamingCompleted) {\n dummyStreaming(chatRef, counter + 20, stringToDisplay, \"concat\");\n }\n },\n counter % 200 === 0 ? 50 : 40\n );\n}\n\nexport const chatCallbacks: ChatInternalCallbacks = {\n clear: () => new Promise(resolve => resolve()),\n sendChatToLLM: sendChatToLLM,\n uploadImage: () => new Promise(resolve => resolve(\"\")),\n stopGeneratingAnswer: () => {\n clearTimeout(timeOut);\n\n // This is a WA to get the chat reference\n const chatRef = document.querySelector(\"ch-chat\") as HTMLChChatElement;\n\n chatRef.updateLastMessage(\n {\n role: \"assistant\",\n content: \"\",\n status: \"complete\"\n },\n \"concat\"\n );\n\n return new Promise(resolve => setTimeout(() => resolve, 10));\n }\n};\n\nexport const chatTranslations: ChatTranslations = {\n accessibleName: {\n clearChat: \"Clear chat\",\n copyResponseButton: \"Copy assistant response\",\n downloadCodeButton: \"Download code\",\n imagePicker: \"Select images\",\n removeUploadedImage: \"Remove uploaded image\",\n sendButton: \"Send\",\n sendInput: \"Message\",\n stopGeneratingAnswerButton: \"Stop generating answer\"\n },\n placeholder: {\n sendInput: \"Ask me a question...\"\n },\n text: {\n copyCodeButton: \"Copy code\",\n processing: `Processing with ${PROCESSING_PLACEHOLDER}`,\n sourceFiles: \"Source files:\"\n }\n};\n\nexport const chatRecord: ChatMessage[] = [\n { id: \"1\", role: \"user\", content: \"Hello world\" },\n { id: \"2\", role: \"assistant\", content: ASSISTANT_RESPONSE_MARKDOWN },\n { id: \"3\", role: \"user\", content: \"Hello world 1\" },\n { id: \"4\", role: \"assistant\", content: ASSISTANT_RESPONSE_SHORT_MARKDOWN },\n { id: \"5\", role: \"user\", content: \"Hello world 2\" },\n { id: \"6\", role: \"assistant\", content: ASSISTANT_RESPONSE_SHORT_MARKDOWN },\n { id: \"7\", role: \"user\", content: \"Hello world 3\" },\n { id: \"8\", role: \"assistant\", content: ASSISTANT_RESPONSE_SHORT_MARKDOWN },\n { id: \"9\", role: \"user\", content: \"Hello world 4\" },\n { id: \"10\", role: \"assistant\", content: ASSISTANT_RESPONSE_SHORT_MARKDOWN }\n];\n\nexport const longChatRecord: ChatMessage[] = Array.from(\n { length: 40 },\n (_, index) =>\n index % 2 === 0\n ? {\n id: `index: ${index}`,\n role: \"user\",\n content:\n `index: ${index}` +\n `index: ${index}\\n` +\n `index: ${index}\\n` +\n `index: ${index}\\n` +\n `index: ${index}\\n` +\n `index: ${index}\\n` +\n `index: ${index}\\n`\n }\n : {\n id: `index: ${index}`,\n role: \"assistant\",\n content:\n ASSISTANT_RESPONSE_SHORT_MARKDOWN +\n `\\nindex: ${index}\\n` +\n `index: ${index}\\n` +\n `index: ${index}\\n` +\n `index: ${index}\\n` +\n `index: ${index}\\n` +\n `index: ${index}\\n` +\n `index: ${index}\\n`\n }\n);\n\nexport const codeFixerRecord: ChatMessage[] = [\n {\n id: \"1\",\n role: \"user\",\n content: \"Please give me an example about...\",\n metadata: \"14:55\"\n },\n {\n id: \"2\",\n role: \"assistant\",\n status: \"complete\",\n content:\n \"Action required example. Action required example. Action required example.\",\n metadata: \"14:56\"\n },\n {\n id: \"3\",\n role: \"assistant\",\n status: \"complete\",\n content: \"Warning in request\",\n metadata: \"14:57\",\n parts: \"warning\"\n },\n {\n id: \"4\",\n role: \"error\",\n content: \"Error in Request\",\n metadata: \"14:58\"\n },\n {\n id: \"5\",\n role: \"assistant\",\n status: \"complete\",\n content: \"Warning in request\",\n metadata: \"14:59\",\n parts: \"success\"\n },\n {\n id: \"6\",\n role: \"user\",\n content:\n \"Implement the function calculate_average_grade in grades.py that takes a list of grades as input and returns the average grade as a floating-point number\",\n metadata: \"15:00\"\n },\n {\n id: \"7\",\n role: \"assistant\",\n status: \"complete\",\n content:\n \"You can provide further details or updates regarding your support ticket and its associated code. Your input here helps us better understand and address your issue effectively.\",\n metadata: \"15:01\"\n },\n {\n id: \"8\",\n role: \"assistant\",\n status: \"waiting\",\n content: \"Processing Request\"\n },\n {\n id: \"9\",\n role: \"assistant\",\n status: \"complete\",\n content: ASSISTANT_RESPONSE_SHORT_MARKDOWN\n }\n];\n",":host {\n block-size: 100%;\n display: grid;\n}\n","import { Component, Host, h, State } from \"@stencil/core\";\nimport { mercuryChatMessageRender } from \"../../components/_helpers/chat-container/code-render\";\nimport { MercuryBundles } from \"@genexus/mercury\";\n\nconst CSS_BUNDLES: MercuryBundles = [\"resets/box-sizing\", \"components/chat\"];\n\nimport { chatCallbacks, chatTranslations, codeFixerRecord } from \"./callbacks\";\n\n@Component({\n tag: \"gx-ide-sc-chat-container\",\n styleUrl: \"chat-showcase.scss\",\n shadow: true\n})\nexport class GxIdeScChatContainer {\n #chatContainerRef!: HTMLGxIdeChatContainerElement;\n\n @State() showAdditionalContent: boolean = false;\n @State() conversationCopied: boolean = false;\n\n #copyConversationCallbackHandler = () => {\n this.#chatContainerRef.showCopyConversationMessage();\n };\n\n #deleteConversationCallbackHandler = () => {\n console.log(\"delete messages\");\n };\n\n render() {\n return (\n <Host>\n <ch-theme model={CSS_BUNDLES}></ch-theme>\n <gx-ide-chat-container\n chatTitle=\"GeneXus Assistant\"\n copyConversationCallback={this.#copyConversationCallbackHandler}\n deleteConversationCallback={this.#deleteConversationCallbackHandler}\n ref={el =>\n (this.#chatContainerRef = el as HTMLGxIdeChatContainerElement)\n }\n >\n <ch-chat\n callbacks={chatCallbacks}\n class=\"chat\"\n generatingResponse={false}\n loadingState=\"all-records-loaded\"\n markdownTheme=\"mercury/markdown-viewer\"\n renderItem={mercuryChatMessageRender(\"mercury/markdown-viewer\")}\n isMobile={false}\n items={codeFixerRecord}\n showAdditionalContent={this.showAdditionalContent}\n translations={chatTranslations}\n >\n <div slot=\"additional-content\">\n Custom content that is rendered when the chat renders content\n </div>\n </ch-chat>\n </gx-ide-chat-container>\n </Host>\n );\n }\n}\n"],"mappings":";;;;;;AAMA,MAAMA,IAAyB;;AAE/B,IAAIC;;AAEJ,MAAMC,IAA8B;;AAoDpC,MAAMC,IAAoC;;AAa1C,MAAMC,gBAAgB;;EAEpB,MAAMC,IAAUC,SAASC,cAAc;EAEvCF,EAAQG,cAAc;IACpBC,IAAI,IAAG,IAAIC,MAAOC;IAClBC,MAAM;IACNC,SAAS;IACTC,QAAQ;;EAGVb,IAAUc,YAAW;IACnBV,EAAQW,kBACN;MACEJ,MAAM;MACNC,SAAS;MACTC,QAAQ;OAEV;IAGFb,IAAUc,YAAW;MACnBE,eAAeZ,GAAS,IAAIH,GAA6B;AAAU,QAClE;AAAI,MACN;AAAI;;AAGT,SAASe,eACPZ,GACAa,GACAC,GACAC;EAEAnB,IAAUc,YACR;IACE,MAAMM,IAAqBH,KAAWC,EAAgBG;IAEtDjB,EAAQW,kBACN;MACEJ,MAAM;MACNC,SAAS;QACPU,SAASJ,EAAgBK,UAAUN,IAAU,IAAIA;QACjDO,OAAOJ,IACH,EACE;UACEK,KAAK;UACLC,SAAS;WAEX;UACED,KAAK;UACLC,SAAS;cAGbC;;MAENd,QAAQO,IAAqB,aAAa;OAE5CD;IAGF,KAAKC,GAAoB;MACvBJ,eAAeZ,GAASa,IAAU,IAAIC,GAAiB;;MAG3DD,IAAU,QAAQ,IAAI,KAAK;AAE/B;;AAEO,MAAMW,IAAuC;EAClDC,OAAO,MAAM,IAAIC,SAAQC,KAAWA;EACpC5B;EACA6B,aAAa,MAAM,IAAIF,SAAQC,KAAWA,EAAQ;EAClDE,sBAAsB;IACpBC,aAAalC;;QAGb,MAAMI,IAAUC,SAASC,cAAc;IAEvCF,EAAQW,kBACN;MACEJ,MAAM;MACNC,SAAS;MACTC,QAAQ;OAEV;IAGF,OAAO,IAAIiB,SAAQC,KAAWjB,YAAW,MAAMiB,IAAS;AAAI;;;AAIzD,MAAMI,IAAqC;EAChDC,gBAAgB;IACdC,WAAW;IACXC,oBAAoB;IACpBC,oBAAoB;IACpBC,aAAa;IACbC,qBAAqB;IACrBC,YAAY;IACZC,WAAW;IACXC,4BAA4B;;EAE9BC,aAAa;IACXF,WAAW;;EAEbG,MAAM;IACJC,gBAAgB;IAChBC,YAAY,mBAAmBjD;IAC/BkD,aAAa;;;;AAiB4BC,MAAMC,KACjD;EAAE9B,QAAQ;IACV,CAAC+B,GAAGC,MACFA,IAAQ,MAAM,IACV;EACE7C,IAAI,UAAU6C;EACd1C,MAAM;EACNC,SACE,UAAUyC,MACV,UAAUA,QACV,UAAUA,QACV,UAAUA,QACV,UAAUA,QACV,UAAUA,QACV,UAAUA;IAEd;EACE7C,IAAI,UAAU6C;EACd1C,MAAM;EACNC,SACEV,IACA,YAAYmD,QACZ,UAAUA,QACV,UAAUA,QACV,UAAUA,QACV,UAAUA,QACV,UAAUA,QACV,UAAUA;;;AAIf,MAAMC,IAAiC,EAC5C;EACE9C,IAAI;EACJG,MAAM;EACNC,SAAS;EACT2C,UAAU;GAEZ;EACE/C,IAAI;EACJG,MAAM;EACNE,QAAQ;EACRD,SACE;EACF2C,UAAU;GAEZ;EACE/C,IAAI;EACJG,MAAM;EACNE,QAAQ;EACRD,SAAS;EACT2C,UAAU;EACVC,OAAO;GAET;EACEhD,IAAI;EACJG,MAAM;EACNC,SAAS;EACT2C,UAAU;GAEZ;EACE/C,IAAI;EACJG,MAAM;EACNE,QAAQ;EACRD,SAAS;EACT2C,UAAU;EACVC,OAAO;GAET;EACEhD,IAAI;EACJG,MAAM;EACNC,SACE;EACF2C,UAAU;GAEZ;EACE/C,IAAI;EACJG,MAAM;EACNE,QAAQ;EACRD,SACE;EACF2C,UAAU;GAEZ;EACE/C,IAAI;EACJG,MAAM;EACNE,QAAQ;EACRD,SAAS;GAEX;EACEJ,IAAI;EACJG,MAAM;EACNE,QAAQ;EACRD,SAASV;;;ACrSb,MAAMuD,IAAkB;;;;;;;;;;;;;;;;;ACIxB,MAAMC,IAA8B,EAAC,qBAAqB;;MAS7CC,IAAoB;;;IAC/BC,EAAAC,IAAAC,WAAA;IAKAC,EAAAF,IAAAC,OAAmC;MACjCE,EAAAF,MAAIF,GAAA,KAAmBK;AAA6B;IAGtDC,EAAAL,IAAAC,OAAqC;MACnCK,QAAQC,IAAI;AAAkB;iCARU;8BACH;;EAUvC,MAAAC;IACE,OACEC,EAACC,GAAI,MACHD,EAAA;MAAUE,OAAOd;QACjBY,EAAA;MACEG,WAAU;MACVC,0BAA0BV,EAAAF,MAAIC,GAAA;MAC9BY,4BAA4BX,EAAAF,MAAII,GAAA;MAChCU,KAAKC,KACFC,EAAAhB,MAAIF,GAAqBiB,GAAmC;OAG/DP,EAAA;MACES,WAAWnD;MACXoD,OAAM;MACNC,oBAAoB;MACpBC,cAAa;MACbC,eAAc;MACdC,YAAYC,EAAyB;MACrCC,UAAU;MACVC,OAAOjC;MACPkC,uBAAuB1B,KAAK0B;MAC5BC,cAActD;OAEdmC,EAAA;MAAKoB,MAAK;OAAoB"}
|
|
@@ -4,9 +4,9 @@ import { g as o } from "./p-6e4208d8.js";
|
|
|
4
4
|
|
|
5
5
|
import "./p-ad5caf61.js";
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const i = '.chat-container{display:grid;block-size:100%;overflow:auto;grid-template-rows:max-content 1fr max-content;gap:var(--mer-spacing--xs);padding:var(--mer-spacing--xs);position:relative;--chat-common-border-radius:var(--mer-spacing--2xs)}.section{display:contents}.chat-container__header{padding:var(--mer-spacing--2xs) var(--mer-spacing--2xs) var(--mer-spacing--2xs) var(--mer-spacing--sm);display:flex;align-items:center;gap:var(--mer-spacing--sm);justify-content:space-between}.chat-container__ch-chat{overflow:auto;position:relative;display:grid}.chat-container__header,.chat-container__footer{padding:var(--mer-spacing--2xs) var(--mer-spacing--2xs) var(--mer-spacing--2xs) var(--mer-spacing--sm);border-radius:var(--chat-common-border-radius)}.chat-container__conversation-copied{position:absolute;z-index:1;inline-size:100%;block-size:100%;background:rgba(22, 22, 23, 0.75);backdrop-filter:saturate(180%) blur(20px);display:grid;align-items:center;justify-content:center;text-align:center;padding:32px;--mer-icon__box--md:18px;pointer-events:none;overflow:hidden;animation:fadeIn 100ms ease-in-out forwards;opacity:0}.chat-container__conversation-copied-wrapper{display:flex;align-items:center;gap:var(--mer-spacing--sm)}.chat-container__conversation-copied-wrapper{animation:liftUp var(--mer-timing--fast) ease-in-out forwards;inset-block-start:4px;opacity:0;animation-delay:var(--mer-timing--fast);position:relative}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes liftUp{from{opacity:0;inset-block-start:4px}to{opacity:1;inset-block-start:0}}.chat::part(message){position:relative;--copy-button-opacity:0;--copied-to-clipboard-opacity:0;--date-opacity:1}.chat::part(message__time),.chat::part(message__copy-button){transition:opacity var(--mer-timing--super-fast) ease-in-out}.chat::part(message__time){opacity:var(--date-opacity)}.chat::part(message):hover{position:relative;--copy-button-opacity:1;--date-opacity:0}.chat::part(message__copy-button){position:absolute;z-index:1;inset-inline-end:0;padding:var(--mer-spacing--sm);transition:opacity var(--mer-timing--fast) ease-in-out;opacity:var(--copy-button-opacity)}.chat::part(message__copy-button)::after{content:"";inline-size:var(--mer-icon__box--md);block-size:var(--mer-icon__box--md);background:no-repeat center/var(--mer-icon__size--md) var(--icon-path);--icon-path:var(--icon__system_copy_primary--enabled)}.chat::part(message__copy-button):hover::after{--icon-path:var(--icon__system_copy_primary--hover)}.chat::part(message__copy-button):active::after{--icon-path:var(--icon__system_copy_primary--active)}.chat::part(message__copied-feedback){transition:opacity 150ms ease-in-out;position:absolute;inline-size:100%;block-size:100%;display:flex;align-items:center;justify-content:center;z-index:2;background:rgba(22, 22, 23, 0.8);backdrop-filter:saturate(180%) blur(20px);opacity:var(--copied-to-clipboard-opacity);pointer-events:none}.chat::part(message__copied-feedback-visible){--copied-to-clipboard-opacity:1;pointer-events:visible}.chat::part(send-container){gap:var(--mer-spacing--xs)}.chat::part(send-input){--control__padding-block:7px !important}.chat::part(send-button){border-width:var(--control__border-width);border-style:var(--control__border-style);border-color:var(--control__border-color);border-radius:var(--control__border-radius);inline-size:32px;block-size:32px;background:no-repeat center/var(--mer-icon__box--md) var(--icon-path);--icon-path:var(--icon__system_send_primary--enabled)}.chat::part(send-button):hover{--icon-path:var(--icon__system_send_primary--hover);--control__border-color:var(--mer-text__primary--hover)}.chat::part(send-button):active{--icon-path:var(--icon__system_send_primary--active);--control__border-color:var(--mer-border-color__primary--active)}';
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const r = [ "resets/box-sizing", "utils/typography", "chameleon/scrollbar", "components/button", "components/icon", "utils/elevation" ];
|
|
10
10
|
|
|
11
11
|
const n = o({
|
|
12
12
|
category: "system",
|
|
@@ -14,16 +14,23 @@ const n = o({
|
|
|
14
14
|
colorType: "neutral"
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
+
const s = o({
|
|
18
|
+
category: "system",
|
|
19
|
+
name: "delete-outlined",
|
|
20
|
+
colorType: "error"
|
|
21
|
+
});
|
|
22
|
+
|
|
17
23
|
const c = o({
|
|
18
24
|
category: "objects",
|
|
19
25
|
name: "conversational-flows"
|
|
20
26
|
});
|
|
21
27
|
|
|
22
|
-
const
|
|
28
|
+
const p = class {
|
|
23
29
|
constructor(a) {
|
|
24
30
|
t(this, a);
|
|
25
31
|
this.chatTitle = undefined;
|
|
26
32
|
this.copyConversationCallback = undefined;
|
|
33
|
+
this.deleteConversationCallback = undefined;
|
|
27
34
|
this.displayConversationCopiedMessage = false;
|
|
28
35
|
}
|
|
29
36
|
/**
|
|
@@ -35,23 +42,31 @@ const s = class {
|
|
|
35
42
|
}), 2e3);
|
|
36
43
|
}
|
|
37
44
|
render() {
|
|
38
|
-
const t = this.chatTitle || this.copyConversationCallback;
|
|
45
|
+
const t = this.chatTitle || this.copyConversationCallback || this.deleteConversationCallback;
|
|
46
|
+
const o = this.copyConversationCallback || this.deleteConversationCallback;
|
|
39
47
|
return a(e, {
|
|
40
48
|
class: "chat-container"
|
|
41
49
|
}, a("ch-theme", {
|
|
42
|
-
model:
|
|
50
|
+
model: r
|
|
43
51
|
}), a("section", {
|
|
44
52
|
class: "section"
|
|
45
53
|
}, t && a("header", {
|
|
46
54
|
class: "chat-container__header elevation-1 body-italic-m"
|
|
47
|
-
}, this.chatTitle && this.chatTitle,
|
|
55
|
+
}, this.chatTitle && this.chatTitle, o && a("div", {
|
|
56
|
+
class: "buttons-spacer"
|
|
57
|
+
}, this.deleteConversationCallback && a("button", {
|
|
48
58
|
class: "button-secondary button-icon-only",
|
|
49
|
-
onClick: this.
|
|
59
|
+
onClick: this.deleteConversationCallback
|
|
50
60
|
}, a("ch-image", {
|
|
51
61
|
class: "icon-md",
|
|
52
|
-
src:
|
|
62
|
+
src: s
|
|
63
|
+
})), this.copyConversationCallback && a("button", {
|
|
64
|
+
class: "button-secondary button-icon-only",
|
|
53
65
|
onClick: this.copyConversationCallback
|
|
54
|
-
}
|
|
66
|
+
}, a("ch-image", {
|
|
67
|
+
class: "icon-md",
|
|
68
|
+
src: n
|
|
69
|
+
})))), a("section", {
|
|
55
70
|
class: "chat-container__ch-chat"
|
|
56
71
|
}, a("slot", null), this.displayConversationCopiedMessage && a("div", {
|
|
57
72
|
class: "chat-container__conversation-copied"
|
|
@@ -66,7 +81,7 @@ const s = class {
|
|
|
66
81
|
}
|
|
67
82
|
};
|
|
68
83
|
|
|
69
|
-
|
|
84
|
+
p.style = i;
|
|
70
85
|
|
|
71
|
-
export {
|
|
72
|
-
//# sourceMappingURL=p-
|
|
86
|
+
export { p as gx_ide_chat_container };
|
|
87
|
+
//# sourceMappingURL=p-c1791757.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["chatContainerCss","CSS_BUNDLES","COPY_ICON","getIconPath","category","name","colorType","CONVERSATION_ICON","GxIdeChatContainer","showCopyConversationMessage","this","displayConversationCopiedMessage","setTimeout","render","renderHeader","chatTitle","copyConversationCallback","h","Host","class","model","onClick","src"],"sources":["src/components/_helpers/chat-container/chat-container.scss?tag=gx-ide-chat-container","src/components/_helpers/chat-container/chat-container.tsx"],"sourcesContent":[".chat-container {\n display: grid;\n block-size: 100%;\n overflow: auto;\n grid-template-rows: max-content 1fr max-content;\n gap: var(--mer-spacing--xs);\n padding: var(--mer-spacing--xs);\n position: relative;\n --chat-common-border-radius: var(--mer-spacing--2xs);\n}\n.section {\n display: contents;\n}\n\n// header\n.chat-container__header {\n padding: var(--mer-spacing--2xs) var(--mer-spacing--2xs)\n var(--mer-spacing--2xs) var(--mer-spacing--sm);\n display: flex;\n align-items: center;\n gap: var(--mer-spacing--sm);\n justify-content: space-between;\n}\n\n// ch-chat container\n.chat-container__ch-chat {\n overflow: auto;\n position: relative;\n display: grid;\n}\n\n// footer\n\n// header & footer (common styles)\n.chat-container__header,\n.chat-container__footer {\n padding: var(--mer-spacing--2xs) var(--mer-spacing--2xs)\n var(--mer-spacing--2xs) var(--mer-spacing--sm);\n border-radius: var(--chat-common-border-radius);\n}\n\n.chat-container__conversation-copied {\n position: absolute;\n z-index: 1;\n inline-size: 100%;\n block-size: 100%;\n background: rgba(22, 22, 23, 0.75);\n backdrop-filter: saturate(180%) blur(20px);\n display: grid;\n align-items: center;\n justify-content: center;\n text-align: center;\n padding: 32px;\n --mer-icon__box--md: 18px;\n pointer-events: none;\n overflow: hidden;\n animation: fadeIn 100ms ease-in-out forwards;\n opacity: 0;\n}\n.chat-container__conversation-copied-wrapper {\n display: flex;\n align-items: center;\n gap: var(--mer-spacing--sm);\n}\n.chat-container__conversation-copied-wrapper {\n animation: liftUp var(--mer-timing--fast) ease-in-out forwards;\n inset-block-start: 4px;\n opacity: 0;\n animation-delay: var(--mer-timing--fast);\n position: relative;\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n@keyframes liftUp {\n from {\n opacity: 0;\n inset-block-start: 4px;\n }\n to {\n opacity: 1;\n inset-block-start: 0;\n }\n}\n\n// - - - - - - - - - - - - - - - - - - - - - - - - - -\n// ch-chat overrides TODO: move this styles to Mercury\n// - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n.chat::part(message) {\n position: relative;\n --copy-button-opacity: 0;\n --copied-to-clipboard-opacity: 0;\n --date-opacity: 1;\n}\n.chat::part(message__time),\n.chat::part(message__copy-button) {\n transition: opacity var(--mer-timing--super-fast) ease-in-out;\n}\n.chat::part(message__time) {\n opacity: var(--date-opacity);\n}\n.chat::part(message):hover {\n position: relative;\n --copy-button-opacity: 1;\n --date-opacity: 0;\n}\n.chat::part(message__copy-button) {\n position: absolute;\n z-index: 1;\n inset-inline-end: 0;\n padding: var(--mer-spacing--sm); // same as part::(message)\n transition: opacity var(--mer-timing--fast) ease-in-out;\n opacity: var(--copy-button-opacity);\n\n &::after {\n content: \"\";\n inline-size: var(--mer-icon__box--md);\n block-size: var(--mer-icon__box--md);\n background: no-repeat center / var(--mer-icon__size--md) var(--icon-path);\n --icon-path: var(--icon__system_copy_primary--enabled);\n }\n &:hover::after {\n --icon-path: var(--icon__system_copy_primary--hover);\n }\n &:active::after {\n --icon-path: var(--icon__system_copy_primary--active);\n }\n}\n\n// // copy button effect\n.chat::part(message__copied-feedback) {\n transition: opacity 150ms ease-in-out;\n position: absolute;\n inline-size: 100%;\n block-size: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 2;\n background: rgba(22, 22, 23, 0.8);\n backdrop-filter: saturate(180%) blur(20px);\n opacity: var(--copied-to-clipboard-opacity);\n pointer-events: none;\n}\n\n.chat::part(message__copied-feedback-visible) {\n --copied-to-clipboard-opacity: 1;\n pointer-events: visible;\n}\n\n// send button\n\n.chat::part(send-container) {\n gap: var(--mer-spacing--xs);\n}\n.chat::part(send-input) {\n --control__padding-block: 7px !important;\n}\n\n.chat::part(send-button) {\n border-width: var(--control__border-width);\n border-style: var(--control__border-style);\n border-color: var(--control__border-color);\n border-radius: var(--control__border-radius);\n inline-size: 32px;\n block-size: 32px;\n background: no-repeat center / var(--mer-icon__box--md) var(--icon-path);\n --icon-path: var(--icon__system_send_primary--enabled);\n}\n.chat::part(send-button):hover {\n --icon-path: var(--icon__system_send_primary--hover);\n --control__border-color: var(--mer-text__primary--hover);\n}\n.chat::part(send-button):active {\n --icon-path: var(--icon__system_send_primary--active);\n --control__border-color: var(--mer-border-color__primary--active);\n}\n","import { Component, Host, h, Prop, Method, State } from \"@stencil/core\";\nimport { MercuryBundles, getIconPath } from \"@genexus/mercury\";\n\nconst CSS_BUNDLES: MercuryBundles = [\n \"resets/box-sizing\",\n \"utils/typography\",\n \"chameleon/scrollbar\",\n \"components/button\",\n \"components/icon\",\n \"utils/elevation\"\n];\n\nconst COPY_ICON = getIconPath({\n category: \"system\",\n name: \"copy\",\n colorType: \"neutral\"\n});\nconst CONVERSATION_ICON = getIconPath({\n category: \"objects\",\n name: \"conversational-flows\"\n});\n\n@Component({\n tag: \"gx-ide-chat-container\",\n styleUrl: \"chat-container.scss\",\n shadow: false\n})\nexport class GxIdeChatContainer {\n /**\n * The chat title\n */\n @Prop() readonly chatTitle?: string;\n\n /**\n * If true a button for copying the conversation will be render on the header.s\n */\n @Prop() readonly copyConversationCallback: () => void;\n\n /**\n * Coneration Copied\n */\n @State() displayConversationCopiedMessage: boolean = false;\n\n /**\n * It will display a feedback message that the conversation has been copied\n */\n @Method()\n async showCopyConversationMessage() {\n this.displayConversationCopiedMessage = true;\n setTimeout(() => {\n this.displayConversationCopiedMessage = false;\n }, 2000);\n }\n\n render() {\n const renderHeader = this.chatTitle || this.copyConversationCallback;\n return (\n <Host class=\"chat-container\">\n <ch-theme model={CSS_BUNDLES}></ch-theme>\n <section class=\"section\">\n {renderHeader && (\n <header class=\"chat-container__header elevation-1 body-italic-m\">\n {this.chatTitle && this.chatTitle}\n {this.copyConversationCallback && (\n <button\n class=\"button-secondary button-icon-only\"\n onClick={this.copyConversationCallback}\n >\n <ch-image\n class=\"icon-md\"\n src={COPY_ICON}\n onClick={this.copyConversationCallback}\n ></ch-image>\n </button>\n )}\n </header>\n )}\n <section class=\"chat-container__ch-chat\">\n <slot></slot>\n {this.displayConversationCopiedMessage && (\n <div class=\"chat-container__conversation-copied\">\n <div class=\"chat-container__conversation-copied-wrapper\">\n <ch-image class=\"icon-md\" src={CONVERSATION_ICON}></ch-image>\n <p class=\"body-regular-l\">conversation copied</p>\n </div>\n </div>\n )}\n </section>\n {/* <footer class=\"chat-container__footer elevation-1\">footer</footer> */}\n </section>\n </Host>\n );\n }\n}\n"],"mappings":";;;;;;AAAA,MAAMA,IAAmB;;ACGzB,MAAMC,IAA8B,EAClC,qBACA,oBACA,uBACA,qBACA,mBACA;;AAGF,MAAMC,IAAYC,EAAY;EAC5BC,UAAU;EACVC,MAAM;EACNC,WAAW;;;AAEb,MAAMC,IAAoBJ,EAAY;EACpCC,UAAU;EACVC,MAAM;;;MAQKG,IAAkB;;;;;4CAcwB;;;;SAMrD,iCAAMC;IACJC,KAAKC,mCAAmC;IACxCC,YAAW;MACTF,KAAKC,mCAAmC;AAAK,QAC5C;;EAGL,MAAAE;IACE,MAAMC,IAAeJ,KAAKK,aAAaL,KAAKM;IAC5C,OACEC,EAACC,GAAI;MAACC,OAAM;OACVF,EAAA;MAAUG,OAAOnB;QACjBgB,EAAA;MAASE,OAAM;OACZL,KACCG,EAAA;MAAQE,OAAM;OACXT,KAAKK,aAAaL,KAAKK,WACvBL,KAAKM,4BACJC,EAAA;MACEE,OAAM;MACNE,SAASX,KAAKM;OAEdC,EAAA;MACEE,OAAM;MACNG,KAAKpB;MACLmB,SAASX,KAAKM;UAMxBC,EAAA;MAASE,OAAM;OACbF,EAAA,eACCP,KAAKC,oCACJM,EAAA;MAAKE,OAAM;OACTF,EAAA;MAAKE,OAAM;OACTF,EAAA;MAAUE,OAAM;MAAUG,KAAKf;QAC/BU,EAAA;MAAGE,OAAM;OAAgB"}
|
|
1
|
+
{"version":3,"names":["chatContainerCss","CSS_BUNDLES","COPY_ICON","getIconPath","category","name","colorType","DELETE_ICON","CONVERSATION_ICON","GxIdeChatContainer","showCopyConversationMessage","this","displayConversationCopiedMessage","setTimeout","render","renderHeader","chatTitle","copyConversationCallback","deleteConversationCallback","renderButtonsGroup","h","Host","class","model","onClick","src"],"sources":["src/components/_helpers/chat-container/chat-container.scss?tag=gx-ide-chat-container","src/components/_helpers/chat-container/chat-container.tsx"],"sourcesContent":[".chat-container {\n display: grid;\n block-size: 100%;\n overflow: auto;\n grid-template-rows: max-content 1fr max-content;\n gap: var(--mer-spacing--xs);\n padding: var(--mer-spacing--xs);\n position: relative;\n --chat-common-border-radius: var(--mer-spacing--2xs);\n}\n.section {\n display: contents;\n}\n\n// header\n.chat-container__header {\n padding: var(--mer-spacing--2xs) var(--mer-spacing--2xs)\n var(--mer-spacing--2xs) var(--mer-spacing--sm);\n display: flex;\n align-items: center;\n gap: var(--mer-spacing--sm);\n justify-content: space-between;\n}\n\n// ch-chat container\n.chat-container__ch-chat {\n overflow: auto;\n position: relative;\n display: grid;\n}\n\n// footer\n\n// header & footer (common styles)\n.chat-container__header,\n.chat-container__footer {\n padding: var(--mer-spacing--2xs) var(--mer-spacing--2xs)\n var(--mer-spacing--2xs) var(--mer-spacing--sm);\n border-radius: var(--chat-common-border-radius);\n}\n\n.chat-container__conversation-copied {\n position: absolute;\n z-index: 1;\n inline-size: 100%;\n block-size: 100%;\n background: rgba(22, 22, 23, 0.75);\n backdrop-filter: saturate(180%) blur(20px);\n display: grid;\n align-items: center;\n justify-content: center;\n text-align: center;\n padding: 32px;\n --mer-icon__box--md: 18px;\n pointer-events: none;\n overflow: hidden;\n animation: fadeIn 100ms ease-in-out forwards;\n opacity: 0;\n}\n.chat-container__conversation-copied-wrapper {\n display: flex;\n align-items: center;\n gap: var(--mer-spacing--sm);\n}\n.chat-container__conversation-copied-wrapper {\n animation: liftUp var(--mer-timing--fast) ease-in-out forwards;\n inset-block-start: 4px;\n opacity: 0;\n animation-delay: var(--mer-timing--fast);\n position: relative;\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n@keyframes liftUp {\n from {\n opacity: 0;\n inset-block-start: 4px;\n }\n to {\n opacity: 1;\n inset-block-start: 0;\n }\n}\n\n// - - - - - - - - - - - - - - - - - - - - - - - - - -\n// ch-chat overrides TODO: move this styles to Mercury\n// - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n.chat::part(message) {\n position: relative;\n --copy-button-opacity: 0;\n --copied-to-clipboard-opacity: 0;\n --date-opacity: 1;\n}\n.chat::part(message__time),\n.chat::part(message__copy-button) {\n transition: opacity var(--mer-timing--super-fast) ease-in-out;\n}\n.chat::part(message__time) {\n opacity: var(--date-opacity);\n}\n.chat::part(message):hover {\n position: relative;\n --copy-button-opacity: 1;\n --date-opacity: 0;\n}\n.chat::part(message__copy-button) {\n position: absolute;\n z-index: 1;\n inset-inline-end: 0;\n padding: var(--mer-spacing--sm); // same as part::(message)\n transition: opacity var(--mer-timing--fast) ease-in-out;\n opacity: var(--copy-button-opacity);\n\n &::after {\n content: \"\";\n inline-size: var(--mer-icon__box--md);\n block-size: var(--mer-icon__box--md);\n background: no-repeat center / var(--mer-icon__size--md) var(--icon-path);\n --icon-path: var(--icon__system_copy_primary--enabled);\n }\n &:hover::after {\n --icon-path: var(--icon__system_copy_primary--hover);\n }\n &:active::after {\n --icon-path: var(--icon__system_copy_primary--active);\n }\n}\n\n// // copy button effect\n.chat::part(message__copied-feedback) {\n transition: opacity 150ms ease-in-out;\n position: absolute;\n inline-size: 100%;\n block-size: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 2;\n background: rgba(22, 22, 23, 0.8);\n backdrop-filter: saturate(180%) blur(20px);\n opacity: var(--copied-to-clipboard-opacity);\n pointer-events: none;\n}\n\n.chat::part(message__copied-feedback-visible) {\n --copied-to-clipboard-opacity: 1;\n pointer-events: visible;\n}\n\n// send button\n\n.chat::part(send-container) {\n gap: var(--mer-spacing--xs);\n}\n.chat::part(send-input) {\n --control__padding-block: 7px !important;\n}\n\n.chat::part(send-button) {\n border-width: var(--control__border-width);\n border-style: var(--control__border-style);\n border-color: var(--control__border-color);\n border-radius: var(--control__border-radius);\n inline-size: 32px;\n block-size: 32px;\n background: no-repeat center / var(--mer-icon__box--md) var(--icon-path);\n --icon-path: var(--icon__system_send_primary--enabled);\n}\n.chat::part(send-button):hover {\n --icon-path: var(--icon__system_send_primary--hover);\n --control__border-color: var(--mer-text__primary--hover);\n}\n.chat::part(send-button):active {\n --icon-path: var(--icon__system_send_primary--active);\n --control__border-color: var(--mer-border-color__primary--active);\n}\n","import { Component, Host, h, Prop, Method, State } from \"@stencil/core\";\nimport { MercuryBundles, getIconPath } from \"@genexus/mercury\";\n\nconst CSS_BUNDLES: MercuryBundles = [\n \"resets/box-sizing\",\n \"utils/typography\",\n \"chameleon/scrollbar\",\n \"components/button\",\n \"components/icon\",\n \"utils/elevation\"\n];\n\nconst COPY_ICON = getIconPath({\n category: \"system\",\n name: \"copy\",\n colorType: \"neutral\"\n});\nconst DELETE_ICON = getIconPath({\n category: \"system\",\n name: \"delete-outlined\",\n colorType: \"error\"\n});\nconst CONVERSATION_ICON = getIconPath({\n category: \"objects\",\n name: \"conversational-flows\"\n});\n\n@Component({\n tag: \"gx-ide-chat-container\",\n styleUrl: \"chat-container.scss\",\n shadow: false\n})\nexport class GxIdeChatContainer {\n /**\n * The chat title\n */\n @Prop() readonly chatTitle?: string;\n\n /**\n * If true a button for copying the conversation will be render on the header\n */\n @Prop() readonly copyConversationCallback: () => void;\n\n /**\n * If true a button for deleting the conversation will be render on the header\n */\n @Prop() readonly deleteConversationCallback: () => void;\n\n /**\n * Coneration Copied\n */\n @State() displayConversationCopiedMessage: boolean = false;\n\n /**\n * It will display a feedback message that the conversation has been copied\n */\n @Method()\n async showCopyConversationMessage() {\n this.displayConversationCopiedMessage = true;\n setTimeout(() => {\n this.displayConversationCopiedMessage = false;\n }, 2000);\n }\n\n render() {\n const renderHeader =\n this.chatTitle ||\n this.copyConversationCallback ||\n this.deleteConversationCallback;\n\n const renderButtonsGroup =\n this.copyConversationCallback || this.deleteConversationCallback;\n return (\n <Host class=\"chat-container\">\n <ch-theme model={CSS_BUNDLES}></ch-theme>\n <section class=\"section\">\n {renderHeader && (\n <header class=\"chat-container__header elevation-1 body-italic-m\">\n {this.chatTitle && this.chatTitle}\n\n {renderButtonsGroup && (\n <div class=\"buttons-spacer\">\n {this.deleteConversationCallback && (\n <button\n class=\"button-secondary button-icon-only\"\n onClick={this.deleteConversationCallback}\n >\n <ch-image class=\"icon-md\" src={DELETE_ICON}></ch-image>\n </button>\n )}\n\n {this.copyConversationCallback && (\n <button\n class=\"button-secondary button-icon-only\"\n onClick={this.copyConversationCallback}\n >\n <ch-image class=\"icon-md\" src={COPY_ICON}></ch-image>\n </button>\n )}\n </div>\n )}\n </header>\n )}\n <section class=\"chat-container__ch-chat\">\n <slot></slot>\n {this.displayConversationCopiedMessage && (\n <div class=\"chat-container__conversation-copied\">\n <div class=\"chat-container__conversation-copied-wrapper\">\n <ch-image class=\"icon-md\" src={CONVERSATION_ICON}></ch-image>\n <p class=\"body-regular-l\">conversation copied</p>\n </div>\n </div>\n )}\n </section>\n {/* <footer class=\"chat-container__footer elevation-1\">footer</footer> */}\n </section>\n </Host>\n );\n }\n}\n"],"mappings":";;;;;;AAAA,MAAMA,IAAmB;;ACGzB,MAAMC,IAA8B,EAClC,qBACA,oBACA,uBACA,qBACA,mBACA;;AAGF,MAAMC,IAAYC,EAAY;EAC5BC,UAAU;EACVC,MAAM;EACNC,WAAW;;;AAEb,MAAMC,IAAcJ,EAAY;EAC9BC,UAAU;EACVC,MAAM;EACNC,WAAW;;;AAEb,MAAME,IAAoBL,EAAY;EACpCC,UAAU;EACVC,MAAM;;;MAQKI,IAAkB;;;;;;4CAmBwB;;;;SAMrD,iCAAMC;IACJC,KAAKC,mCAAmC;IACxCC,YAAW;MACTF,KAAKC,mCAAmC;AAAK,QAC5C;;EAGL,MAAAE;IACE,MAAMC,IACJJ,KAAKK,aACLL,KAAKM,4BACLN,KAAKO;IAEP,MAAMC,IACJR,KAAKM,4BAA4BN,KAAKO;IACxC,OACEE,EAACC,GAAI;MAACC,OAAM;OACVF,EAAA;MAAUG,OAAOtB;QACjBmB,EAAA;MAASE,OAAM;OACZP,KACCK,EAAA;MAAQE,OAAM;OACXX,KAAKK,aAAaL,KAAKK,WAEvBG,KACCC,EAAA;MAAKE,OAAM;OACRX,KAAKO,8BACJE,EAAA;MACEE,OAAM;MACNE,SAASb,KAAKO;OAEdE,EAAA;MAAUE,OAAM;MAAUG,KAAKlB;SAIlCI,KAAKM,4BACJG,EAAA;MACEE,OAAM;MACNE,SAASb,KAAKM;OAEdG,EAAA;MAAUE,OAAM;MAAUG,KAAKvB;WAO3CkB,EAAA;MAASE,OAAM;OACbF,EAAA,eACCT,KAAKC,oCACJQ,EAAA;MAAKE,OAAM;OACTF,EAAA;MAAKE,OAAM;OACTF,EAAA;MAAUE,OAAM;MAAUG,KAAKjB;QAC/BY,EAAA;MAAGE,OAAM;OAAgB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { h as e } from "./p-49712340.js";
|
|
2
|
+
|
|
3
|
+
import "./p-ad5caf61.js";
|
|
4
|
+
|
|
5
|
+
const s = "message__copied-feedback";
|
|
6
|
+
|
|
7
|
+
const a = "message__copied-feedback-visible";
|
|
8
|
+
|
|
9
|
+
const copy = e => t => {
|
|
10
|
+
t.stopPropagation();
|
|
11
|
+
// 1. Copy message
|
|
12
|
+
navigator.clipboard.writeText(e);
|
|
13
|
+
// 2. Display "copied" message (expects to be the next sibling!)
|
|
14
|
+
const o = t.target.nextSibling;
|
|
15
|
+
const c = o.getAttribute("part");
|
|
16
|
+
if (c === s) {
|
|
17
|
+
o.setAttribute("part", `${s} ${a}`);
|
|
18
|
+
setTimeout((() => {
|
|
19
|
+
o.setAttribute("part", `${s}`);
|
|
20
|
+
}), 1e3);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const copyButton = (s, a, t) => e("button", {
|
|
25
|
+
"aria-label": a,
|
|
26
|
+
title: a,
|
|
27
|
+
class: "button-copy-code",
|
|
28
|
+
type: "button",
|
|
29
|
+
onClick: copy(s),
|
|
30
|
+
part: `message__copy-button ${t}`
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const mercuryCodeRender = s => a => e("div", {
|
|
34
|
+
class: "code-block-container"
|
|
35
|
+
}, e("div", {
|
|
36
|
+
class: "code-block-header"
|
|
37
|
+
}, copyButton(a.plainText, s, "code-render")), e("ch-code", {
|
|
38
|
+
language: a.language,
|
|
39
|
+
lastNestedChildClass: a.lastNestedChildClass,
|
|
40
|
+
value: a.plainText
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
const mercuryChatMessageRender = a => t => t.role === "assistant" && t.status === "waiting" ? [ e("span", {
|
|
44
|
+
part: "message__processing"
|
|
45
|
+
}, "Processing request"), e("div", {
|
|
46
|
+
class: "processing-animation",
|
|
47
|
+
part: "processing-animation"
|
|
48
|
+
}) ] : [
|
|
49
|
+
// "copy button" before "role" and "time" to hide both on button:focus
|
|
50
|
+
copyButton(t.content, "Copy code", "common-message"), e("p", {
|
|
51
|
+
part: s
|
|
52
|
+
}, "message copied to clipboard"), e("span", {
|
|
53
|
+
part: `message__role ${t.role}`
|
|
54
|
+
}, t.role === "user" ? "You" : "GeneXus Code Fixer"), e("time", {
|
|
55
|
+
dateTime: t.metadata,
|
|
56
|
+
part: "message__time"
|
|
57
|
+
}, t.metadata), t.role === "user" ? e("span", {
|
|
58
|
+
part: "message__content user"
|
|
59
|
+
}, t.content) : e("ch-markdown-viewer", {
|
|
60
|
+
part: t.role === "assistant" && (t.status === "complete" || !t.status) && !t.parts ? `message__content no-error` : "message__content",
|
|
61
|
+
theme: a,
|
|
62
|
+
showIndicator: false,
|
|
63
|
+
renderCode: mercuryCodeRender("Copy code"),
|
|
64
|
+
value: t.content
|
|
65
|
+
}) ];
|
|
66
|
+
|
|
67
|
+
export { mercuryCodeRender as a, mercuryChatMessageRender as m };
|
|
68
|
+
//# sourceMappingURL=p-f3f1e1f6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MESSAGE_COPIED_PART_SELECTOR","MESSAGE_COPIED_VISIBLE_PART_SELECTOR","copy","text","event","stopPropagation","navigator","clipboard","writeText","copiedFeedbackRef","target","nextSibling","copiedFeedbackPart","getAttribute","setAttribute","setTimeout","copyButton","textToCopy","accessibleName","additionalPart","h","title","class","type","onClick","part","mercuryCodeRender","copyButtonAccessibleName","options","plainText","language","lastNestedChildClass","value","mercuryChatMessageRender","theme","messageModel","role","status","content","dateTime","metadata","parts","showIndicator","renderCode"],"sources":["src/components/_helpers/chat-container/code-render.tsx"],"sourcesContent":["import { h } from \"@stencil/core\";\nimport {\n MarkdownViewerCodeRender,\n ChatMessageByRole\n} from \"@genexus/chameleon-controls-library\";\nimport { MarkdownViewerCodeRenderOptions } from \"@genexus/chameleon-controls-library/dist/types/components/markdown-viewer/parsers/types\";\nimport { getIconPath } from \"@genexus/mercury\";\ngetIconPath;\n\nconst MESSAGE_COPIED_PART_SELECTOR = \"message__copied-feedback\";\nconst MESSAGE_COPIED_VISIBLE_PART_SELECTOR = \"message__copied-feedback-visible\";\n\nconst copy = (text: string) => (event: Event) => {\n event.stopPropagation();\n\n // 1. Copy message\n navigator.clipboard.writeText(text);\n\n // 2. Display \"copied\" message (expects to be the next sibling!)\n const copiedFeedbackRef = (event.target as HTMLElement)\n .nextSibling as HTMLElement;\n const copiedFeedbackPart = copiedFeedbackRef.getAttribute(\"part\");\n if (copiedFeedbackPart === MESSAGE_COPIED_PART_SELECTOR) {\n copiedFeedbackRef.setAttribute(\n \"part\",\n `${MESSAGE_COPIED_PART_SELECTOR} ${MESSAGE_COPIED_VISIBLE_PART_SELECTOR}`\n );\n\n setTimeout(() => {\n copiedFeedbackRef.setAttribute(\"part\", `${MESSAGE_COPIED_PART_SELECTOR}`);\n }, 1000);\n }\n};\n\nconst copyButton = (\n textToCopy: string,\n accessibleName: string,\n additionalPart: string\n) => {\n return (\n <button\n aria-label={accessibleName}\n title={accessibleName}\n class=\"button-copy-code\"\n type=\"button\"\n onClick={copy(textToCopy)}\n part={`message__copy-button ${additionalPart}`}\n ></button>\n );\n};\n\nexport const mercuryCodeRender =\n (copyButtonAccessibleName: string) =>\n (options: MarkdownViewerCodeRenderOptions): MarkdownViewerCodeRender =>\n (\n <div class=\"code-block-container\">\n <div class=\"code-block-header\">\n {copyButton(\n options.plainText,\n copyButtonAccessibleName,\n \"code-render\"\n )}\n </div>\n <ch-code\n language={options.language}\n lastNestedChildClass={options.lastNestedChildClass}\n value={options.plainText}\n ></ch-code>\n </div>\n );\n\nexport const mercuryChatMessageRender =\n (theme: string) =>\n (messageModel: ChatMessageByRole<\"assistant\" | \"error\" | \"user\">) =>\n messageModel.role === \"assistant\" && messageModel.status === \"waiting\"\n ? [\n <span part=\"message__processing\">Processing request</span>,\n\n <div class=\"processing-animation\" part=\"processing-animation\"></div>\n ]\n : [\n // \"copy button\" before \"role\" and \"time\" to hide both on button:focus\n copyButton(\n messageModel.content as string,\n \"Copy code\",\n \"common-message\"\n ),\n <p part={MESSAGE_COPIED_PART_SELECTOR}>\n message copied to clipboard\n </p>,\n <span part={`message__role ${messageModel.role}`}>\n {messageModel.role === \"user\" ? \"You\" : \"GeneXus Code Fixer\"}\n </span>,\n <time dateTime={messageModel.metadata} part=\"message__time\">\n {messageModel.metadata}\n </time>,\n\n messageModel.role === \"user\" ? (\n <span part=\"message__content user\">{messageModel.content}</span>\n ) : (\n <ch-markdown-viewer\n part={\n messageModel.role === \"assistant\" &&\n (messageModel.status === \"complete\" || !messageModel.status) &&\n !messageModel.parts\n ? `message__content no-error`\n : \"message__content\"\n }\n theme={theme}\n showIndicator={false}\n renderCode={mercuryCodeRender(\"Copy code\")}\n value={messageModel.content as string}\n ></ch-markdown-viewer>\n )\n ];\n"],"mappings":";;;;AASA,MAAMA,IAA+B;;AACrC,MAAMC,IAAuC;;AAE7C,MAAMC,OAAQC,KAAkBC;EAC9BA,EAAMC;;IAGNC,UAAUC,UAAUC,UAAUL;;IAG9B,MAAMM,IAAqBL,EAAMM,OAC9BC;EACH,MAAMC,IAAqBH,EAAkBI,aAAa;EAC1D,IAAID,MAAuBZ,GAA8B;IACvDS,EAAkBK,aAChB,QACA,GAAGd,KAAgCC;IAGrCc,YAAW;MACTN,EAAkBK,aAAa,QAAQ,GAAGd;AAA+B,QACxE;;;;AAIP,MAAMgB,aAAa,CACjBC,GACAC,GACAC,MAGEC,EAAA;EAAA,cACcF;EACZG,OAAOH;EACPI,OAAM;EACNC,MAAK;EACLC,SAAStB,KAAKe;EACdQ,MAAM,wBAAwBN;;;MAKvBO,oBACVC,KACAC,KAEGR,EAAA;EAAKE,OAAM;GACTF,EAAA;EAAKE,OAAM;GACRN,WACCY,EAAQC,WACRF,GACA,iBAGJP,EAAA;EACEU,UAAUF,EAAQE;EAClBC,sBAAsBH,EAAQG;EAC9BC,OAAOJ,EAAQC;;;MAKZI,2BACVC,KACAC,KACCA,EAAaC,SAAS,eAAeD,EAAaE,WAAW,YACzD,EACEjB,EAAA;EAAMK,MAAK;GAAqB,uBAEhCL,EAAA;EAAKE,OAAM;EAAuBG,MAAK;OAEzC;;AAEET,WACEmB,EAAaG,SACb,aACA,mBAEFlB,EAAA;EAAGK,MAAMzB;GAA4B,gCAGrCoB,EAAA;EAAMK,MAAM,iBAAiBU,EAAaC;GACvCD,EAAaC,SAAS,SAAS,QAAQ,uBAE1ChB,EAAA;EAAMmB,UAAUJ,EAAaK;EAAUf,MAAK;GACzCU,EAAaK,WAGhBL,EAAaC,SAAS,SACpBhB,EAAA;EAAMK,MAAK;GAAyBU,EAAaG,WAEjDlB,EAAA;EACEK,MACEU,EAAaC,SAAS,gBACrBD,EAAaE,WAAW,eAAeF,EAAaE,YACpDF,EAAaM,QACV,8BACA;EAENP,OAAOA;EACPQ,eAAe;EACfC,YAAYjB,kBAAkB;EAC9BM,OAAOG,EAAaG"}
|
|
@@ -4,9 +4,13 @@ export declare class GxIdeChatContainer {
|
|
|
4
4
|
*/
|
|
5
5
|
readonly chatTitle?: string;
|
|
6
6
|
/**
|
|
7
|
-
* If true a button for copying the conversation will be render on the header
|
|
7
|
+
* If true a button for copying the conversation will be render on the header
|
|
8
8
|
*/
|
|
9
9
|
readonly copyConversationCallback: () => void;
|
|
10
|
+
/**
|
|
11
|
+
* If true a button for deleting the conversation will be render on the header
|
|
12
|
+
*/
|
|
13
|
+
readonly deleteConversationCallback: () => void;
|
|
10
14
|
/**
|
|
11
15
|
* Coneration Copied
|
|
12
16
|
*/
|
|
@@ -360,9 +360,13 @@ export namespace Components {
|
|
|
360
360
|
*/
|
|
361
361
|
"chatTitle"?: string;
|
|
362
362
|
/**
|
|
363
|
-
* If true a button for copying the conversation will be render on the header
|
|
363
|
+
* If true a button for copying the conversation will be render on the header
|
|
364
364
|
*/
|
|
365
365
|
"copyConversationCallback": () => void;
|
|
366
|
+
/**
|
|
367
|
+
* If true a button for deleting the conversation will be render on the header
|
|
368
|
+
*/
|
|
369
|
+
"deleteConversationCallback": () => void;
|
|
366
370
|
/**
|
|
367
371
|
* It will display a feedback message that the conversation has been copied
|
|
368
372
|
*/
|
|
@@ -3217,9 +3221,13 @@ declare namespace LocalJSX {
|
|
|
3217
3221
|
*/
|
|
3218
3222
|
"chatTitle"?: string;
|
|
3219
3223
|
/**
|
|
3220
|
-
* If true a button for copying the conversation will be render on the header
|
|
3224
|
+
* If true a button for copying the conversation will be render on the header
|
|
3221
3225
|
*/
|
|
3222
3226
|
"copyConversationCallback"?: () => void;
|
|
3227
|
+
/**
|
|
3228
|
+
* If true a button for deleting the conversation will be render on the header
|
|
3229
|
+
*/
|
|
3230
|
+
"deleteConversationCallback"?: () => void;
|
|
3223
3231
|
}
|
|
3224
3232
|
interface GxIdeConnectGxServer {
|
|
3225
3233
|
/**
|
package/dist/types/index.d.ts
CHANGED