@promptbook/cli 0.111.0-1 → 0.111.0-3
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/esm/index.es.js +6 -14
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageMap.d.ts +17 -0
- package/esm/typings/src/book-components/Chat/utils/citationHelpers.d.ts +38 -0
- package/esm/typings/src/book-components/Chat/utils/citationHelpers.test.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/utils/splitMessageContentIntoSegments.d.ts +41 -0
- package/esm/typings/src/book-components/Chat/utils/splitMessageContentIntoSegments.test.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +6 -14
- package/umd/index.umd.js.map +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import 'leaflet/dist/leaflet.css';
|
|
2
|
+
import type { GeoJsonObject } from 'geojson';
|
|
3
|
+
/**
|
|
4
|
+
* Props for `<ChatMessageMap/>`.
|
|
5
|
+
*
|
|
6
|
+
* @private internal helper of `<ChatMessageItem/>`
|
|
7
|
+
*/
|
|
8
|
+
type ChatMessageMapProps = {
|
|
9
|
+
data: GeoJsonObject;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Renders a Leaflet map for GeoJSON data inside the chat bubble.
|
|
13
|
+
*
|
|
14
|
+
* @private internal helper of `<ChatMessageItem/>`
|
|
15
|
+
*/
|
|
16
|
+
export declare function ChatMessageMap({ data }: ChatMessageMapProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ChatParticipant } from '../types/ChatParticipant';
|
|
2
|
+
import type { ParsedCitation } from './parseCitationsFromContent';
|
|
3
|
+
/**
|
|
4
|
+
* Returns whether the provided value is a valid HTTP(S) URL.
|
|
5
|
+
*
|
|
6
|
+
* @param value - Candidate string to inspect.
|
|
7
|
+
* @returns True when the value parses as an HTTP or HTTPS URL.
|
|
8
|
+
* @private utility of `<Chat/>` citation rendering
|
|
9
|
+
*/
|
|
10
|
+
export declare function isCitationUrl(value: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Determines whether a citation should be displayed as a text snippet instead of a file/URL.
|
|
13
|
+
*
|
|
14
|
+
* @param citation - Parsed citation metadata.
|
|
15
|
+
* @returns True when the citation looks like inline text instead of a document or URL.
|
|
16
|
+
* @private utility of `<Chat/>` citation rendering
|
|
17
|
+
*/
|
|
18
|
+
export declare function isPlainTextCitation(citation: ParsedCitation): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Builds a label that matches the desired chip/modal title for a citation.
|
|
21
|
+
*
|
|
22
|
+
* @param citation - Parsed citation metadata.
|
|
23
|
+
* @returns The friendly label shown on chips and modal headers.
|
|
24
|
+
* @private utility of `<Chat/>` citation rendering
|
|
25
|
+
*/
|
|
26
|
+
export declare function getCitationLabel(citation: ParsedCitation): string;
|
|
27
|
+
/**
|
|
28
|
+
* Resolves the preview URL used inside the citation modal iframe.
|
|
29
|
+
*
|
|
30
|
+
* @param citation - Parsed citation metadata.
|
|
31
|
+
* @param participants - Known chat participants for agent knowledge lookup.
|
|
32
|
+
* @returns URL string suitable for iframe preview or null when unavailable.
|
|
33
|
+
* @private utility of `<Chat/>` citation rendering
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveCitationPreviewUrl(citation: ParsedCitation, participants: ReadonlyArray<ChatParticipant>): string | null;
|
|
36
|
+
/**
|
|
37
|
+
* TODO: [💞] Spread into multiple files
|
|
38
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { GeoJsonObject } from 'geojson';
|
|
2
|
+
import type { ImagePromptSegment } from './parseImagePrompts';
|
|
3
|
+
/**
|
|
4
|
+
* Segment that represents plain markdown text inside a chat message.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Segment that represents plain markdown text inside a chat message.
|
|
8
|
+
*
|
|
9
|
+
* @private internal helper of `<ChatMessageItem/>`
|
|
10
|
+
*/
|
|
11
|
+
export type ChatTextSegment = {
|
|
12
|
+
type: 'text';
|
|
13
|
+
content: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Segment that represents a Leaflet-ready map rendered from GeoJSON data.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Segment that represents a Leaflet-ready map rendered from GeoJSON data.
|
|
20
|
+
*
|
|
21
|
+
* @private internal helper of `<ChatMessageItem/>`
|
|
22
|
+
*/
|
|
23
|
+
export type ChatMapSegment = {
|
|
24
|
+
type: 'map';
|
|
25
|
+
data: GeoJsonObject;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Composite segment type that covers text, image prompts, and map features.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Composite segment type that covers text, image prompts, and map features.
|
|
32
|
+
*
|
|
33
|
+
* @private internal helper of `<ChatMessageItem/>`
|
|
34
|
+
*/
|
|
35
|
+
export type ChatMessageContentSegment = ImagePromptSegment | ChatTextSegment | ChatMapSegment;
|
|
36
|
+
/**
|
|
37
|
+
* Splits chat message content into markdown, image prompt, and map segments while preserving their order.
|
|
38
|
+
*
|
|
39
|
+
* @private internal helper of `<ChatMessageItem/>`
|
|
40
|
+
*/
|
|
41
|
+
export declare function splitMessageContentIntoSegments(content: string): ReadonlyArray<ChatMessageContentSegment>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.111.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.111.0-2`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
* @generated
|
|
57
57
|
* @see https://github.com/webgptorg/promptbook
|
|
58
58
|
*/
|
|
59
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.111.0-
|
|
59
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.111.0-3';
|
|
60
60
|
/**
|
|
61
61
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
62
62
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -35064,7 +35064,6 @@
|
|
|
35064
35064
|
doneReading = !!done;
|
|
35065
35065
|
if (value) {
|
|
35066
35066
|
const textChunk = decoder.decode(value, { stream: true });
|
|
35067
|
-
let sawToolCalls = false;
|
|
35068
35067
|
let hasNonEmptyText = false;
|
|
35069
35068
|
const textLines = [];
|
|
35070
35069
|
const lines = textChunk.split(/\r?\n/);
|
|
@@ -35090,7 +35089,6 @@
|
|
|
35090
35089
|
rawResponse: {},
|
|
35091
35090
|
toolCalls: getActiveToolCalls(),
|
|
35092
35091
|
});
|
|
35093
|
-
sawToolCalls = true;
|
|
35094
35092
|
isToolCallLine = true;
|
|
35095
35093
|
}
|
|
35096
35094
|
}
|
|
@@ -35100,22 +35098,16 @@
|
|
|
35100
35098
|
}
|
|
35101
35099
|
if (!isToolCallLine) {
|
|
35102
35100
|
textLines.push(line);
|
|
35103
|
-
if (
|
|
35101
|
+
if (trimmedLine.length > 0) {
|
|
35104
35102
|
hasNonEmptyText = true;
|
|
35105
35103
|
}
|
|
35106
35104
|
}
|
|
35107
35105
|
}
|
|
35108
|
-
if (
|
|
35109
|
-
|
|
35110
|
-
continue;
|
|
35111
|
-
}
|
|
35112
|
-
const textChunkWithoutToolCalls = textLines.join('\n');
|
|
35113
|
-
content += textChunkWithoutToolCalls;
|
|
35114
|
-
}
|
|
35115
|
-
else {
|
|
35116
|
-
// console.debug('RemoteAgent chunk:', textChunk);
|
|
35117
|
-
content += textChunk;
|
|
35106
|
+
if (!hasNonEmptyText) {
|
|
35107
|
+
continue;
|
|
35118
35108
|
}
|
|
35109
|
+
const textChunkWithoutToolCalls = textLines.join('\n');
|
|
35110
|
+
content += textChunkWithoutToolCalls;
|
|
35119
35111
|
if (!hasReceivedModelOutput && content.trim().length > 0) {
|
|
35120
35112
|
hasReceivedModelOutput = true;
|
|
35121
35113
|
preparationToolCalls.length = 0;
|