@genexus/genexus-ide-ui 1.0.49 → 1.0.51
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/assets-manager-7227a74b.js.map +1 -1
- package/dist/cjs/code-render-a496a55b.js +50 -0
- package/dist/cjs/code-render-a496a55b.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 +13 -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/components/_helpers/chat-container/code-render.js +3 -3
- package/dist/collection/components/_helpers/chat-container/code-render.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 +14 -4
- 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 +16 -47
- 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/assets-manager-0d129105.js.map +1 -1
- package/dist/esm/code-render-89a0d3ef.js +47 -0
- package/dist/esm/code-render-89a0d3ef.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 +14 -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-6e4208d8.js.map +1 -1
- package/dist/genexus-ide-ui/p-732941de.js +68 -0
- package/dist/genexus-ide-ui/p-732941de.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-72867329.entry.js → p-dd6bbdd5.entry.js} +49 -99
- package/dist/genexus-ide-ui/p-dd6bbdd5.entry.js.map +1 -0
- package/dist/types/components/_helpers/chat-container/chat-container.d.ts +5 -1
- package/dist/types/components/_helpers/chat-container/code-render.d.ts +1 -1
- package/dist/types/components.d.ts +10 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/showcase/chat-container/chat.showcase.d.ts +2 -0
- package/package.json +3 -3
- package/dist/genexus-ide-ui/p-72867329.entry.js.map +0 -1
|
@@ -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-732941de.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,75 @@ 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;
|
|
193
|
+
this.assistantStatus = "Getting Data";
|
|
194
|
+
}
|
|
195
|
+
componentDidLoad() {
|
|
196
|
+
setTimeout((() => {
|
|
197
|
+
this.assistantStatus = "Creating Data Base..";
|
|
198
|
+
}), 1e3);
|
|
250
199
|
}
|
|
251
200
|
render() {
|
|
252
|
-
return
|
|
201
|
+
return t(n, null, t("ch-theme", {
|
|
253
202
|
model: w
|
|
254
|
-
}),
|
|
203
|
+
}), t("gx-ide-chat-container", {
|
|
255
204
|
chatTitle: "GeneXus Assistant",
|
|
256
|
-
copyConversationCallback:
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
205
|
+
copyConversationCallback: m(this, g, "f"),
|
|
206
|
+
deleteConversationCallback: m(this, f, "f"),
|
|
207
|
+
ref: e => u(this, p, e, "f")
|
|
208
|
+
}, t("ch-chat", {
|
|
209
|
+
callbacks: c,
|
|
260
210
|
class: "chat",
|
|
261
211
|
generatingResponse: false,
|
|
262
212
|
loadingState: "all-records-loaded",
|
|
263
213
|
markdownTheme: "mercury/markdown-viewer",
|
|
264
|
-
renderItem:
|
|
214
|
+
renderItem: a("mercury/markdown-viewer", "Bruno", "Gx Assistant", this.assistantStatus),
|
|
265
215
|
isMobile: false,
|
|
266
|
-
items:
|
|
216
|
+
items: l,
|
|
267
217
|
showAdditionalContent: this.showAdditionalContent,
|
|
268
|
-
translations:
|
|
269
|
-
},
|
|
218
|
+
translations: d
|
|
219
|
+
}, t("div", {
|
|
270
220
|
slot: "additional-content"
|
|
271
221
|
}, "Custom content that is rendered when the chat renders content"))));
|
|
272
222
|
}
|
|
273
223
|
};
|
|
274
224
|
|
|
275
|
-
g = new WeakMap, f = new WeakMap;
|
|
225
|
+
p = new WeakMap, g = new WeakMap, f = new WeakMap;
|
|
276
226
|
|
|
277
|
-
y.style =
|
|
227
|
+
y.style = h;
|
|
278
228
|
|
|
279
229
|
export { y as gx_ide_sc_chat_container };
|
|
280
|
-
//# sourceMappingURL=p-
|
|
230
|
+
//# sourceMappingURL=p-dd6bbdd5.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","componentDidLoad","assistantStatus","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 @State() assistantStatus: string = \"Getting Data\";\n\n #copyConversationCallbackHandler = () => {\n this.#chatContainerRef.showCopyConversationMessage();\n };\n\n #deleteConversationCallbackHandler = () => {\n console.log(\"delete messages\");\n };\n\n componentDidLoad() {\n setTimeout(() => {\n this.assistantStatus = \"Creating Data Base..\";\n }, 1000);\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(\n \"mercury/markdown-viewer\",\n \"Bruno\",\n \"Gx Assistant\",\n this.assistantStatus\n )}\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,IA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C;MACjCE,EAAAF,MAAIF,GAAA,KAAmBK;AAA6B;IAGtDC,EAAAL,IAAAC,OAAqC;MACnCK,QAAQC,IAAI;AAAkB;iCATU;8BACH;2BACJ;;EAUnC,gBAAAC;IACEvD,YAAW;MACTgD,KAAKQ,kBAAkB;AAAsB,QAC5C;;EAGL,MAAAC;IACE,OACEC,EAACC,GAAI,MACHD,EAAA;MAAUE,OAAOhB;QACjBc,EAAA;MACEG,WAAU;MACVC,0BAA0BZ,EAAAF,MAAIC,GAAA;MAC9Bc,4BAA4Bb,EAAAF,MAAII,GAAA;MAChCY,KAAKC,KACFC,EAAAlB,MAAIF,GAAqBmB,GAAmC;OAG/DP,EAAA;MACES,WAAWrD;MACXsD,OAAM;MACNC,oBAAoB;MACpBC,cAAa;MACbC,eAAc;MACdC,YAAYC,EACV,2BACA,SACA,gBACAzB,KAAKQ;MAEPkB,UAAU;MACVC,OAAOnC;MACPoC,uBAAuB5B,KAAK4B;MAC5BC,cAAcxD;OAEdqC,EAAA;MAAKoB,MAAK;OAAoB"}
|
|
@@ -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
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { MarkdownViewerCodeRender, ChatMessageByRole } from "@genexus/chameleon-controls-library";
|
|
2
2
|
import { MarkdownViewerCodeRenderOptions } from "@genexus/chameleon-controls-library/dist/types/components/markdown-viewer/parsers/types";
|
|
3
3
|
export declare const mercuryCodeRender: (copyButtonAccessibleName: string) => (options: MarkdownViewerCodeRenderOptions) => MarkdownViewerCodeRender;
|
|
4
|
-
export declare const mercuryChatMessageRender: (theme: string) => (messageModel: ChatMessageByRole<"assistant" | "error" | "user">) => any[];
|
|
4
|
+
export declare const mercuryChatMessageRender: (theme: string, userName?: string, assistantName?: string, assistantTaskDescription?: string) => (messageModel: ChatMessageByRole<"assistant" | "error" | "user">) => any[];
|
|
@@ -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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genexus/genexus-ide-ui",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.51",
|
|
5
5
|
"description": "GeneXus IDE UI components",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@genexus/chameleon-controls-library": "~6.2.0",
|
|
38
38
|
"@genexus/gemini": "*2.0.1",
|
|
39
|
-
"@genexus/mercury": "*0.
|
|
39
|
+
"@genexus/mercury": "*0.19.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@genexus/chameleon-controls-library": "~6.2.0",
|
|
43
43
|
"@genexus/gemini": "*2.0.1",
|
|
44
|
-
"@genexus/mercury": "*0.
|
|
44
|
+
"@genexus/mercury": "*0.19.1",
|
|
45
45
|
"@stencil-community/eslint-plugin": "~0.7.1",
|
|
46
46
|
"@stencil/core": "~4.9.0",
|
|
47
47
|
"@stencil/sass": "~1.4.0",
|
|
@@ -1 +0,0 @@
|
|
|
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","PROCESSING_PLACEHOLDER","timeOut","ASSISTANT_RESPONSE_MARKDOWN","ASSISTANT_RESPONSE_SHORT_MARKDOWN","sendChatToLLM","chatRef","document","querySelector","addNewMessage","id","Date","getTime","updateLastMessage","dummyStreaming","counter","stringToDisplay","mode","streamingCompleted","length","message","substring","files","url","caption","undefined","chatCallbacks","clear","Promise","resolve","uploadImage","stopGeneratingAnswer","clearTimeout","chatTranslations","clearChat","copyResponseButton","downloadCodeButton","imagePicker","removeUploadedImage","sendButton","sendInput","stopGeneratingAnswerButton","placeholder","copyCodeButton","processing","sourceFiles","Array","from","_","index","codeFixerRecord","chatShowcaseCss","CSS_BUNDLES","GxIdeScChatContainer","_GxIdeScChatContainer_chatContainerRef","set","this","_GxIdeScChatContainer_copyConversationCallbackHandler","__classPrivateFieldGet","showCopyConversationMessage","render","Host","model","chatTitle","copyConversationCallback","ref","el","__classPrivateFieldSet","callbacks","generatingResponse","loadingState","markdownTheme","renderItem","isMobile","items","showAdditionalContent","translations","slot"],"sources":["src/components/_helpers/chat-container/code-render.tsx","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 { 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","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 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 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":";;;;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;;;AAK7B,MAAMO,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;;;AAKlB,MAAMI,2BACVC,KACAC,KACCA,EAAaC,SAAS,eAAeD,EAAaE,WAAW,YACzD,EACEjB,EAAA;EAAMK,MAAK;GAAqB,uBAEhCL,EA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