@gui-chat-plugin/sequence 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.1
4
+
5
+ - **A web page's address shows the page's preview picture.** In MulmoChat, the model had only
6
+ pages' addresses from its searches and browsing (neither returns image files'), and gave one as
7
+ `imageUrl`. A page's `og:image` (else `twitter:image`) is now fetched in its place, under the
8
+ same checks; one that is a page in turn isn't followed. Tried on Car and Driver's and Wired's
9
+ articles about the Tesla Roadster: each slide showed the article's photo.
10
+ - **An `imageUrl` that isn't used is said so.** The same model put the address on an HTML slide
11
+ without `{{image}}`; it was left out without a word. The result now says the picture isn't
12
+ shown and why, and the tool's description says the slide must have `{{image}}`.
13
+
3
14
  ## 0.7.0
4
15
 
5
16
  - **A slide's picture can come from the web (`imageUrl`).** The slides' policy lets an image come
package/README.md CHANGED
@@ -91,8 +91,10 @@ and the model is told.
91
91
 
92
92
  ### A picture from the web
93
93
 
94
- `imageUrl` is the address of an image file the model found (in a search, or from the user), shown
95
- instead of a generated picture: on a picture slide, or at an HTML or Markdown slide's `{{image}}`
94
+ `imageUrl` is the address of an image file the model found (in a search, or from the user), or of
95
+ a web page about the thing (an article from a search), whose preview picture (`og:image`, else
96
+ `twitter:image`) is shown: models have pages' addresses far more often than image files'. It is
97
+ shown instead of a generated picture: on a picture slide, or at an HTML or Markdown slide's `{{image}}`
96
98
  in place of the one `imagePrompt` would draw. `execute()` fetches it and returns it as a `data:`
97
99
  URL (`imageData`), so the slides' policy (`img-src data: blob:`) is unchanged and a slide still
98
100
  can't send anything out in an image URL. It is saved as the hosts save their own pictures,
@@ -102,7 +104,8 @@ step of a guide drawn from it, can use it; the result and the record keep the ad
102
104
 
103
105
  Since MulmoChat fetches it on its server, from an address the model chose: only `https`, no IP
104
106
  addresses and no local names (`localhost`, `*.local`, a name without a dot…), every redirect (at
105
- most 3) checked the same way, 10 seconds and 5 MB at most, and only bytes that are a PNG, JPEG, GIF
107
+ most 3) and a page's preview picture checked the same way (a preview that is a page in turn isn't
108
+ followed), 10 seconds and 5 MB at most, and only bytes that are a PNG, JPEG, GIF
106
109
  or WebP picture, whatever the server says its type is. A public name that resolves to a private
107
110
  address isn't caught: that needs a DNS lookup, which a page can't make; what comes back is shown
108
111
  only if it is a picture. MulmoChat's server runs on the user's machine, so it reaches what their
@@ -110,7 +113,8 @@ browser reaches; a host whose server runs elsewhere should fetch on a network th
110
113
  reach. MulmoGlass fetches it in the page, where a site that doesn't allow CORS
111
114
  can't be read.
112
115
 
113
- A picture that can't be fetched is drawn instead, from `imagePrompt` (an HTML or Markdown slide's
116
+ An `imageUrl` on a slide with no place for a picture (an HTML slide without `{{image}}`, a chart)
117
+ isn't fetched, and the model is told. A picture that can't be fetched is drawn instead, from `imagePrompt` (an HTML or Markdown slide's
114
118
  from its alt text or title, as without `imageUrl`), and the model is told; a picture slide with no
115
119
  `imagePrompt` isn't shown, and the model is told why, so it can give another address.
116
120
 
@@ -20,6 +20,9 @@ export interface SlideArgs {
20
20
  /** A picture from the web, shown instead of a drawn one: a picture
21
21
  * slide's, or the one an HTML or Markdown slide places at {{image}}. */
22
22
  imageUrl?: string;
23
+ /** An imageUrl sent for a slide with no place for a picture (an HTML slide
24
+ * without {{image}}, a chart): not shown, and the model is told. */
25
+ unplacedImageUrl?: string;
23
26
  /** An HTML slide's body. */
24
27
  html?: string;
25
28
  /** A Markdown slide's text, with TeX math. */
@@ -9,11 +9,18 @@ export declare function webImageType(bytes: Uint8Array): {
9
9
  mime: string;
10
10
  extension: string;
11
11
  } | null;
12
+ /** The address of a page's preview picture (og:image, twitter:image), from
13
+ * its <meta> tags, or null. Read as text: no DOM where execute() runs on a
14
+ * server. */
15
+ export declare function pagePreviewImage(html: string, pageUrl: string): string | null;
12
16
  /** A picture from the web, saved under artifacts/images/ when the host has
13
- * files, or why it couldn't be fetched. */
14
- export declare function fetchWebImage(address: string, artifacts: FileOps | undefined): Promise<{
17
+ * files, or why it couldn't be fetched. A page's address gives its preview
18
+ * picture, whose address is `source`; a page's preview that is a page
19
+ * isn't followed. */
20
+ export declare function fetchWebImage(address: string, artifacts: FileOps | undefined, fromPage?: boolean): Promise<{
15
21
  imageData: string;
16
22
  imagePath?: string;
23
+ source?: string;
17
24
  } | {
18
25
  error: string;
19
26
  }>;