@eko-ai/eko 3.1.2-alpha.2 → 3.1.3
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/agent/browser/build_dom_tree.d.ts.map +1 -1
- package/dist/index.cjs.js +16 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +16 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/types/llm.types.d.ts +1 -1
- package/dist/types/llm.types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -30742,6 +30742,15 @@ class RetryLanguageModel {
|
|
|
30742
30742
|
compatibility: llm.config?.compatibility,
|
|
30743
30743
|
}).languageModel(llm.model);
|
|
30744
30744
|
}
|
|
30745
|
+
else if (llm.provider == "modelscope") {
|
|
30746
|
+
return createOpenAICompatible({
|
|
30747
|
+
name: llm.config?.name || llm.model.split("/")[0],
|
|
30748
|
+
apiKey: apiKey,
|
|
30749
|
+
baseURL: baseURL || "https://api-inference.modelscope.cn/v1",
|
|
30750
|
+
fetch: llm.fetch,
|
|
30751
|
+
headers: llm.config?.headers,
|
|
30752
|
+
}).languageModel(llm.model);
|
|
30753
|
+
}
|
|
30745
30754
|
else {
|
|
30746
30755
|
return llm.provider.languageModel(llm.model);
|
|
30747
30756
|
}
|
|
@@ -35617,6 +35626,7 @@ function run_build_dom_tree() {
|
|
|
35617
35626
|
}
|
|
35618
35627
|
function build_dom_tree(markHighlightElements) {
|
|
35619
35628
|
let highlightIndex = 0; // Reset highlight index
|
|
35629
|
+
let duplicates = new Set();
|
|
35620
35630
|
function highlightElement(element, index, parentIframe = null) {
|
|
35621
35631
|
// Create or get highlight container
|
|
35622
35632
|
let container = document.getElementById('eko-highlight-container');
|
|
@@ -35983,8 +35993,10 @@ function run_build_dom_tree() {
|
|
|
35983
35993
|
}
|
|
35984
35994
|
// Function to traverse the DOM and create nested JSON
|
|
35985
35995
|
function buildDomTree(node, parentIframe = null) {
|
|
35986
|
-
if (!node)
|
|
35996
|
+
if (!node || duplicates.has(node)) {
|
|
35987
35997
|
return null;
|
|
35998
|
+
}
|
|
35999
|
+
duplicates.add(node);
|
|
35988
36000
|
// Special case for text nodes
|
|
35989
36001
|
if (node.nodeType === Node.TEXT_NODE) {
|
|
35990
36002
|
const textContent = node.textContent.trim();
|
|
@@ -36044,7 +36056,7 @@ function run_build_dom_tree() {
|
|
|
36044
36056
|
}
|
|
36045
36057
|
// Handle shadow DOM
|
|
36046
36058
|
if (node.shadowRoot) {
|
|
36047
|
-
const shadowChildren = Array.from(node.shadowRoot.
|
|
36059
|
+
const shadowChildren = Array.from(node.shadowRoot.children).map((child) => buildDomTree(child, parentIframe)).filter(child => child !== null);
|
|
36048
36060
|
nodeData.children.push(...shadowChildren);
|
|
36049
36061
|
}
|
|
36050
36062
|
// Handle iframes
|
|
@@ -36052,7 +36064,7 @@ function run_build_dom_tree() {
|
|
|
36052
36064
|
try {
|
|
36053
36065
|
const iframeDoc = node.contentDocument || node.contentWindow.document;
|
|
36054
36066
|
if (iframeDoc) {
|
|
36055
|
-
const iframeChildren = Array.from(iframeDoc.body.
|
|
36067
|
+
const iframeChildren = Array.from(iframeDoc.body.children).map((child) => buildDomTree(child, node)).filter(child => child !== null);
|
|
36056
36068
|
nodeData.children.push(...iframeChildren);
|
|
36057
36069
|
}
|
|
36058
36070
|
}
|
|
@@ -36062,7 +36074,7 @@ function run_build_dom_tree() {
|
|
|
36062
36074
|
}
|
|
36063
36075
|
else {
|
|
36064
36076
|
if (isElementExist(node)) {
|
|
36065
|
-
const children = Array.from(node.
|
|
36077
|
+
const children = Array.from(node.children).map((child) => buildDomTree(child, parentIframe)).filter(child => child !== null);
|
|
36066
36078
|
nodeData.children.push(...children);
|
|
36067
36079
|
}
|
|
36068
36080
|
}
|