teodor-new-chat-ui 4.3.310 → 4.3.311
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/dist/index.esm.js +3361 -3332
- package/dist/index.umd.js +34 -34
- package/dist/lib/attemptDetection.d.ts +59 -0
- package/package.json +1 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attempt Detection Utility
|
|
3
|
+
*
|
|
4
|
+
* Detects when user messages are edited/re-sent from different branch points.
|
|
5
|
+
* This creates "versions" of a user input that should be grouped together as attempts.
|
|
6
|
+
*
|
|
7
|
+
* Example:
|
|
8
|
+
* Checkpoint A: [msg1 (user), msg2 (assistant), msg3 (user)] ← msg3 added
|
|
9
|
+
* Checkpoint B: [msg1 (user), msg2 (assistant), msg3 (user), msg4 (assistant)] ← msg3 was re-sent from earlier point
|
|
10
|
+
*
|
|
11
|
+
* msg3 appears in multiple checkpoints = multiple attempts/versions
|
|
12
|
+
*/
|
|
13
|
+
import type { HydratedCheckpointSnapshot } from "@/types/models";
|
|
14
|
+
/**
|
|
15
|
+
* Groups checkpoints by their last user message ID
|
|
16
|
+
* Returns a map where key is the user message ID, value is array of checkpoints containing it
|
|
17
|
+
*/
|
|
18
|
+
export declare function groupCheckpointsByLastUserMessageId(checkpoints: HydratedCheckpointSnapshot[]): Map<string, HydratedCheckpointSnapshot[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Detects edited user messages by finding user message IDs that appear in multiple checkpoints.
|
|
21
|
+
* Returns a Map where key is user message ID, value is array of checkpoints where it was edited.
|
|
22
|
+
*/
|
|
23
|
+
export declare function detectEditedUserMessages(checkpoints: HydratedCheckpointSnapshot[]): Map<string, HydratedCheckpointSnapshot[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Creates version metadata for checkpoints that share the same last user message
|
|
26
|
+
* This enriches CheckpointMeta with version/attempt information
|
|
27
|
+
*/
|
|
28
|
+
export declare function createVersionMetadataForCheckpoints(checkpointsByUserMsg: Map<string, HydratedCheckpointSnapshot[]>): Map<string, {
|
|
29
|
+
versionIndex: number;
|
|
30
|
+
totalVersions: number;
|
|
31
|
+
baseUserMessageId: string;
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Analyzes checkpoints and returns attempt information grouped by user message ID
|
|
35
|
+
* Useful for detecting branches/edits in the conversation
|
|
36
|
+
*/
|
|
37
|
+
export declare function analyzeAttemptStructure(checkpoints: HydratedCheckpointSnapshot[]): {
|
|
38
|
+
editedMessages: Map<string, HydratedCheckpointSnapshot[]>;
|
|
39
|
+
versionMetadata: Map<string, {
|
|
40
|
+
versionIndex: number;
|
|
41
|
+
totalVersions: number;
|
|
42
|
+
baseUserMessageId: string;
|
|
43
|
+
}>;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Helper: Extract last user message ID from checkpoint
|
|
47
|
+
*/
|
|
48
|
+
export declare function getLastUserMessageIdFromCheckpoint(checkpoint: HydratedCheckpointSnapshot): string | null;
|
|
49
|
+
/**
|
|
50
|
+
* Builds attempt metadata for all checkpoints based on their last user message ID
|
|
51
|
+
* Groups checkpoints that share the same user message ID as "attempts/versions"
|
|
52
|
+
* Enriches each checkpoint with attemptIndex, attemptCount, and isLatestAttempt
|
|
53
|
+
*/
|
|
54
|
+
export declare function buildAttemptMetadataMap(checkpoints: HydratedCheckpointSnapshot[]): Map<string, {
|
|
55
|
+
attemptIndex: number;
|
|
56
|
+
attemptCount: number;
|
|
57
|
+
isLatestAttempt: boolean;
|
|
58
|
+
baseUserMessageId: string | null;
|
|
59
|
+
}>;
|
package/package.json
CHANGED