ide-assi 0.52.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.cjs.js +40 -17
- package/dist/bundle.esm.js +40 -17
- package/dist/components/ideAssi.js +24 -1
- package/package.json +1 -1
- package/src/components/ideAssi.js +24 -1
package/dist/bundle.cjs.js
CHANGED
|
@@ -151580,7 +151580,7 @@ function createToolConfig(genAITools, extra) {
|
|
|
151580
151580
|
*
|
|
151581
151581
|
* <br />
|
|
151582
151582
|
*/
|
|
151583
|
-
class ChatGoogleGenerativeAI extends BaseChatModel {
|
|
151583
|
+
let ChatGoogleGenerativeAI$1 = class ChatGoogleGenerativeAI extends BaseChatModel {
|
|
151584
151584
|
static lc_name() {
|
|
151585
151585
|
return "ChatGoogleGenerativeAI";
|
|
151586
151586
|
}
|
|
@@ -152034,7 +152034,7 @@ class ChatGoogleGenerativeAI extends BaseChatModel {
|
|
|
152034
152034
|
runName: "StructuredOutputRunnable",
|
|
152035
152035
|
});
|
|
152036
152036
|
}
|
|
152037
|
-
}
|
|
152037
|
+
};
|
|
152038
152038
|
|
|
152039
152039
|
/**
|
|
152040
152040
|
* An abstract class that provides methods for embedding documents and
|
|
@@ -152915,7 +152915,7 @@ var __publicField = (obj, key, value) => {
|
|
|
152915
152915
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
152916
152916
|
return value;
|
|
152917
152917
|
};
|
|
152918
|
-
let Ollama$1 = class Ollama {
|
|
152918
|
+
let Ollama$1$1 = class Ollama {
|
|
152919
152919
|
constructor(config) {
|
|
152920
152920
|
__publicField(this, "config");
|
|
152921
152921
|
__publicField(this, "fetch");
|
|
@@ -153154,7 +153154,7 @@ let Ollama$1 = class Ollama {
|
|
|
153154
153154
|
return await response.json();
|
|
153155
153155
|
}
|
|
153156
153156
|
};
|
|
153157
|
-
new Ollama$1();
|
|
153157
|
+
new Ollama$1$1();
|
|
153158
153158
|
|
|
153159
153159
|
class OllamaEmbeddings extends Embeddings$1 {
|
|
153160
153160
|
constructor(fields) {
|
|
@@ -153195,7 +153195,7 @@ class OllamaEmbeddings extends Embeddings$1 {
|
|
|
153195
153195
|
writable: true,
|
|
153196
153196
|
value: false
|
|
153197
153197
|
});
|
|
153198
|
-
this.client = new Ollama$1({
|
|
153198
|
+
this.client = new Ollama$1$1({
|
|
153199
153199
|
fetch: fields?.fetch,
|
|
153200
153200
|
host: fields?.baseUrl,
|
|
153201
153201
|
headers: fields?.headers ? new Headers(fields.headers) : undefined,
|
|
@@ -153669,7 +153669,7 @@ class LLM extends BaseLLM {
|
|
|
153669
153669
|
* console.log(chunks.join(""));
|
|
153670
153670
|
* ```
|
|
153671
153671
|
*/
|
|
153672
|
-
class Ollama extends LLM {
|
|
153672
|
+
let Ollama$1 = class Ollama extends LLM {
|
|
153673
153673
|
static lc_name() {
|
|
153674
153674
|
return "Ollama";
|
|
153675
153675
|
}
|
|
@@ -153883,7 +153883,7 @@ class Ollama extends LLM {
|
|
|
153883
153883
|
this.baseUrl = fields?.baseUrl?.endsWith("/")
|
|
153884
153884
|
? fields?.baseUrl.slice(0, -1)
|
|
153885
153885
|
: fields?.baseUrl ?? this.baseUrl;
|
|
153886
|
-
this.client = new Ollama$1({
|
|
153886
|
+
this.client = new Ollama$1$1({
|
|
153887
153887
|
fetch: fields?.fetch,
|
|
153888
153888
|
host: this.baseUrl,
|
|
153889
153889
|
headers: fields?.headers,
|
|
@@ -154004,7 +154004,7 @@ class Ollama extends LLM {
|
|
|
154004
154004
|
}
|
|
154005
154005
|
return chunks.join("");
|
|
154006
154006
|
}
|
|
154007
|
-
}
|
|
154007
|
+
};
|
|
154008
154008
|
|
|
154009
154009
|
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
154010
154010
|
if (typeof state === "function" ? receiver !== state || true : !state.has(receiver))
|
|
@@ -163599,7 +163599,7 @@ function isReasoningModel(model) {
|
|
|
163599
163599
|
*
|
|
163600
163600
|
* <br />
|
|
163601
163601
|
*/
|
|
163602
|
-
class ChatOpenAI extends BaseChatModel {
|
|
163602
|
+
let ChatOpenAI$1 = class ChatOpenAI extends BaseChatModel {
|
|
163603
163603
|
static lc_name() {
|
|
163604
163604
|
return "ChatOpenAI";
|
|
163605
163605
|
}
|
|
@@ -164956,7 +164956,7 @@ class ChatOpenAI extends BaseChatModel {
|
|
|
164956
164956
|
});
|
|
164957
164957
|
return RunnableSequence.from([{ raw: llm }, parsedWithFallback]);
|
|
164958
164958
|
}
|
|
164959
|
-
}
|
|
164959
|
+
};
|
|
164960
164960
|
function isStructuredOutputMethodParams(x
|
|
164961
164961
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
164962
164962
|
) {
|
|
@@ -189632,7 +189632,7 @@ const ClientVersion = {
|
|
|
189632
189632
|
},
|
|
189633
189633
|
};
|
|
189634
189634
|
|
|
189635
|
-
class QdrantClient {
|
|
189635
|
+
let QdrantClient$1 = class QdrantClient {
|
|
189636
189636
|
constructor({ url, host, apiKey, https, prefix, port = 6333, timeout = 300000, checkCompatibility = true, ...args } = {}) {
|
|
189637
189637
|
this._https = https ?? typeof apiKey === 'string';
|
|
189638
189638
|
this._scheme = this._https ? 'https' : 'http';
|
|
@@ -191220,7 +191220,7 @@ class QdrantClient {
|
|
|
191220
191220
|
});
|
|
191221
191221
|
return maybe(response.data.result).orThrow('Search points matrix offsets returned empty');
|
|
191222
191222
|
}
|
|
191223
|
-
}
|
|
191223
|
+
};
|
|
191224
191224
|
|
|
191225
191225
|
// Default generic "any" values are for backwards compatibility.
|
|
191226
191226
|
// Replace with "string" when we are comfortable with a breaking change.
|
|
@@ -192721,21 +192721,21 @@ class aiContainer extends HTMLElement
|
|
|
192721
192721
|
switch (this.settings.server) {
|
|
192722
192722
|
case "gemini":
|
|
192723
192723
|
console.log(this.settings.geminiApiKey);
|
|
192724
|
-
this.#model = new ChatGoogleGenerativeAI({ model: this.settings.model, apiKey: this.settings.geminiApiKey, temperature: 0,});
|
|
192724
|
+
this.#model = new ChatGoogleGenerativeAI$1({ model: this.settings.model, apiKey: this.settings.geminiApiKey, temperature: 0,});
|
|
192725
192725
|
break;
|
|
192726
192726
|
case "openai":
|
|
192727
192727
|
console.log(this.settings.openaiApiKey);
|
|
192728
|
-
this.#model = new ChatOpenAI({ model: this.settings.model, apiKey: this.settings.openaiApiKey, temperature: 0, });
|
|
192728
|
+
this.#model = new ChatOpenAI$1({ model: this.settings.model, apiKey: this.settings.openaiApiKey, temperature: 0, });
|
|
192729
192729
|
break;
|
|
192730
192730
|
case "ollama":
|
|
192731
|
-
this.#model = new Ollama({
|
|
192731
|
+
this.#model = new Ollama$1({
|
|
192732
192732
|
model: this.settings.model,
|
|
192733
192733
|
host: this.settings.ollamaUrl,
|
|
192734
192734
|
});
|
|
192735
192735
|
break;
|
|
192736
192736
|
}
|
|
192737
192737
|
|
|
192738
|
-
this.#qdrantClient = new QdrantClient({ url: this.settings.qdrantUrl });
|
|
192738
|
+
this.#qdrantClient = new QdrantClient$1({ url: this.settings.qdrantUrl });
|
|
192739
192739
|
};
|
|
192740
192740
|
|
|
192741
192741
|
#getColumnInfo = () => {
|
|
@@ -193405,8 +193405,9 @@ class IdeAi
|
|
|
193405
193405
|
|
|
193406
193406
|
class IdeAssi extends HTMLElement
|
|
193407
193407
|
{
|
|
193408
|
-
#ai;
|
|
193409
193408
|
#ing = false;
|
|
193409
|
+
#ai;
|
|
193410
|
+
#model;
|
|
193410
193411
|
|
|
193411
193412
|
settings;
|
|
193412
193413
|
|
|
@@ -193468,7 +193469,27 @@ class IdeAssi extends HTMLElement
|
|
|
193468
193469
|
};
|
|
193469
193470
|
|
|
193470
193471
|
|
|
193472
|
+
#createModel = () => {
|
|
193471
193473
|
|
|
193474
|
+
switch (this.settings.server) {
|
|
193475
|
+
case "gemini":
|
|
193476
|
+
console.log(this.settings.geminiApiKey);
|
|
193477
|
+
this.#model = new ChatGoogleGenerativeAI({ model: this.settings.model, apiKey: this.settings.geminiApiKey, temperature: 0,});
|
|
193478
|
+
break;
|
|
193479
|
+
case "openai":
|
|
193480
|
+
console.log(this.settings.openaiApiKey);
|
|
193481
|
+
this.#model = new ChatOpenAI({ model: this.settings.model, apiKey: this.settings.openaiApiKey, temperature: 0, });
|
|
193482
|
+
break;
|
|
193483
|
+
case "ollama":
|
|
193484
|
+
this.#model = new Ollama({
|
|
193485
|
+
model: this.settings.model,
|
|
193486
|
+
host: this.settings.ollamaUrl,
|
|
193487
|
+
});
|
|
193488
|
+
break;
|
|
193489
|
+
}
|
|
193490
|
+
|
|
193491
|
+
this.#qdrantClient = new QdrantClient({ url: this.settings.qdrantUrl });
|
|
193492
|
+
};
|
|
193472
193493
|
|
|
193473
193494
|
#keydownHandler = async (e) => {
|
|
193474
193495
|
if (e.key !== "Enter") return;
|
|
@@ -193495,6 +193516,8 @@ class IdeAssi extends HTMLElement
|
|
|
193495
193516
|
elAiChat.add("ing", "...");
|
|
193496
193517
|
|
|
193497
193518
|
try {
|
|
193519
|
+
this.#createModel();
|
|
193520
|
+
|
|
193498
193521
|
const r = await this.#ai.generateSource(question);
|
|
193499
193522
|
console.log(r);
|
|
193500
193523
|
elAiChat.add("ai", r);
|
package/dist/bundle.esm.js
CHANGED
|
@@ -151576,7 +151576,7 @@ function createToolConfig(genAITools, extra) {
|
|
|
151576
151576
|
*
|
|
151577
151577
|
* <br />
|
|
151578
151578
|
*/
|
|
151579
|
-
class ChatGoogleGenerativeAI extends BaseChatModel {
|
|
151579
|
+
let ChatGoogleGenerativeAI$1 = class ChatGoogleGenerativeAI extends BaseChatModel {
|
|
151580
151580
|
static lc_name() {
|
|
151581
151581
|
return "ChatGoogleGenerativeAI";
|
|
151582
151582
|
}
|
|
@@ -152030,7 +152030,7 @@ class ChatGoogleGenerativeAI extends BaseChatModel {
|
|
|
152030
152030
|
runName: "StructuredOutputRunnable",
|
|
152031
152031
|
});
|
|
152032
152032
|
}
|
|
152033
|
-
}
|
|
152033
|
+
};
|
|
152034
152034
|
|
|
152035
152035
|
/**
|
|
152036
152036
|
* An abstract class that provides methods for embedding documents and
|
|
@@ -152911,7 +152911,7 @@ var __publicField = (obj, key, value) => {
|
|
|
152911
152911
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
152912
152912
|
return value;
|
|
152913
152913
|
};
|
|
152914
|
-
let Ollama$1 = class Ollama {
|
|
152914
|
+
let Ollama$1$1 = class Ollama {
|
|
152915
152915
|
constructor(config) {
|
|
152916
152916
|
__publicField(this, "config");
|
|
152917
152917
|
__publicField(this, "fetch");
|
|
@@ -153150,7 +153150,7 @@ let Ollama$1 = class Ollama {
|
|
|
153150
153150
|
return await response.json();
|
|
153151
153151
|
}
|
|
153152
153152
|
};
|
|
153153
|
-
new Ollama$1();
|
|
153153
|
+
new Ollama$1$1();
|
|
153154
153154
|
|
|
153155
153155
|
class OllamaEmbeddings extends Embeddings$1 {
|
|
153156
153156
|
constructor(fields) {
|
|
@@ -153191,7 +153191,7 @@ class OllamaEmbeddings extends Embeddings$1 {
|
|
|
153191
153191
|
writable: true,
|
|
153192
153192
|
value: false
|
|
153193
153193
|
});
|
|
153194
|
-
this.client = new Ollama$1({
|
|
153194
|
+
this.client = new Ollama$1$1({
|
|
153195
153195
|
fetch: fields?.fetch,
|
|
153196
153196
|
host: fields?.baseUrl,
|
|
153197
153197
|
headers: fields?.headers ? new Headers(fields.headers) : undefined,
|
|
@@ -153665,7 +153665,7 @@ class LLM extends BaseLLM {
|
|
|
153665
153665
|
* console.log(chunks.join(""));
|
|
153666
153666
|
* ```
|
|
153667
153667
|
*/
|
|
153668
|
-
class Ollama extends LLM {
|
|
153668
|
+
let Ollama$1 = class Ollama extends LLM {
|
|
153669
153669
|
static lc_name() {
|
|
153670
153670
|
return "Ollama";
|
|
153671
153671
|
}
|
|
@@ -153879,7 +153879,7 @@ class Ollama extends LLM {
|
|
|
153879
153879
|
this.baseUrl = fields?.baseUrl?.endsWith("/")
|
|
153880
153880
|
? fields?.baseUrl.slice(0, -1)
|
|
153881
153881
|
: fields?.baseUrl ?? this.baseUrl;
|
|
153882
|
-
this.client = new Ollama$1({
|
|
153882
|
+
this.client = new Ollama$1$1({
|
|
153883
153883
|
fetch: fields?.fetch,
|
|
153884
153884
|
host: this.baseUrl,
|
|
153885
153885
|
headers: fields?.headers,
|
|
@@ -154000,7 +154000,7 @@ class Ollama extends LLM {
|
|
|
154000
154000
|
}
|
|
154001
154001
|
return chunks.join("");
|
|
154002
154002
|
}
|
|
154003
|
-
}
|
|
154003
|
+
};
|
|
154004
154004
|
|
|
154005
154005
|
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
154006
154006
|
if (typeof state === "function" ? receiver !== state || true : !state.has(receiver))
|
|
@@ -163595,7 +163595,7 @@ function isReasoningModel(model) {
|
|
|
163595
163595
|
*
|
|
163596
163596
|
* <br />
|
|
163597
163597
|
*/
|
|
163598
|
-
class ChatOpenAI extends BaseChatModel {
|
|
163598
|
+
let ChatOpenAI$1 = class ChatOpenAI extends BaseChatModel {
|
|
163599
163599
|
static lc_name() {
|
|
163600
163600
|
return "ChatOpenAI";
|
|
163601
163601
|
}
|
|
@@ -164952,7 +164952,7 @@ class ChatOpenAI extends BaseChatModel {
|
|
|
164952
164952
|
});
|
|
164953
164953
|
return RunnableSequence.from([{ raw: llm }, parsedWithFallback]);
|
|
164954
164954
|
}
|
|
164955
|
-
}
|
|
164955
|
+
};
|
|
164956
164956
|
function isStructuredOutputMethodParams(x
|
|
164957
164957
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
164958
164958
|
) {
|
|
@@ -189628,7 +189628,7 @@ const ClientVersion = {
|
|
|
189628
189628
|
},
|
|
189629
189629
|
};
|
|
189630
189630
|
|
|
189631
|
-
class QdrantClient {
|
|
189631
|
+
let QdrantClient$1 = class QdrantClient {
|
|
189632
189632
|
constructor({ url, host, apiKey, https, prefix, port = 6333, timeout = 300000, checkCompatibility = true, ...args } = {}) {
|
|
189633
189633
|
this._https = https ?? typeof apiKey === 'string';
|
|
189634
189634
|
this._scheme = this._https ? 'https' : 'http';
|
|
@@ -191216,7 +191216,7 @@ class QdrantClient {
|
|
|
191216
191216
|
});
|
|
191217
191217
|
return maybe(response.data.result).orThrow('Search points matrix offsets returned empty');
|
|
191218
191218
|
}
|
|
191219
|
-
}
|
|
191219
|
+
};
|
|
191220
191220
|
|
|
191221
191221
|
// Default generic "any" values are for backwards compatibility.
|
|
191222
191222
|
// Replace with "string" when we are comfortable with a breaking change.
|
|
@@ -192717,21 +192717,21 @@ class aiContainer extends HTMLElement
|
|
|
192717
192717
|
switch (this.settings.server) {
|
|
192718
192718
|
case "gemini":
|
|
192719
192719
|
console.log(this.settings.geminiApiKey);
|
|
192720
|
-
this.#model = new ChatGoogleGenerativeAI({ model: this.settings.model, apiKey: this.settings.geminiApiKey, temperature: 0,});
|
|
192720
|
+
this.#model = new ChatGoogleGenerativeAI$1({ model: this.settings.model, apiKey: this.settings.geminiApiKey, temperature: 0,});
|
|
192721
192721
|
break;
|
|
192722
192722
|
case "openai":
|
|
192723
192723
|
console.log(this.settings.openaiApiKey);
|
|
192724
|
-
this.#model = new ChatOpenAI({ model: this.settings.model, apiKey: this.settings.openaiApiKey, temperature: 0, });
|
|
192724
|
+
this.#model = new ChatOpenAI$1({ model: this.settings.model, apiKey: this.settings.openaiApiKey, temperature: 0, });
|
|
192725
192725
|
break;
|
|
192726
192726
|
case "ollama":
|
|
192727
|
-
this.#model = new Ollama({
|
|
192727
|
+
this.#model = new Ollama$1({
|
|
192728
192728
|
model: this.settings.model,
|
|
192729
192729
|
host: this.settings.ollamaUrl,
|
|
192730
192730
|
});
|
|
192731
192731
|
break;
|
|
192732
192732
|
}
|
|
192733
192733
|
|
|
192734
|
-
this.#qdrantClient = new QdrantClient({ url: this.settings.qdrantUrl });
|
|
192734
|
+
this.#qdrantClient = new QdrantClient$1({ url: this.settings.qdrantUrl });
|
|
192735
192735
|
};
|
|
192736
192736
|
|
|
192737
192737
|
#getColumnInfo = () => {
|
|
@@ -193401,8 +193401,9 @@ class IdeAi
|
|
|
193401
193401
|
|
|
193402
193402
|
class IdeAssi extends HTMLElement
|
|
193403
193403
|
{
|
|
193404
|
-
#ai;
|
|
193405
193404
|
#ing = false;
|
|
193405
|
+
#ai;
|
|
193406
|
+
#model;
|
|
193406
193407
|
|
|
193407
193408
|
settings;
|
|
193408
193409
|
|
|
@@ -193464,7 +193465,27 @@ class IdeAssi extends HTMLElement
|
|
|
193464
193465
|
};
|
|
193465
193466
|
|
|
193466
193467
|
|
|
193468
|
+
#createModel = () => {
|
|
193467
193469
|
|
|
193470
|
+
switch (this.settings.server) {
|
|
193471
|
+
case "gemini":
|
|
193472
|
+
console.log(this.settings.geminiApiKey);
|
|
193473
|
+
this.#model = new ChatGoogleGenerativeAI({ model: this.settings.model, apiKey: this.settings.geminiApiKey, temperature: 0,});
|
|
193474
|
+
break;
|
|
193475
|
+
case "openai":
|
|
193476
|
+
console.log(this.settings.openaiApiKey);
|
|
193477
|
+
this.#model = new ChatOpenAI({ model: this.settings.model, apiKey: this.settings.openaiApiKey, temperature: 0, });
|
|
193478
|
+
break;
|
|
193479
|
+
case "ollama":
|
|
193480
|
+
this.#model = new Ollama({
|
|
193481
|
+
model: this.settings.model,
|
|
193482
|
+
host: this.settings.ollamaUrl,
|
|
193483
|
+
});
|
|
193484
|
+
break;
|
|
193485
|
+
}
|
|
193486
|
+
|
|
193487
|
+
this.#qdrantClient = new QdrantClient({ url: this.settings.qdrantUrl });
|
|
193488
|
+
};
|
|
193468
193489
|
|
|
193469
193490
|
#keydownHandler = async (e) => {
|
|
193470
193491
|
if (e.key !== "Enter") return;
|
|
@@ -193491,6 +193512,8 @@ class IdeAssi extends HTMLElement
|
|
|
193491
193512
|
elAiChat.add("ing", "...");
|
|
193492
193513
|
|
|
193493
193514
|
try {
|
|
193515
|
+
this.#createModel();
|
|
193516
|
+
|
|
193494
193517
|
const r = await this.#ai.generateSource(question);
|
|
193495
193518
|
console.log(r);
|
|
193496
193519
|
elAiChat.add("ai", r);
|
|
@@ -3,8 +3,9 @@ import { IdeAi } from "./ideAi.js";
|
|
|
3
3
|
|
|
4
4
|
export class IdeAssi extends HTMLElement
|
|
5
5
|
{
|
|
6
|
-
#ai;
|
|
7
6
|
#ing = false;
|
|
7
|
+
#ai;
|
|
8
|
+
#model;
|
|
8
9
|
|
|
9
10
|
settings;
|
|
10
11
|
|
|
@@ -66,7 +67,27 @@ export class IdeAssi extends HTMLElement
|
|
|
66
67
|
};
|
|
67
68
|
|
|
68
69
|
|
|
70
|
+
#createModel = () => {
|
|
71
|
+
|
|
72
|
+
switch (this.settings.server) {
|
|
73
|
+
case "gemini":
|
|
74
|
+
console.log(this.settings.geminiApiKey);
|
|
75
|
+
this.#model = new ChatGoogleGenerativeAI({ model: this.settings.model, apiKey: this.settings.geminiApiKey, temperature: 0,});
|
|
76
|
+
break;
|
|
77
|
+
case "openai":
|
|
78
|
+
console.log(this.settings.openaiApiKey);
|
|
79
|
+
this.#model = new ChatOpenAI({ model: this.settings.model, apiKey: this.settings.openaiApiKey, temperature: 0, });
|
|
80
|
+
break;
|
|
81
|
+
case "ollama":
|
|
82
|
+
this.#model = new Ollama({
|
|
83
|
+
model: this.settings.model,
|
|
84
|
+
host: this.settings.ollamaUrl,
|
|
85
|
+
});
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
69
88
|
|
|
89
|
+
this.#qdrantClient = new QdrantClient({ url: this.settings.qdrantUrl });
|
|
90
|
+
};
|
|
70
91
|
|
|
71
92
|
#keydownHandler = async (e) => {
|
|
72
93
|
if (e.key !== "Enter") return;
|
|
@@ -93,6 +114,8 @@ export class IdeAssi extends HTMLElement
|
|
|
93
114
|
elAiChat.add("ing", "...");
|
|
94
115
|
|
|
95
116
|
try {
|
|
117
|
+
this.#createModel();
|
|
118
|
+
|
|
96
119
|
const r = await this.#ai.generateSource(question);
|
|
97
120
|
console.log(r);
|
|
98
121
|
elAiChat.add("ai", r);
|
package/package.json
CHANGED
|
@@ -3,8 +3,9 @@ import { IdeAi } from "./ideAi.js";
|
|
|
3
3
|
|
|
4
4
|
export class IdeAssi extends HTMLElement
|
|
5
5
|
{
|
|
6
|
-
#ai;
|
|
7
6
|
#ing = false;
|
|
7
|
+
#ai;
|
|
8
|
+
#model;
|
|
8
9
|
|
|
9
10
|
settings;
|
|
10
11
|
|
|
@@ -66,7 +67,27 @@ export class IdeAssi extends HTMLElement
|
|
|
66
67
|
};
|
|
67
68
|
|
|
68
69
|
|
|
70
|
+
#createModel = () => {
|
|
71
|
+
|
|
72
|
+
switch (this.settings.server) {
|
|
73
|
+
case "gemini":
|
|
74
|
+
console.log(this.settings.geminiApiKey);
|
|
75
|
+
this.#model = new ChatGoogleGenerativeAI({ model: this.settings.model, apiKey: this.settings.geminiApiKey, temperature: 0,});
|
|
76
|
+
break;
|
|
77
|
+
case "openai":
|
|
78
|
+
console.log(this.settings.openaiApiKey);
|
|
79
|
+
this.#model = new ChatOpenAI({ model: this.settings.model, apiKey: this.settings.openaiApiKey, temperature: 0, });
|
|
80
|
+
break;
|
|
81
|
+
case "ollama":
|
|
82
|
+
this.#model = new Ollama({
|
|
83
|
+
model: this.settings.model,
|
|
84
|
+
host: this.settings.ollamaUrl,
|
|
85
|
+
});
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
69
88
|
|
|
89
|
+
this.#qdrantClient = new QdrantClient({ url: this.settings.qdrantUrl });
|
|
90
|
+
};
|
|
70
91
|
|
|
71
92
|
#keydownHandler = async (e) => {
|
|
72
93
|
if (e.key !== "Enter") return;
|
|
@@ -93,6 +114,8 @@ export class IdeAssi extends HTMLElement
|
|
|
93
114
|
elAiChat.add("ing", "...");
|
|
94
115
|
|
|
95
116
|
try {
|
|
117
|
+
this.#createModel();
|
|
118
|
+
|
|
96
119
|
const r = await this.#ai.generateSource(question);
|
|
97
120
|
console.log(r);
|
|
98
121
|
elAiChat.add("ai", r);
|