@markprompt/web
Advanced tools
Comparing version 0.3.2 to 0.3.3-beta1
@@ -25,2 +25,3 @@ import { OpenAIModelId } from '@markprompt/core'; | ||
loading: boolean; | ||
shouldStopStreaming: boolean; | ||
answer: string; | ||
@@ -27,0 +28,0 @@ references: string[]; |
@@ -33,2 +33,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
this.loading = false; | ||
this.shouldStopStreaming = false; | ||
this.answer = ''; | ||
@@ -59,2 +60,6 @@ this.references = []; | ||
reset() { | ||
const input = this.inputRef.value; | ||
if (input) { | ||
input.value = ''; | ||
} | ||
this.prompt = ''; | ||
@@ -64,6 +69,6 @@ this.answer = ''; | ||
this.loading = false; | ||
this.shouldStopStreaming = true; | ||
} | ||
focus() { | ||
const input = this.inputRef.value; | ||
input?.focus(); | ||
this.inputRef.value?.focus(); | ||
} | ||
@@ -77,5 +82,10 @@ async onSubmit(event) { | ||
this.loading = true; | ||
this.shouldStopStreaming = false; | ||
await submitPrompt(this.prompt, this.projectKey, (chunk) => { | ||
if (this.shouldStopStreaming) { | ||
return false; | ||
} | ||
this.answer += chunk; | ||
setTimeout(() => this.scrollToBottom(), 50); | ||
return true; | ||
}, (references) => { | ||
@@ -205,19 +215,22 @@ this.references = references; | ||
box-sizing: border-box; | ||
padding: 1rem; | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
gap: 0.5rem; | ||
width: 100%; | ||
border-bottom-width: 1px; | ||
background-color: var(--input-bg-color); | ||
border-color: var(--border-color); | ||
height: 3rem; | ||
gap: var(--input-container-gap, 0.5rem); | ||
border-bottom-width: var(--input-container-border-bottom-width, 1px); | ||
padding: var(--input-container-padding, 1rem); | ||
background-color: var( | ||
--input-container-bg-color, | ||
var(--input-bg-color, #fff) | ||
); | ||
border-color: var(--border-color, #e5e5e5); | ||
height: var(--input-container-height, var(--input-height, 3rem)); | ||
} | ||
.input-container svg { | ||
height: 20px; | ||
width: 20px; | ||
flex: none; | ||
height: var(--input-container-icon-size, 20px); | ||
width: var(--input-container-icon-size, 20px); | ||
color: var(--search-icon-color); | ||
flex: none; | ||
} | ||
@@ -227,2 +240,3 @@ | ||
flex-grow: 1; | ||
margin-block-end: 0; | ||
} | ||
@@ -233,13 +247,13 @@ | ||
width: 100%; | ||
padding: 4px; | ||
appearance: none; | ||
border-radius: 0.375rem; | ||
border-width: 0px; | ||
background-color: transparent; | ||
color: var(--text-color); | ||
font-size: 1rem; | ||
border-radius: var(--prompt-input-border-radius, 0.375em); | ||
padding: var(--prompt-input-padding, 4px); | ||
color: var(--text-color, #171717); | ||
font-size: var(--text-size, 0.875rem); | ||
} | ||
.prompt-input::placeholder { | ||
color: var(--input-placeholder-color); | ||
color: var(--input-placeholder-color, #d4d4d4); | ||
} | ||
@@ -260,3 +274,3 @@ | ||
z-index: 10; | ||
height: 2.5rem; | ||
height: 2.5em; | ||
} | ||
@@ -266,3 +280,2 @@ | ||
box-sizing: border-box; | ||
background-color: var(--result-bg-color); | ||
scrollbar-width: none; | ||
@@ -274,6 +287,7 @@ -ms-overflow-style: none; | ||
bottom: 0; | ||
top: 3rem; | ||
z-index: 0; | ||
max-width: 100%; | ||
scroll-behavior: smooth; | ||
background-color: var(--result-bg-color, #f5f5f5); | ||
top: var(--input-height, 3rem); | ||
} | ||
@@ -301,4 +315,4 @@ | ||
flex-grow: 1 !important; | ||
padding: 1rem; | ||
color: var(--text-color); | ||
padding: var(--answer-padding, 1rem); | ||
color: var(--text-color, #171717); | ||
} | ||
@@ -322,7 +336,9 @@ | ||
box-sizing: border-box; | ||
border-top: 1px solid var(--border-color); | ||
padding: 1rem; | ||
font-size: 0.875rem; | ||
line-height: 1.25rem; | ||
color: rgb(115 115 115 / 1); | ||
overflow-y: auto; | ||
color: var(--references-container-color, #737373); | ||
border-top: 1px solid var(--border-color, #e5e5e5); | ||
line-height: var(--references-container-line-height, 1.25rem); | ||
padding: var(--references-container-padding, 1rem); | ||
font-size: var(--text-size, 0.875rem); | ||
max-height: var(--references-container-max-height, 200px); | ||
} | ||
@@ -335,19 +351,19 @@ | ||
align-items: center; | ||
gap: 0.5rem; | ||
gap: var(--references-gap, 0.5em); | ||
} | ||
.reference-item { | ||
font-weight: 600; | ||
padding-left: 0.5rem; | ||
padding-right: 0.5rem; | ||
padding-top: 0.25rem; | ||
padding-bottom: 0.25rem; | ||
border-radius: 0.375rem; | ||
border: 1px solid var(--border-color); | ||
color: var(--accent-color); | ||
text-decoration: none; | ||
background-color: var(--reference-item-bg-color); | ||
transition-property: background-color, border-color, color, fill, stroke, | ||
opacity, box-shadow, transform; | ||
transition-duration: 200ms; | ||
font-weight: var(--reference-item-font-weight, 600); | ||
padding-left: var(--reference-item-padding-x, 0.5em); | ||
padding-right: var(--reference-item-padding-x, 0.5em); | ||
padding-top: var(--reference-item-padding-y, 0.25em); | ||
padding-bottom: var(--reference-item-padding-y, 0.25em); | ||
border-radius: var(--reference-item-border-radius, 0.375em); | ||
background-color: var(--reference-item-bg-color, #ffffff); | ||
border: 1px solid var(--border-color, #e5e5e5); | ||
color: var(--accent-color, #38bdf8); | ||
} | ||
@@ -360,7 +376,7 @@ | ||
.caret { | ||
color: var(--caret-color); | ||
color: var(--caret-color, #38bdf8); | ||
} | ||
.spacer { | ||
height: 2rem; | ||
height: var(--spacer-height, 2em); | ||
} | ||
@@ -371,3 +387,3 @@ | ||
opacity: 0; | ||
transform: translateY(16px); | ||
transform: translateY(var(--slide-up-translate-x, 16px)); | ||
} | ||
@@ -418,2 +434,5 @@ to { | ||
__decorate([ | ||
property({ type: Boolean, state: true }) | ||
], Markprompt.prototype, "shouldStopStreaming", void 0); | ||
__decorate([ | ||
property({ type: String, state: true }) | ||
@@ -420,0 +439,0 @@ ], Markprompt.prototype, "answer", void 0); |
{ | ||
"name": "@markprompt/web", | ||
"version": "0.3.2", | ||
"version": "0.3.3-beta1", | ||
"description": "A web component for adding GPT-4 powered search using the Markprompt API.", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/motifland/markprompt-js.git", | ||
"directory": "packages/web" | ||
}, | ||
"license": "MIT", | ||
"author": "Motif", | ||
"type": "module", | ||
"exports": "./dist/index.js", | ||
"main": "dist/index.js", | ||
"exports": "./dist/index.js", | ||
"license": "MIT", | ||
"type": "module", | ||
"files": [ | ||
@@ -14,18 +19,10 @@ "README.md", | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/motifland/markprompt-js.git", | ||
"directory": "packages/web" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"scripts": { | ||
"build": "tsc --build --clean && tsc --build", | ||
"dev": "tsc --build --watch", | ||
"prepack": "tsc --build", | ||
"dev": "tsc --build --watch", | ||
"build": "tsc --build", | ||
"vite": "vite" | ||
}, | ||
"dependencies": { | ||
"@markprompt/core": "0.4.0", | ||
"@markprompt/core": "0.4.1", | ||
"lit": "^2.7.2", | ||
@@ -42,3 +39,6 @@ "rehype-sanitize": "^5.0.1", | ||
"vite": "^4.2.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
46219
1077
0
+ Added@markprompt/core@0.4.1(transitive)
- Removed@markprompt/core@0.4.0(transitive)
Updated@markprompt/core@0.4.1