graphlit-client 1.0.20250612008 → 1.0.20250613001
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/client.d.ts +1 -0
- package/dist/client.js +9 -2
- package/dist/generated/graphql-documents.d.ts +1 -0
- package/dist/generated/graphql-documents.js +287 -0
- package/dist/generated/graphql-types.d.ts +324 -0
- package/dist/streaming/ui-event-adapter.d.ts +7 -0
- package/dist/streaming/ui-event-adapter.js +57 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
@@ -86,6 +86,7 @@ declare class Graphlit {
|
|
86
86
|
publishContents(publishPrompt: string, connector: Types.ContentPublishingConnectorInput, summaryPrompt?: string, summarySpecification?: Types.EntityReferenceInput, publishSpecification?: Types.EntityReferenceInput, name?: string, filter?: Types.ContentFilter, workflow?: Types.EntityReferenceInput, isSynchronous?: boolean, includeDetails?: boolean, correlationId?: string): Promise<Types.PublishContentsMutation>;
|
87
87
|
publishText(text: string, textType: Types.TextTypes, connector: Types.ContentPublishingConnectorInput, name?: string, workflow?: Types.EntityReferenceInput, isSynchronous?: boolean, correlationId?: string): Promise<Types.PublishTextMutation>;
|
88
88
|
getContent(id: string): Promise<Types.GetContentQuery>;
|
89
|
+
lookupContents(ids: string[]): Promise<Types.LookupContentsResults>;
|
89
90
|
queryContents(filter?: Types.ContentFilter): Promise<Types.QueryContentsQuery>;
|
90
91
|
queryContentsFacets(filter?: Types.ContentFilter): Promise<Types.QueryContentsFacetsQuery>;
|
91
92
|
queryContentsGraph(filter?: Types.ContentFilter): Promise<Types.QueryContentsGraphQuery>;
|
package/dist/client.js
CHANGED
@@ -4,7 +4,7 @@ import { ApolloClient, InMemoryCache, createHttpLink, ApolloLink, ApolloError, }
|
|
4
4
|
import * as Types from "./generated/graphql-types.js";
|
5
5
|
import * as Documents from "./generated/graphql-documents.js";
|
6
6
|
import * as dotenv from "dotenv";
|
7
|
-
import { getServiceType } from "./model-mapping.js";
|
7
|
+
import { getServiceType, getModelName } from "./model-mapping.js";
|
8
8
|
import { UIEventAdapter } from "./streaming/ui-event-adapter.js";
|
9
9
|
import { formatMessagesForOpenAI, formatMessagesForAnthropic, formatMessagesForGoogle, } from "./streaming/llm-formatters.js";
|
10
10
|
import { streamWithOpenAI, streamWithAnthropic, streamWithGoogle, } from "./streaming/providers.js";
|
@@ -489,6 +489,9 @@ class Graphlit {
|
|
489
489
|
async getContent(id) {
|
490
490
|
return this.queryAndCheckError(Documents.GetContent, { id: id });
|
491
491
|
}
|
492
|
+
async lookupContents(ids) {
|
493
|
+
return this.queryAndCheckError(Documents.LookupContents, { ids: ids });
|
494
|
+
}
|
492
495
|
async queryContents(filter) {
|
493
496
|
return this.queryAndCheckError(Documents.QueryContents, { filter: filter });
|
494
497
|
}
|
@@ -1626,11 +1629,15 @@ class Graphlit {
|
|
1626
1629
|
});
|
1627
1630
|
return; // Exit early after successful fallback
|
1628
1631
|
}
|
1629
|
-
// Create UI event adapter
|
1632
|
+
// Create UI event adapter with model information
|
1633
|
+
const modelName = fullSpec ? getModelName(fullSpec) : undefined;
|
1634
|
+
const serviceType = fullSpec ? getServiceType(fullSpec) : undefined;
|
1630
1635
|
uiAdapter = new UIEventAdapter(onEvent, actualConversationId, {
|
1631
1636
|
smoothingEnabled: options?.smoothingEnabled ?? true,
|
1632
1637
|
chunkingStrategy: options?.chunkingStrategy ?? "word",
|
1633
1638
|
smoothingDelay: options?.smoothingDelay ?? 30,
|
1639
|
+
model: modelName,
|
1640
|
+
modelService: serviceType,
|
1634
1641
|
});
|
1635
1642
|
// Start the streaming conversation
|
1636
1643
|
await this.executeStreamingAgent(prompt, actualConversationId, fullSpec, tools, toolHandlers, uiAdapter, maxRounds, abortSignal, mimeType, data, correlationId);
|
@@ -44,6 +44,7 @@ export declare const IngestText: import("graphql").DocumentNode;
|
|
44
44
|
export declare const IngestTextBatch: import("graphql").DocumentNode;
|
45
45
|
export declare const IngestUri: import("graphql").DocumentNode;
|
46
46
|
export declare const IsContentDone: import("graphql").DocumentNode;
|
47
|
+
export declare const LookupContents: import("graphql").DocumentNode;
|
47
48
|
export declare const PublishContents: import("graphql").DocumentNode;
|
48
49
|
export declare const PublishText: import("graphql").DocumentNode;
|
49
50
|
export declare const QueryContents: import("graphql").DocumentNode;
|
@@ -1583,6 +1583,293 @@ export const IsContentDone = gql `
|
|
1583
1583
|
}
|
1584
1584
|
}
|
1585
1585
|
`;
|
1586
|
+
export const LookupContents = gql `
|
1587
|
+
query LookupContents($ids: [ID!]!, $correlationId: String) {
|
1588
|
+
lookupContents(ids: $ids, correlationId: $correlationId) {
|
1589
|
+
results {
|
1590
|
+
id
|
1591
|
+
name
|
1592
|
+
creationDate
|
1593
|
+
owner {
|
1594
|
+
id
|
1595
|
+
}
|
1596
|
+
state
|
1597
|
+
originalDate
|
1598
|
+
finishedDate
|
1599
|
+
fileCreationDate
|
1600
|
+
fileModifiedDate
|
1601
|
+
workflowDuration
|
1602
|
+
uri
|
1603
|
+
description
|
1604
|
+
identifier
|
1605
|
+
markdown
|
1606
|
+
address {
|
1607
|
+
streetAddress
|
1608
|
+
city
|
1609
|
+
region
|
1610
|
+
country
|
1611
|
+
postalCode
|
1612
|
+
}
|
1613
|
+
location {
|
1614
|
+
latitude
|
1615
|
+
longitude
|
1616
|
+
}
|
1617
|
+
h3 {
|
1618
|
+
h3r0
|
1619
|
+
h3r1
|
1620
|
+
h3r2
|
1621
|
+
h3r3
|
1622
|
+
h3r4
|
1623
|
+
h3r5
|
1624
|
+
h3r6
|
1625
|
+
h3r7
|
1626
|
+
h3r8
|
1627
|
+
h3r9
|
1628
|
+
h3r10
|
1629
|
+
h3r11
|
1630
|
+
h3r12
|
1631
|
+
h3r13
|
1632
|
+
h3r14
|
1633
|
+
h3r15
|
1634
|
+
}
|
1635
|
+
boundary
|
1636
|
+
epsgCode
|
1637
|
+
path
|
1638
|
+
features
|
1639
|
+
c4id
|
1640
|
+
type
|
1641
|
+
fileType
|
1642
|
+
mimeType
|
1643
|
+
format
|
1644
|
+
formatName
|
1645
|
+
fileName
|
1646
|
+
fileSize
|
1647
|
+
masterUri
|
1648
|
+
imageUri
|
1649
|
+
textUri
|
1650
|
+
audioUri
|
1651
|
+
transcriptUri
|
1652
|
+
summary
|
1653
|
+
customSummary
|
1654
|
+
keywords
|
1655
|
+
bullets
|
1656
|
+
headlines
|
1657
|
+
posts
|
1658
|
+
chapters
|
1659
|
+
questions
|
1660
|
+
video {
|
1661
|
+
width
|
1662
|
+
height
|
1663
|
+
duration
|
1664
|
+
make
|
1665
|
+
model
|
1666
|
+
software
|
1667
|
+
title
|
1668
|
+
description
|
1669
|
+
keywords
|
1670
|
+
author
|
1671
|
+
}
|
1672
|
+
audio {
|
1673
|
+
keywords
|
1674
|
+
author
|
1675
|
+
series
|
1676
|
+
episode
|
1677
|
+
episodeType
|
1678
|
+
season
|
1679
|
+
publisher
|
1680
|
+
copyright
|
1681
|
+
genre
|
1682
|
+
title
|
1683
|
+
description
|
1684
|
+
bitrate
|
1685
|
+
channels
|
1686
|
+
sampleRate
|
1687
|
+
bitsPerSample
|
1688
|
+
duration
|
1689
|
+
}
|
1690
|
+
image {
|
1691
|
+
width
|
1692
|
+
height
|
1693
|
+
resolutionX
|
1694
|
+
resolutionY
|
1695
|
+
bitsPerComponent
|
1696
|
+
components
|
1697
|
+
projectionType
|
1698
|
+
orientation
|
1699
|
+
description
|
1700
|
+
make
|
1701
|
+
model
|
1702
|
+
software
|
1703
|
+
lens
|
1704
|
+
focalLength
|
1705
|
+
exposureTime
|
1706
|
+
fNumber
|
1707
|
+
iso
|
1708
|
+
heading
|
1709
|
+
pitch
|
1710
|
+
}
|
1711
|
+
document {
|
1712
|
+
title
|
1713
|
+
subject
|
1714
|
+
summary
|
1715
|
+
author
|
1716
|
+
publisher
|
1717
|
+
description
|
1718
|
+
keywords
|
1719
|
+
pageCount
|
1720
|
+
worksheetCount
|
1721
|
+
slideCount
|
1722
|
+
wordCount
|
1723
|
+
lineCount
|
1724
|
+
paragraphCount
|
1725
|
+
isEncrypted
|
1726
|
+
hasDigitalSignature
|
1727
|
+
}
|
1728
|
+
email {
|
1729
|
+
identifier
|
1730
|
+
threadIdentifier
|
1731
|
+
subject
|
1732
|
+
labels
|
1733
|
+
sensitivity
|
1734
|
+
priority
|
1735
|
+
importance
|
1736
|
+
from {
|
1737
|
+
name
|
1738
|
+
email
|
1739
|
+
givenName
|
1740
|
+
familyName
|
1741
|
+
}
|
1742
|
+
to {
|
1743
|
+
name
|
1744
|
+
email
|
1745
|
+
givenName
|
1746
|
+
familyName
|
1747
|
+
}
|
1748
|
+
cc {
|
1749
|
+
name
|
1750
|
+
email
|
1751
|
+
givenName
|
1752
|
+
familyName
|
1753
|
+
}
|
1754
|
+
bcc {
|
1755
|
+
name
|
1756
|
+
email
|
1757
|
+
givenName
|
1758
|
+
familyName
|
1759
|
+
}
|
1760
|
+
}
|
1761
|
+
issue {
|
1762
|
+
identifier
|
1763
|
+
title
|
1764
|
+
project
|
1765
|
+
team
|
1766
|
+
status
|
1767
|
+
priority
|
1768
|
+
type
|
1769
|
+
labels
|
1770
|
+
}
|
1771
|
+
package {
|
1772
|
+
fileCount
|
1773
|
+
folderCount
|
1774
|
+
isEncrypted
|
1775
|
+
}
|
1776
|
+
language {
|
1777
|
+
languages
|
1778
|
+
}
|
1779
|
+
parent {
|
1780
|
+
id
|
1781
|
+
name
|
1782
|
+
}
|
1783
|
+
children {
|
1784
|
+
id
|
1785
|
+
name
|
1786
|
+
}
|
1787
|
+
feed {
|
1788
|
+
id
|
1789
|
+
name
|
1790
|
+
}
|
1791
|
+
collections {
|
1792
|
+
id
|
1793
|
+
name
|
1794
|
+
}
|
1795
|
+
links {
|
1796
|
+
uri
|
1797
|
+
linkType
|
1798
|
+
}
|
1799
|
+
observations {
|
1800
|
+
id
|
1801
|
+
type
|
1802
|
+
observable {
|
1803
|
+
id
|
1804
|
+
name
|
1805
|
+
}
|
1806
|
+
related {
|
1807
|
+
id
|
1808
|
+
name
|
1809
|
+
}
|
1810
|
+
relatedType
|
1811
|
+
relation
|
1812
|
+
occurrences {
|
1813
|
+
type
|
1814
|
+
confidence
|
1815
|
+
startTime
|
1816
|
+
endTime
|
1817
|
+
pageIndex
|
1818
|
+
boundingBox {
|
1819
|
+
left
|
1820
|
+
top
|
1821
|
+
width
|
1822
|
+
height
|
1823
|
+
}
|
1824
|
+
}
|
1825
|
+
state
|
1826
|
+
}
|
1827
|
+
workflow {
|
1828
|
+
id
|
1829
|
+
name
|
1830
|
+
}
|
1831
|
+
pages {
|
1832
|
+
index
|
1833
|
+
text
|
1834
|
+
relevance
|
1835
|
+
images {
|
1836
|
+
id
|
1837
|
+
mimeType
|
1838
|
+
data
|
1839
|
+
left
|
1840
|
+
right
|
1841
|
+
top
|
1842
|
+
bottom
|
1843
|
+
}
|
1844
|
+
chunks {
|
1845
|
+
index
|
1846
|
+
pageIndex
|
1847
|
+
rowIndex
|
1848
|
+
columnIndex
|
1849
|
+
confidence
|
1850
|
+
text
|
1851
|
+
role
|
1852
|
+
language
|
1853
|
+
relevance
|
1854
|
+
}
|
1855
|
+
}
|
1856
|
+
segments {
|
1857
|
+
startTime
|
1858
|
+
endTime
|
1859
|
+
text
|
1860
|
+
relevance
|
1861
|
+
}
|
1862
|
+
frames {
|
1863
|
+
index
|
1864
|
+
description
|
1865
|
+
text
|
1866
|
+
relevance
|
1867
|
+
}
|
1868
|
+
error
|
1869
|
+
}
|
1870
|
+
}
|
1871
|
+
}
|
1872
|
+
`;
|
1586
1873
|
export const PublishContents = gql `
|
1587
1874
|
mutation PublishContents($summaryPrompt: String, $publishPrompt: String!, $connector: ContentPublishingConnectorInput!, $filter: ContentFilter, $includeDetails: Boolean, $isSynchronous: Boolean, $correlationId: String, $name: String, $summarySpecification: EntityReferenceInput, $publishSpecification: EntityReferenceInput, $workflow: EntityReferenceInput) {
|
1588
1875
|
publishContents(
|
@@ -15784,6 +15784,330 @@ export type IsContentDoneQuery = {
|
|
15784
15784
|
result?: boolean | null;
|
15785
15785
|
} | null;
|
15786
15786
|
};
|
15787
|
+
export type LookupContentsQueryVariables = Exact<{
|
15788
|
+
ids: Array<Scalars['ID']['input']> | Scalars['ID']['input'];
|
15789
|
+
correlationId?: InputMaybe<Scalars['String']['input']>;
|
15790
|
+
}>;
|
15791
|
+
export type LookupContentsQuery = {
|
15792
|
+
__typename?: 'Query';
|
15793
|
+
lookupContents?: {
|
15794
|
+
__typename?: 'LookupContentsResults';
|
15795
|
+
results?: Array<{
|
15796
|
+
__typename?: 'Content';
|
15797
|
+
id: string;
|
15798
|
+
name: string;
|
15799
|
+
creationDate: any;
|
15800
|
+
state: EntityState;
|
15801
|
+
originalDate?: any | null;
|
15802
|
+
finishedDate?: any | null;
|
15803
|
+
fileCreationDate?: any | null;
|
15804
|
+
fileModifiedDate?: any | null;
|
15805
|
+
workflowDuration?: any | null;
|
15806
|
+
uri?: any | null;
|
15807
|
+
description?: string | null;
|
15808
|
+
identifier?: string | null;
|
15809
|
+
markdown?: string | null;
|
15810
|
+
boundary?: string | null;
|
15811
|
+
epsgCode?: number | null;
|
15812
|
+
path?: string | null;
|
15813
|
+
features?: string | null;
|
15814
|
+
c4id?: string | null;
|
15815
|
+
type?: ContentTypes | null;
|
15816
|
+
fileType?: FileTypes | null;
|
15817
|
+
mimeType?: string | null;
|
15818
|
+
format?: string | null;
|
15819
|
+
formatName?: string | null;
|
15820
|
+
fileName?: string | null;
|
15821
|
+
fileSize?: any | null;
|
15822
|
+
masterUri?: any | null;
|
15823
|
+
imageUri?: any | null;
|
15824
|
+
textUri?: any | null;
|
15825
|
+
audioUri?: any | null;
|
15826
|
+
transcriptUri?: any | null;
|
15827
|
+
summary?: string | null;
|
15828
|
+
customSummary?: string | null;
|
15829
|
+
keywords?: Array<string> | null;
|
15830
|
+
bullets?: Array<string> | null;
|
15831
|
+
headlines?: Array<string> | null;
|
15832
|
+
posts?: Array<string> | null;
|
15833
|
+
chapters?: Array<string> | null;
|
15834
|
+
questions?: Array<string> | null;
|
15835
|
+
error?: string | null;
|
15836
|
+
owner: {
|
15837
|
+
__typename?: 'Owner';
|
15838
|
+
id: string;
|
15839
|
+
};
|
15840
|
+
address?: {
|
15841
|
+
__typename?: 'Address';
|
15842
|
+
streetAddress?: string | null;
|
15843
|
+
city?: string | null;
|
15844
|
+
region?: string | null;
|
15845
|
+
country?: string | null;
|
15846
|
+
postalCode?: string | null;
|
15847
|
+
} | null;
|
15848
|
+
location?: {
|
15849
|
+
__typename?: 'Point';
|
15850
|
+
latitude?: number | null;
|
15851
|
+
longitude?: number | null;
|
15852
|
+
} | null;
|
15853
|
+
h3?: {
|
15854
|
+
__typename?: 'H3';
|
15855
|
+
h3r0?: string | null;
|
15856
|
+
h3r1?: string | null;
|
15857
|
+
h3r2?: string | null;
|
15858
|
+
h3r3?: string | null;
|
15859
|
+
h3r4?: string | null;
|
15860
|
+
h3r5?: string | null;
|
15861
|
+
h3r6?: string | null;
|
15862
|
+
h3r7?: string | null;
|
15863
|
+
h3r8?: string | null;
|
15864
|
+
h3r9?: string | null;
|
15865
|
+
h3r10?: string | null;
|
15866
|
+
h3r11?: string | null;
|
15867
|
+
h3r12?: string | null;
|
15868
|
+
h3r13?: string | null;
|
15869
|
+
h3r14?: string | null;
|
15870
|
+
h3r15?: string | null;
|
15871
|
+
} | null;
|
15872
|
+
video?: {
|
15873
|
+
__typename?: 'VideoMetadata';
|
15874
|
+
width?: number | null;
|
15875
|
+
height?: number | null;
|
15876
|
+
duration?: any | null;
|
15877
|
+
make?: string | null;
|
15878
|
+
model?: string | null;
|
15879
|
+
software?: string | null;
|
15880
|
+
title?: string | null;
|
15881
|
+
description?: string | null;
|
15882
|
+
keywords?: Array<string | null> | null;
|
15883
|
+
author?: string | null;
|
15884
|
+
} | null;
|
15885
|
+
audio?: {
|
15886
|
+
__typename?: 'AudioMetadata';
|
15887
|
+
keywords?: Array<string | null> | null;
|
15888
|
+
author?: string | null;
|
15889
|
+
series?: string | null;
|
15890
|
+
episode?: string | null;
|
15891
|
+
episodeType?: string | null;
|
15892
|
+
season?: string | null;
|
15893
|
+
publisher?: string | null;
|
15894
|
+
copyright?: string | null;
|
15895
|
+
genre?: string | null;
|
15896
|
+
title?: string | null;
|
15897
|
+
description?: string | null;
|
15898
|
+
bitrate?: number | null;
|
15899
|
+
channels?: number | null;
|
15900
|
+
sampleRate?: number | null;
|
15901
|
+
bitsPerSample?: number | null;
|
15902
|
+
duration?: any | null;
|
15903
|
+
} | null;
|
15904
|
+
image?: {
|
15905
|
+
__typename?: 'ImageMetadata';
|
15906
|
+
width?: number | null;
|
15907
|
+
height?: number | null;
|
15908
|
+
resolutionX?: number | null;
|
15909
|
+
resolutionY?: number | null;
|
15910
|
+
bitsPerComponent?: number | null;
|
15911
|
+
components?: number | null;
|
15912
|
+
projectionType?: ImageProjectionTypes | null;
|
15913
|
+
orientation?: OrientationTypes | null;
|
15914
|
+
description?: string | null;
|
15915
|
+
make?: string | null;
|
15916
|
+
model?: string | null;
|
15917
|
+
software?: string | null;
|
15918
|
+
lens?: string | null;
|
15919
|
+
focalLength?: number | null;
|
15920
|
+
exposureTime?: string | null;
|
15921
|
+
fNumber?: string | null;
|
15922
|
+
iso?: string | null;
|
15923
|
+
heading?: number | null;
|
15924
|
+
pitch?: number | null;
|
15925
|
+
} | null;
|
15926
|
+
document?: {
|
15927
|
+
__typename?: 'DocumentMetadata';
|
15928
|
+
title?: string | null;
|
15929
|
+
subject?: string | null;
|
15930
|
+
summary?: string | null;
|
15931
|
+
author?: string | null;
|
15932
|
+
publisher?: string | null;
|
15933
|
+
description?: string | null;
|
15934
|
+
keywords?: Array<string | null> | null;
|
15935
|
+
pageCount?: number | null;
|
15936
|
+
worksheetCount?: number | null;
|
15937
|
+
slideCount?: number | null;
|
15938
|
+
wordCount?: number | null;
|
15939
|
+
lineCount?: number | null;
|
15940
|
+
paragraphCount?: number | null;
|
15941
|
+
isEncrypted?: boolean | null;
|
15942
|
+
hasDigitalSignature?: boolean | null;
|
15943
|
+
} | null;
|
15944
|
+
email?: {
|
15945
|
+
__typename?: 'EmailMetadata';
|
15946
|
+
identifier?: string | null;
|
15947
|
+
threadIdentifier?: string | null;
|
15948
|
+
subject?: string | null;
|
15949
|
+
labels?: Array<string | null> | null;
|
15950
|
+
sensitivity?: MailSensitivity | null;
|
15951
|
+
priority?: MailPriority | null;
|
15952
|
+
importance?: MailImportance | null;
|
15953
|
+
from?: Array<{
|
15954
|
+
__typename?: 'PersonReference';
|
15955
|
+
name?: string | null;
|
15956
|
+
email?: string | null;
|
15957
|
+
givenName?: string | null;
|
15958
|
+
familyName?: string | null;
|
15959
|
+
} | null> | null;
|
15960
|
+
to?: Array<{
|
15961
|
+
__typename?: 'PersonReference';
|
15962
|
+
name?: string | null;
|
15963
|
+
email?: string | null;
|
15964
|
+
givenName?: string | null;
|
15965
|
+
familyName?: string | null;
|
15966
|
+
} | null> | null;
|
15967
|
+
cc?: Array<{
|
15968
|
+
__typename?: 'PersonReference';
|
15969
|
+
name?: string | null;
|
15970
|
+
email?: string | null;
|
15971
|
+
givenName?: string | null;
|
15972
|
+
familyName?: string | null;
|
15973
|
+
} | null> | null;
|
15974
|
+
bcc?: Array<{
|
15975
|
+
__typename?: 'PersonReference';
|
15976
|
+
name?: string | null;
|
15977
|
+
email?: string | null;
|
15978
|
+
givenName?: string | null;
|
15979
|
+
familyName?: string | null;
|
15980
|
+
} | null> | null;
|
15981
|
+
} | null;
|
15982
|
+
issue?: {
|
15983
|
+
__typename?: 'IssueMetadata';
|
15984
|
+
identifier?: string | null;
|
15985
|
+
title?: string | null;
|
15986
|
+
project?: string | null;
|
15987
|
+
team?: string | null;
|
15988
|
+
status?: string | null;
|
15989
|
+
priority?: string | null;
|
15990
|
+
type?: string | null;
|
15991
|
+
labels?: Array<string | null> | null;
|
15992
|
+
} | null;
|
15993
|
+
package?: {
|
15994
|
+
__typename?: 'PackageMetadata';
|
15995
|
+
fileCount?: number | null;
|
15996
|
+
folderCount?: number | null;
|
15997
|
+
isEncrypted?: boolean | null;
|
15998
|
+
} | null;
|
15999
|
+
language?: {
|
16000
|
+
__typename?: 'LanguageMetadata';
|
16001
|
+
languages?: Array<string | null> | null;
|
16002
|
+
} | null;
|
16003
|
+
parent?: {
|
16004
|
+
__typename?: 'Content';
|
16005
|
+
id: string;
|
16006
|
+
name: string;
|
16007
|
+
} | null;
|
16008
|
+
children?: Array<{
|
16009
|
+
__typename?: 'Content';
|
16010
|
+
id: string;
|
16011
|
+
name: string;
|
16012
|
+
} | null> | null;
|
16013
|
+
feed?: {
|
16014
|
+
__typename?: 'Feed';
|
16015
|
+
id: string;
|
16016
|
+
name: string;
|
16017
|
+
} | null;
|
16018
|
+
collections?: Array<{
|
16019
|
+
__typename?: 'Collection';
|
16020
|
+
id: string;
|
16021
|
+
name: string;
|
16022
|
+
} | null> | null;
|
16023
|
+
links?: Array<{
|
16024
|
+
__typename?: 'LinkReference';
|
16025
|
+
uri?: any | null;
|
16026
|
+
linkType?: LinkTypes | null;
|
16027
|
+
}> | null;
|
16028
|
+
observations?: Array<{
|
16029
|
+
__typename?: 'Observation';
|
16030
|
+
id: string;
|
16031
|
+
type: ObservableTypes;
|
16032
|
+
relatedType?: ObservableTypes | null;
|
16033
|
+
relation?: string | null;
|
16034
|
+
state: EntityState;
|
16035
|
+
observable: {
|
16036
|
+
__typename?: 'NamedEntityReference';
|
16037
|
+
id: string;
|
16038
|
+
name?: string | null;
|
16039
|
+
};
|
16040
|
+
related?: {
|
16041
|
+
__typename?: 'NamedEntityReference';
|
16042
|
+
id: string;
|
16043
|
+
name?: string | null;
|
16044
|
+
} | null;
|
16045
|
+
occurrences?: Array<{
|
16046
|
+
__typename?: 'ObservationOccurrence';
|
16047
|
+
type?: OccurrenceTypes | null;
|
16048
|
+
confidence?: number | null;
|
16049
|
+
startTime?: any | null;
|
16050
|
+
endTime?: any | null;
|
16051
|
+
pageIndex?: number | null;
|
16052
|
+
boundingBox?: {
|
16053
|
+
__typename?: 'BoundingBox';
|
16054
|
+
left?: number | null;
|
16055
|
+
top?: number | null;
|
16056
|
+
width?: number | null;
|
16057
|
+
height?: number | null;
|
16058
|
+
} | null;
|
16059
|
+
} | null> | null;
|
16060
|
+
} | null> | null;
|
16061
|
+
workflow?: {
|
16062
|
+
__typename?: 'Workflow';
|
16063
|
+
id: string;
|
16064
|
+
name: string;
|
16065
|
+
} | null;
|
16066
|
+
pages?: Array<{
|
16067
|
+
__typename?: 'TextPage';
|
16068
|
+
index?: number | null;
|
16069
|
+
text?: string | null;
|
16070
|
+
relevance?: number | null;
|
16071
|
+
images?: Array<{
|
16072
|
+
__typename?: 'ImageChunk';
|
16073
|
+
id?: string | null;
|
16074
|
+
mimeType?: string | null;
|
16075
|
+
data?: string | null;
|
16076
|
+
left?: number | null;
|
16077
|
+
right?: number | null;
|
16078
|
+
top?: number | null;
|
16079
|
+
bottom?: number | null;
|
16080
|
+
} | null> | null;
|
16081
|
+
chunks?: Array<{
|
16082
|
+
__typename?: 'TextChunk';
|
16083
|
+
index?: number | null;
|
16084
|
+
pageIndex?: number | null;
|
16085
|
+
rowIndex?: number | null;
|
16086
|
+
columnIndex?: number | null;
|
16087
|
+
confidence?: number | null;
|
16088
|
+
text?: string | null;
|
16089
|
+
role?: TextRoles | null;
|
16090
|
+
language?: string | null;
|
16091
|
+
relevance?: number | null;
|
16092
|
+
} | null> | null;
|
16093
|
+
}> | null;
|
16094
|
+
segments?: Array<{
|
16095
|
+
__typename?: 'TextSegment';
|
16096
|
+
startTime?: any | null;
|
16097
|
+
endTime?: any | null;
|
16098
|
+
text?: string | null;
|
16099
|
+
relevance?: number | null;
|
16100
|
+
}> | null;
|
16101
|
+
frames?: Array<{
|
16102
|
+
__typename?: 'TextFrame';
|
16103
|
+
index?: number | null;
|
16104
|
+
description?: string | null;
|
16105
|
+
text?: string | null;
|
16106
|
+
relevance?: number | null;
|
16107
|
+
}> | null;
|
16108
|
+
} | null> | null;
|
16109
|
+
} | null;
|
16110
|
+
};
|
15787
16111
|
export type PublishContentsMutationVariables = Exact<{
|
15788
16112
|
summaryPrompt?: InputMaybe<Scalars['String']['input']>;
|
15789
16113
|
publishPrompt: Scalars['String']['input'];
|
@@ -9,8 +9,13 @@ export declare class UIEventAdapter {
|
|
9
9
|
private onEvent;
|
10
10
|
private conversationId;
|
11
11
|
private model?;
|
12
|
+
private modelService?;
|
13
|
+
private tokenCount;
|
12
14
|
private currentMessage;
|
13
15
|
private isStreaming;
|
16
|
+
private streamStartTime;
|
17
|
+
private firstTokenTime;
|
18
|
+
private lastTokenTime;
|
14
19
|
private activeToolCalls;
|
15
20
|
private lastUpdateTime;
|
16
21
|
private updateTimer?;
|
@@ -21,6 +26,8 @@ export declare class UIEventAdapter {
|
|
21
26
|
smoothingEnabled?: boolean;
|
22
27
|
chunkingStrategy?: ChunkingStrategy;
|
23
28
|
smoothingDelay?: number;
|
29
|
+
model?: string;
|
30
|
+
modelService?: string;
|
24
31
|
});
|
25
32
|
/**
|
26
33
|
* Process a raw streaming event and emit appropriate UI events
|
@@ -8,8 +8,13 @@ export class UIEventAdapter {
|
|
8
8
|
onEvent;
|
9
9
|
conversationId;
|
10
10
|
model;
|
11
|
+
modelService;
|
12
|
+
tokenCount = 0;
|
11
13
|
currentMessage = "";
|
12
14
|
isStreaming = false;
|
15
|
+
streamStartTime = 0;
|
16
|
+
firstTokenTime = 0;
|
17
|
+
lastTokenTime = 0;
|
13
18
|
activeToolCalls = new Map();
|
14
19
|
lastUpdateTime = 0;
|
15
20
|
updateTimer;
|
@@ -20,6 +25,8 @@ export class UIEventAdapter {
|
|
20
25
|
this.onEvent = onEvent;
|
21
26
|
this.conversationId = conversationId;
|
22
27
|
this.smoothingDelay = options.smoothingDelay ?? 30;
|
28
|
+
this.model = options.model;
|
29
|
+
this.modelService = options.modelService;
|
23
30
|
if (options.smoothingEnabled) {
|
24
31
|
this.chunkBuffer = new ChunkBuffer(options.chunkingStrategy || "word");
|
25
32
|
}
|
@@ -84,6 +91,9 @@ export class UIEventAdapter {
|
|
84
91
|
handleStart(conversationId) {
|
85
92
|
this.conversationId = conversationId;
|
86
93
|
this.isStreaming = true;
|
94
|
+
this.streamStartTime = Date.now();
|
95
|
+
this.firstTokenTime = 0;
|
96
|
+
this.lastTokenTime = 0;
|
87
97
|
this.emitUIEvent({
|
88
98
|
type: "conversation_started",
|
89
99
|
conversationId,
|
@@ -92,6 +102,12 @@ export class UIEventAdapter {
|
|
92
102
|
});
|
93
103
|
}
|
94
104
|
handleToken(token) {
|
105
|
+
// Track timing for first token
|
106
|
+
const now = Date.now();
|
107
|
+
if (this.firstTokenTime === 0) {
|
108
|
+
this.firstTokenTime = now;
|
109
|
+
}
|
110
|
+
this.lastTokenTime = now;
|
95
111
|
if (this.chunkBuffer) {
|
96
112
|
const chunks = this.chunkBuffer.addToken(token);
|
97
113
|
// Add chunks to queue for all chunking modes (character, word, sentence)
|
@@ -178,7 +194,7 @@ export class UIEventAdapter {
|
|
178
194
|
}
|
179
195
|
}
|
180
196
|
this.isStreaming = false;
|
181
|
-
// Create final message
|
197
|
+
// Create final message with metadata
|
182
198
|
const finalMessage = {
|
183
199
|
__typename: "ConversationMessage",
|
184
200
|
role: ConversationRoleTypes.Assistant,
|
@@ -186,7 +202,26 @@ export class UIEventAdapter {
|
|
186
202
|
timestamp: new Date().toISOString(),
|
187
203
|
tokens: undefined, // Will be set by caller if available
|
188
204
|
toolCalls: Array.from(this.activeToolCalls.values()).map((t) => t.toolCall),
|
205
|
+
model: this.model,
|
206
|
+
modelService: this.modelService,
|
189
207
|
};
|
208
|
+
// Add final timing metadata
|
209
|
+
if (this.streamStartTime > 0) {
|
210
|
+
const totalTime = Date.now() - this.streamStartTime;
|
211
|
+
// Final throughput (chars/second)
|
212
|
+
finalMessage.throughput = totalTime > 0
|
213
|
+
? Math.round((this.currentMessage.length / totalTime) * 1000)
|
214
|
+
: 0;
|
215
|
+
// Total completion time in seconds
|
216
|
+
finalMessage.completionTime = totalTime / 1000;
|
217
|
+
// Add time to first token if we have it (useful metric)
|
218
|
+
if (this.firstTokenTime > 0) {
|
219
|
+
const ttft = this.firstTokenTime - this.streamStartTime;
|
220
|
+
if (process.env.DEBUG_GRAPHLIT_SDK_STREAMING) {
|
221
|
+
console.log(`⏱️ [UIEventAdapter] TTFT: ${ttft}ms | Total: ${totalTime}ms | Throughput: ${finalMessage.throughput} chars/s`);
|
222
|
+
}
|
223
|
+
}
|
224
|
+
}
|
190
225
|
this.emitUIEvent({
|
191
226
|
type: "conversation_completed",
|
192
227
|
message: finalMessage,
|
@@ -274,6 +309,27 @@ export class UIEventAdapter {
|
|
274
309
|
message: this.currentMessage,
|
275
310
|
timestamp: new Date().toISOString(),
|
276
311
|
};
|
312
|
+
// Add model metadata if available
|
313
|
+
if (this.model) {
|
314
|
+
message.model = this.model;
|
315
|
+
}
|
316
|
+
if (this.modelService) {
|
317
|
+
message.modelService = this.modelService;
|
318
|
+
}
|
319
|
+
// Add timing metadata if streaming has started
|
320
|
+
if (this.streamStartTime > 0) {
|
321
|
+
const now = Date.now();
|
322
|
+
const elapsedTime = now - this.streamStartTime;
|
323
|
+
// Calculate throughput (chars/second)
|
324
|
+
const throughput = elapsedTime > 0
|
325
|
+
? Math.round((this.currentMessage.length / elapsedTime) * 1000)
|
326
|
+
: 0;
|
327
|
+
message.throughput = throughput;
|
328
|
+
// Add completion time if we have it (in seconds to match API)
|
329
|
+
if (elapsedTime > 0) {
|
330
|
+
message.completionTime = elapsedTime / 1000;
|
331
|
+
}
|
332
|
+
}
|
277
333
|
this.emitUIEvent({
|
278
334
|
type: "message_update",
|
279
335
|
message,
|