@markprompt/web
Advanced tools
Comparing version 0.2.2-beta37 to 0.2.2-beta38
@@ -1,2 +0,2 @@ | ||
var u=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var r=(l,p,e,o)=>{for(var i=o>1?void 0:o?y(p,e):p,c=l.length-1,d;c>=0;c--)(d=l[c])&&(i=(o?d(p,e,i):d(i))||i);return o&&i&&u(p,e,i),i};import{LitElement as w,html as n,css as g,nothing as m}from"lit";import{customElement as f,property as s}from"lit/decorators.js";import{classMap as b}from"lit/directives/class-map.js";import{I_DONT_KNOW_MESSAGE as v,MARKPROMPT_COMPLETIONS_URL as x,DEFAULT_MODEL as z,submitPrompt as S}from"@markprompt/core";import{unified as k}from"unified";import I from"remark-parse";import T from"remark-rehype";import q from"rehype-sanitize";import $ from"rehype-stringify";import E from"remark-gfm";import{until as R}from"lit/directives/until.js";import{unsafeHTML as A}from"lit/directives/unsafe-html.js";let t=class extends w{constructor(){super(...arguments);this.model=z;this.iDontKnowMessage=v;this.completionsUrl=x;this.projectKey="";this.dark=!0;this.accentColor="";this.responseStyle="";this.referenceItemStyle="";this.placeholder="Ask me anything\u2026";this.prompt="";this.idToRefMap={};this.loading=!1;this.answer="";this.references=[]}onInput(e){const o=e.target;this.prompt=o.value}scrollToBottom(){const e=this.renderRoot.querySelector("#result");e.scrollTop=e.scrollHeight}getRefFromId(e){}reset(){const e=this.renderRoot.querySelector("#prompt-input");e.value="",this.answer="",this.references=[],this.loading=!1}focus(){this.renderRoot.querySelector("#prompt-input").focus()}async onSubmit(e){e.preventDefault(),this.prompt!==""&&(this.answer="",this.references=[],this.loading=!0,await S(this.prompt,this.projectKey,o=>{this.scrollToBottom(),this.answer+=o},o=>{this.scrollToBottom(),this.references=o},{model:this.model,iDontKnowMessage:this.iDontKnowMessage,completionsUrl:this.completionsUrl}),this.loading=!1)}async renderMarkdown(e){const o=await k().use(I).use(E).use(T,{allowDangerousHtml:!0}).use(q).use($).process(e);return typeof o.value!="string"?"":A(o.value)}render(){return n` | ||
var u=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var r=(l,p,e,o)=>{for(var i=o>1?void 0:o?v(p,e):p,c=l.length-1,d;c>=0;c--)(d=l[c])&&(i=(o?d(p,e,i):d(i))||i);return o&&i&&u(p,e,i),i};import{LitElement as w,html as n,css as g,nothing as m}from"lit";import{customElement as f,property as s}from"lit/decorators.js";import{classMap as b}from"lit/directives/class-map.js";import{I_DONT_KNOW_MESSAGE as y,MARKPROMPT_COMPLETIONS_URL as x,DEFAULT_MODEL as z,submitPrompt as S}from"@markprompt/core";import{unified as k}from"unified";import I from"remark-parse";import T from"remark-rehype";import q from"rehype-sanitize";import $ from"rehype-stringify";import E from"remark-gfm";import{until as R}from"lit/directives/until.js";import{unsafeHTML as A}from"lit/directives/unsafe-html.js";let t=class extends w{constructor(){super(...arguments);this.model=z;this.iDontKnowMessage=y;this.completionsUrl=x;this.projectKey="";this.dark=!0;this.accentColor="";this.responseStyle="";this.referenceItemStyle="";this.placeholder="Ask me anything\u2026";this.prompt="";this.idToRefMap={};this.loading=!1;this.answer="";this.references=[]}onInput(e){const o=e.target;this.prompt=o.value}scrollToBottom(){const e=this.renderRoot.querySelector("#result");e.scrollTop=e.scrollHeight}getRefFromId(e){}reset(){const e=this.renderRoot.querySelector("#prompt-input");e.value="",this.answer="",this.references=[],this.loading=!1}focus(){this.renderRoot.querySelector("#prompt-input").focus()}async onSubmit(e){e.preventDefault(),this.prompt!==""&&(this.answer="",this.references=[],this.loading=!0,await S(this.prompt,this.projectKey,o=>{this.scrollToBottom(),this.answer+=o},o=>{this.scrollToBottom(),this.references=o},{model:this.model,iDontKnowMessage:this.iDontKnowMessage,completionsUrl:this.completionsUrl}),this.loading=!1)}async renderMarkdown(e){const o=await k().use(I).use(E).use(T,{allowDangerousHtml:!0}).use(q).use($).process(e);return typeof o.value!="string"?"":A(o.value)}render(){return n` | ||
<div class="root"> | ||
@@ -158,2 +158,6 @@ <div class="input-container"> | ||
.answer a { | ||
color: var(--link-color); | ||
} | ||
.spacer { | ||
@@ -160,0 +164,0 @@ height: 2rem; |
{ | ||
"name": "@markprompt/web", | ||
"version": "0.2.2-beta37", | ||
"version": "0.2.2-beta38", | ||
"description": "A web component for adding GPT-4 powered search using the Markprompt API.", | ||
@@ -5,0 +5,0 @@ "author": "Motif", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
640317
16299