@markprompt/web
Advanced tools
Comparing version 0.2.2-beta3 to 0.2.2-beta4
42
index.js
import './markprompt-content'; | ||
const required = ['projectKey']; | ||
const optional = [ | ||
'completionsUrl', | ||
'dark', | ||
'iDontKnowMessage', | ||
'model', | ||
'placeholder', | ||
'completionsUrl', | ||
'dark', | ||
'iDontKnowMessage', | ||
'model', | ||
'placeholder', | ||
]; | ||
(async () => { | ||
const root = document.createElement('markprompt-content'); | ||
const markprompt = window.markprompt; | ||
for (let key of required) { | ||
if ( | ||
!(markprompt === null || markprompt === void 0 ? void 0 : markprompt[key]) | ||
) { | ||
throw new Error(`Missing Markprompt configuration option: ${key}`); | ||
const root = document.createElement('markprompt-content'); | ||
const markprompt = window.markprompt; | ||
console.log('markprompt', JSON.stringify(markprompt, null, 2)); | ||
for (let key of required) { | ||
console.log('key', key, 'markprompt?.[key]', markprompt === null || markprompt === void 0 ? void 0 : markprompt[key]); | ||
if (!(markprompt === null || markprompt === void 0 ? void 0 : markprompt[key])) { | ||
throw new Error(`!!! Missing Markprompt configuration option: ${key}`); | ||
} | ||
root.setAttribute(key, markprompt[key]); | ||
} | ||
root.setAttribute(key, markprompt[key]); | ||
} | ||
for (let key of optional) { | ||
if ( | ||
!(markprompt === null || markprompt === void 0 ? void 0 : markprompt[key]) | ||
) | ||
continue; | ||
root.setAttribute(key, markprompt[key]); | ||
} | ||
document.body.appendChild(root); | ||
for (let key of optional) { | ||
if (!(markprompt === null || markprompt === void 0 ? void 0 : markprompt[key])) | ||
continue; | ||
root.setAttribute(key, markprompt[key]); | ||
} | ||
document.body.appendChild(root); | ||
})(); |
@@ -34,3 +34,3 @@ import { OpenAIModelId } from '@markprompt/core'; | ||
if (!markprompt?.[key]) { | ||
throw new Error(`Missing Markprompt configuration option: ${key}`); | ||
throw new Error(`!!! Missing Markprompt configuration option: ${key}`); | ||
} | ||
@@ -37,0 +37,0 @@ |
{ | ||
"name": "@markprompt/web", | ||
"version": "0.2.2-beta3", | ||
"version": "0.2.2-beta4", | ||
"description": "Prompt web component for Markprompt", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27051
857