@markprompt/web
Advanced tools
Comparing version 0.2.2-beta42 to 0.2.2-beta43
@@ -1,2 +0,2 @@ | ||
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 k}from"@markprompt/core";import{unified as T}from"unified";import S from"remark-parse";import q from"remark-rehype";import I 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.placeholder="Ask me anything\u2026";this.prompt="";this.promptTemplate="";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 k(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.promptTemplate?{promptTemplate:this.promptTemplate}:{}}),this.loading=!1)}async renderMarkdown(e){const o=await T().use(S).use(E).use(q,{allowDangerousHtml:!0}).use(I).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 k}from"@markprompt/core";import{unified as T}from"unified";import S from"remark-parse";import q from"remark-rehype";import I 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.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,console.log("this.promptTemplate",this.promptTemplate),await k(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.promptTemplate?{promptTemplate:this.promptTemplate}:{}}),this.loading=!1)}async renderMarkdown(e){const o=await T().use(S).use(E).use(q,{allowDangerousHtml:!0}).use(I).use($).process(e);return typeof o.value!="string"?"":A(o.value)}render(){return n` | ||
<div class="root"> | ||
@@ -223,3 +223,3 @@ <div class="input-container"> | ||
} | ||
`,r([s({type:String})],t.prototype,"model",2),r([s({type:String})],t.prototype,"promptTemplate",2),r([s({type:String})],t.prototype,"iDontKnowMessage",2),r([s({type:String})],t.prototype,"completionsUrl",2),r([s({type:String})],t.prototype,"projectKey",2),r([s({type:String})],t.prototype,"placeholder",2),r([s({type:String,state:!0})],t.prototype,"prompt",2),r([s({type:String,state:!0})],t.prototype,"promptTemplate",2),r([s({type:Object})],t.prototype,"idToRefMap",2),r([s({type:Boolean,state:!0})],t.prototype,"loading",2),r([s({type:String,state:!0})],t.prototype,"answer",2),r([s({type:Array,state:!0})],t.prototype,"references",2),t=r([f("markprompt-content")],t);let h=class extends w{render(){return n`<span></span>`}};h.styles=g` | ||
`,r([s({type:String})],t.prototype,"model",2),r([s({type:String})],t.prototype,"promptTemplate",2),r([s({type:String})],t.prototype,"iDontKnowMessage",2),r([s({type:String})],t.prototype,"completionsUrl",2),r([s({type:String})],t.prototype,"projectKey",2),r([s({type:String})],t.prototype,"placeholder",2),r([s({type:String,state:!0})],t.prototype,"prompt",2),r([s({type:Object})],t.prototype,"idToRefMap",2),r([s({type:Boolean,state:!0})],t.prototype,"loading",2),r([s({type:String,state:!0})],t.prototype,"answer",2),r([s({type:Array,state:!0})],t.prototype,"references",2),t=r([f("markprompt-content")],t);let h=class extends w{render(){return n`<span></span>`}};h.styles=g` | ||
:host { | ||
@@ -226,0 +226,0 @@ display: inline-block; |
{ | ||
"name": "@markprompt/web", | ||
"version": "0.2.2-beta42", | ||
"version": "0.2.2-beta43", | ||
"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
17
4
69
639853
16286