on-codemerge
Version:
A WYSIWYG editor for on-codemerge is a user-friendly interface that allows users to edit and view their code in real time, exactly as it will appear in the final product
45 lines (44 loc) • 1.18 kB
JavaScript
var s = Object.defineProperty;
var i = (a, e, t) => e in a ? s(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
var n = (a, e, t) => i(a, typeof e != "symbol" ? e + "" : e, t);
class m {
constructor(e) {
n(this, "apiKey");
this.apiKey = e;
}
// Описание параметров для DeepSeek
getOptionsDescription() {
return {
maxTokens: {
type: "number",
label: "Max Tokens",
default: 100
},
temperature: {
type: "number",
label: "Temperature",
default: 0.7
}
};
}
async generateText(e, t) {
const r = await fetch("https://api.deepseek.com/v1/generate", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${this.apiKey}`
},
body: JSON.stringify({
prompt: e,
max_tokens: (t == null ? void 0 : t.maxTokens) || 100,
temperature: (t == null ? void 0 : t.temperature) || 0.7
})
});
if (!r.ok)
throw new Error("Failed to generate text with DeepSeek");
return (await r.json()).text;
}
}
export {
m as DeepSeekDriver
};