@markprompt/web
Advanced tools
Comparing version 0.4.1 to 0.5.0
import { type MarkpromptOptions } from './types.js'; | ||
/** | ||
* Render a markprompt dialog button. | ||
* | ||
* @param projectKey Your Markprompt project key | ||
@@ -4,0 +6,0 @@ * @param container The element or selector to render Markprompt into |
@@ -1,3 +0,4 @@ | ||
import { type Options as CoreOptions } from '@markprompt/core'; | ||
type MarkpromptOptions = CoreOptions & { | ||
import { type SubmitPromptOptions } from '@markprompt/core'; | ||
import type { FlattenedSearchResult } from '@markprompt/react'; | ||
type MarkpromptOptions = SubmitPromptOptions & { | ||
close?: { | ||
@@ -21,6 +22,15 @@ /** | ||
}; | ||
search?: { | ||
/** | ||
* Enable search | ||
* @default false | ||
**/ | ||
enable?: boolean; | ||
/** Callback to transform a search result into an href */ | ||
getResultHref?: (result: FlattenedSearchResult) => string; | ||
}; | ||
prompt?: { | ||
/** | ||
* Label for the prompt input | ||
* @default "Your prompt" | ||
* @default "Ask me anything…" | ||
**/ | ||
@@ -27,0 +37,0 @@ label?: string; |
{ | ||
"name": "@markprompt/web", | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"description": "A web component for adding GPT-4 powered search using the Markprompt API.", | ||
@@ -11,3 +11,3 @@ "repository": { | ||
"license": "MIT", | ||
"author": "Motif", | ||
"author": "Markprompt", | ||
"type": "module", | ||
@@ -32,6 +32,11 @@ "exports": { | ||
"dependencies": { | ||
"@markprompt/core": "0.4.6" | ||
"@markprompt/core": "0.5.0", | ||
"@react-spring/web": "^9.7.2", | ||
"clsx": "^1.2.1", | ||
"react-simple-animate": "^3.5.2", | ||
"transition-hook": "^1.5.2", | ||
"use-presence": "^1.2.0" | ||
}, | ||
"devDependencies": { | ||
"@markprompt/react": "0.4.0", | ||
"@markprompt/react": "0.5.0", | ||
"@radix-ui/react-accessible-icon": "^1.0.3", | ||
@@ -38,0 +43,0 @@ "@types/react": "^18.2.6", |
@@ -13,4 +13,21 @@ # `@markprompt/web` | ||
</a> | ||
<a aria-label="Coverage" href="https://app.codecov.io/gh/motifland/markprompt-js/tree/main/packages%2Fweb"> | ||
<img alt="" src="https://codecov.io/gh/motifland/markprompt-js/branch/main/graph/badge.svg" /> | ||
</a> | ||
</p> | ||
## Table of Contents | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Usage via `<script>` tag](#usage-via-script-tag) | ||
- [API](#api) | ||
- [`markprompt(projectKey, container, options?)`](#markpromptprojectkey-container-options) | ||
- [Arguments](#arguments) | ||
- [Options](#options) | ||
- [Documentation](#documentation) | ||
- [Community](#community) | ||
- [Authors](#authors) | ||
- [License](#license) | ||
## Installation | ||
@@ -30,3 +47,3 @@ | ||
<!-- load from a CDN: --> | ||
<link rel="stylesheet" href="https://esm.sh/@markprompt/css?css" /> | ||
<link rel="stylesheet" href="https://esm.sh/@markprompt/css@0.1.1?css" /> | ||
``` | ||
@@ -57,3 +74,3 @@ | ||
Options are optional and allow you to configure texts the component to some extent. You will most likely want to pass `transformReferenceId` to transform your reference ids into links to your corresponding documentation. | ||
Options are optional and allow you to configure the texts used in the component to some extent. You will most likely want to pass `transformReferenceId` to transform your reference ids into links to your corresponding documentation. | ||
@@ -76,3 +93,3 @@ ```ts | ||
prompt?: { | ||
/** Label for the prompt input, default: `Your prompt` */ | ||
/** Label for the prompt input, default: `Ask me anything…` */ | ||
label?: string; | ||
@@ -93,2 +110,8 @@ /** Placeholder for the prompt input, default: `Ask me anything…` */ | ||
}; | ||
search?: { | ||
/** Enable search **/ | ||
enable?: boolean; | ||
/** Callback to transform a search result into an href */ | ||
getResultHref?: (result: FlattenedSearchResult) => string; | ||
}; | ||
/** Props for the trigger */ | ||
@@ -118,3 +141,3 @@ trigger?: { | ||
rel="stylesheet" | ||
href="https://unpkg.com/@markprompt/css@0.1.0/markprompt.css" | ||
href="https://unpkg.com/@markprompt/css@0.1.1/markprompt.css" | ||
/> | ||
@@ -141,2 +164,41 @@ <script> | ||
## API | ||
### `markprompt(projectKey, container, options?)` | ||
Render a Markprompt dialog button. | ||
#### Arguments | ||
- `projectKey` (`string`): Your Markprompt project key. | ||
- `container` (`HTMLElement | string`): The element or selector to render Markprompt into. | ||
- `options` (`object`): Options for customizing Markprompt. | ||
#### Options | ||
- `completionsUrl` (`string`): URL at which to fetch completions | ||
- `iDontKnowMessage` (`string`): Message returned when the model does not have an answer | ||
- `model` (`OpenAIModelId`): The OpenAI model to use | ||
- `promptTemplate` (`string`): The prompt template | ||
- `temperature` (`number`): The model temperature | ||
- `topP` (`number`): The model top P | ||
- `frequencyPenalty` (`number`): The model frequency penalty | ||
- `presencePenalty` (`number`): The model present penalty | ||
- `maxTokens` (`number`): The max number of tokens to include in the response | ||
- `sectionsMatchCount` (`number`): The number of sections to include in the prompt context | ||
- `sectionsMatchThreshold` (`number`): The similarity threshold between the input question and selected sections | ||
- `signal` (`AbortSignal`): AbortController signal | ||
- `close.label` (`string`): `aria-label` for the close modal button. (Default: `"Close Markprompt"`) | ||
- `decription.hide` (`boolean`): Visually hide the description. (Default `true`) | ||
- `decription.text` (`string`): Description text. | ||
- `prompt.label` )`string`): Label for the prompt input. (Default `"Your prompt"`) | ||
- `prompt.placeholder` )`string`): Placeholder for the prompt input. (Default `"Ask me anything…"`) | ||
- `references.transformReferenceId` (`Function`): Callback to transform a reference id into an href and text. | ||
- `references.loadingText` (`string`) Loading text. (Default: `Fetching relevant pages…`) | ||
- `references.referencesText` (`string`): References title. (Default: `"Answer generated from the following sources:"`) | ||
- `trigger.label` (`string`): `aria-label` for the open button. (Default: `"Open Markprompt"`) | ||
- `title.hide` (`boolean`): Visually hide the title. (Default: `true`) | ||
- `title.text` (`string`): Text for the title. (Default: `"Ask me anything"`) | ||
- `showBranding` (`boolean`): Show Markprompt branding. (Default: `true`) | ||
## Documentation | ||
@@ -149,3 +211,2 @@ | ||
- [Twitter @markprompt](https://twitter.com/markprompt) | ||
- [Twitter @motifland](https://twitter.com/motifland) | ||
- [Discord](https://discord.gg/MBMh4apz6X) | ||
@@ -155,3 +216,7 @@ | ||
This library is created by the team behind [Motif](https://motif.land) | ||
([@motifland](https://twitter.com/motifland)). | ||
This library is created by the team behind [Markprompt](https://markprompt.com) | ||
([@markprompt](https://twitter.com/markprompt)). | ||
## License | ||
[MIT](./LICENSE) © [Motif](https://motif.land) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
3280771
2289
214
6
4
+ Added@react-spring/web@^9.7.2
+ Addedclsx@^1.2.1
+ Addedreact-simple-animate@^3.5.2
+ Addedtransition-hook@^1.5.2
+ Addeduse-presence@^1.2.0
+ Added@markprompt/core@0.5.0(transitive)
+ Added@react-spring/animated@9.7.5(transitive)
+ Added@react-spring/core@9.7.5(transitive)
+ Added@react-spring/rafz@9.7.5(transitive)
+ Added@react-spring/shared@9.7.5(transitive)
+ Added@react-spring/types@9.7.5(transitive)
+ Added@react-spring/web@9.7.5(transitive)
+ Addedclsx@1.2.1(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedreact@17.0.218.3.1(transitive)
+ Addedreact-dom@17.0.218.3.1(transitive)
+ Addedreact-simple-animate@3.5.2(transitive)
+ Addedscheduler@0.20.20.23.2(transitive)
+ Addedtransition-hook@1.5.2(transitive)
+ Addedtslib@2.8.1(transitive)
+ Addeduse-presence@1.3.0(transitive)
- Removed@markprompt/core@0.4.6(transitive)
Updated@markprompt/core@0.5.0