@fencyai/react 0.1.82 → 0.1.84

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.
Files changed (136) hide show
  1. package/dist/assets/index.css +1 -0
  2. package/dist/chat/Chat.d.ts +8 -0
  3. package/dist/chat/ChatResponse.d.ts +5 -0
  4. package/dist/chat/EditableContent.d.ts +11 -0
  5. package/dist/chat/GhostWrapper.d.ts +10 -0
  6. package/dist/chat/MentionCategory.d.ts +5 -0
  7. package/dist/chat/MentionInput.d.ts +20 -0
  8. package/dist/chat/MentionOption.d.ts +5 -0
  9. package/dist/chat/MentionPopover.d.ts +10 -0
  10. package/dist/chat/hooks/useContentEditable.d.ts +10 -0
  11. package/dist/chat/hooks/useKeyboardNavigation.d.ts +10 -0
  12. package/dist/chat/hooks/useMentionParser.d.ts +15 -0
  13. package/dist/chat/hooks/useMentionRenderer.d.ts +22 -0
  14. package/dist/chat/hooks/useMentionState.d.ts +14 -0
  15. package/{lib → dist}/hooks/useFencyEventSource/index.d.ts +1 -1
  16. package/dist/hooks/useListMemoryTypes/index.d.ts +2 -0
  17. package/dist/hooks/usePaginatedQuery/index.d.ts +51 -0
  18. package/{lib → dist}/index.d.ts +8 -6
  19. package/dist/index.js +34858 -0
  20. package/{lib → dist}/provider/FencyContextValue.d.ts +1 -1
  21. package/{lib → dist}/provider/useFencyContext.d.ts +1 -1
  22. package/dist/types/AiModel.d.ts +2 -0
  23. package/{lib → dist}/types/CreateGeminiChatCompletionParams.d.ts +1 -2
  24. package/{lib → dist}/types/CreateOpenAiChatCompletionParams.d.ts +1 -2
  25. package/dist/types/FencyContext.d.ts +12 -0
  26. package/dist/types/ListMemoryTypesPage.d.ts +7 -0
  27. package/{lib/types/ListFilesParams.d.ts → dist/types/ListMemoryTypesParams.d.ts} +1 -1
  28. package/dist/types/ListMemoryTypesResult.d.ts +9 -0
  29. package/{lib → dist}/types/UseBasicChatCompletions.d.ts +3 -3
  30. package/dist/types/UseListMemoryTypes.d.ts +10 -0
  31. package/dist/types/UseListMemoryTypesProps.d.ts +3 -0
  32. package/{lib → dist}/types/UseStreamingChatCompletions.d.ts +3 -3
  33. package/{lib → dist}/types/index.d.ts +5 -13
  34. package/package.json +23 -15
  35. package/lib/hooks/useBasicChatCompletions/index.js +0 -92
  36. package/lib/hooks/useCreateFiles/index.d.ts +0 -3
  37. package/lib/hooks/useCreateFiles/index.js +0 -72
  38. package/lib/hooks/useFencyEventSource/index.js +0 -39
  39. package/lib/hooks/useListFiles/index.d.ts +0 -3
  40. package/lib/hooks/useListFiles/index.js +0 -125
  41. package/lib/hooks/useSearchFiles/index.d.ts +0 -2
  42. package/lib/hooks/useSearchFiles/index.js +0 -26
  43. package/lib/hooks/useStream/index.js +0 -73
  44. package/lib/hooks/useStream/toStreamData.js +0 -116
  45. package/lib/hooks/useStreamingChatCompletions/index.js +0 -205
  46. package/lib/hooks/useStructuredChatCompletions/index.js +0 -124
  47. package/lib/hooks/useWebsites/index.d.ts +0 -3
  48. package/lib/hooks/useWebsites/index.js +0 -55
  49. package/lib/index.js +0 -14
  50. package/lib/provider/FencyContextValue.js +0 -3
  51. package/lib/provider/FencyProvider.js +0 -32
  52. package/lib/provider/useFencyContext.js +0 -12
  53. package/lib/types/AiModel.d.ts +0 -4
  54. package/lib/types/AiModel.js +0 -1
  55. package/lib/types/BasicChatCompletion.js +0 -1
  56. package/lib/types/BasicChatCompletionData.js +0 -1
  57. package/lib/types/BasicChatCompletionResponse.js +0 -1
  58. package/lib/types/CreateBasicChatCompletionParams.js +0 -1
  59. package/lib/types/CreateClaudeChatCompletionParams.js +0 -1
  60. package/lib/types/CreateFileParams.d.ts +0 -9
  61. package/lib/types/CreateFileParams.js +0 -1
  62. package/lib/types/CreateGeminiChatCompletionParams.js +0 -1
  63. package/lib/types/CreateGenericChatCompletionParams.js +0 -169
  64. package/lib/types/CreateOpenAiChatCompletionParams.js +0 -1
  65. package/lib/types/CreateStreamResponse.js +0 -1
  66. package/lib/types/CreateStreamingChatCompletionParams.js +0 -1
  67. package/lib/types/CreateStreamingChatCompletionResponse.js +0 -1
  68. package/lib/types/CreateStructuredChatCompletionParams.js +0 -1
  69. package/lib/types/CreateWebsiteParams.d.ts +0 -5
  70. package/lib/types/CreateWebsiteParams.js +0 -1
  71. package/lib/types/FencyContext.d.ts +0 -6
  72. package/lib/types/FencyContext.js +0 -1
  73. package/lib/types/FencyProviderProps.js +0 -1
  74. package/lib/types/ListFilesPage.d.ts +0 -8
  75. package/lib/types/ListFilesPage.js +0 -1
  76. package/lib/types/ListFilesParams.js +0 -1
  77. package/lib/types/ListFilesResult.d.ts +0 -9
  78. package/lib/types/ListFilesResult.js +0 -1
  79. package/lib/types/SearchFilesParams.d.ts +0 -6
  80. package/lib/types/SearchFilesParams.js +0 -1
  81. package/lib/types/StreamData.js +0 -1
  82. package/lib/types/StreamError.js +0 -1
  83. package/lib/types/StreamingChatCompletion.js +0 -1
  84. package/lib/types/StreamingChatCompletionData.js +0 -1
  85. package/lib/types/StructuredChatCompletion.js +0 -1
  86. package/lib/types/StructuredChatCompletionData.js +0 -1
  87. package/lib/types/StructuredChatCompletionResponse.js +0 -1
  88. package/lib/types/UseBasicChatCompletions.js +0 -1
  89. package/lib/types/UseCreateFiles.d.ts +0 -6
  90. package/lib/types/UseCreateFiles.js +0 -1
  91. package/lib/types/UseCreateFilesProps.d.ts +0 -6
  92. package/lib/types/UseCreateFilesProps.js +0 -1
  93. package/lib/types/UseListFiles.d.ts +0 -10
  94. package/lib/types/UseListFiles.js +0 -1
  95. package/lib/types/UseListFilesProps.d.ts +0 -3
  96. package/lib/types/UseListFilesProps.js +0 -1
  97. package/lib/types/UseSearchFiles.d.ts +0 -6
  98. package/lib/types/UseSearchFiles.js +0 -1
  99. package/lib/types/UseStream.js +0 -1
  100. package/lib/types/UseStreamProps.js +0 -1
  101. package/lib/types/UseStreamingChatCompletions.js +0 -1
  102. package/lib/types/UseStreamingChatCompletionsProps.js +0 -1
  103. package/lib/types/UseStructuredChatCompletions.js +0 -1
  104. package/lib/types/UseWebsites.d.ts +0 -6
  105. package/lib/types/UseWebsites.js +0 -1
  106. package/lib/types/UseWebsitesProps.d.ts +0 -5
  107. package/lib/types/UseWebsitesProps.js +0 -1
  108. package/lib/types/index.js +0 -48
  109. /package/{lib → dist}/hooks/useBasicChatCompletions/index.d.ts +0 -0
  110. /package/{lib → dist}/hooks/useStream/index.d.ts +0 -0
  111. /package/{lib → dist}/hooks/useStream/toStreamData.d.ts +0 -0
  112. /package/{lib → dist}/hooks/useStreamingChatCompletions/index.d.ts +0 -0
  113. /package/{lib → dist}/hooks/useStructuredChatCompletions/index.d.ts +0 -0
  114. /package/{lib → dist}/provider/FencyProvider.d.ts +0 -0
  115. /package/{lib → dist}/types/BasicChatCompletion.d.ts +0 -0
  116. /package/{lib → dist}/types/BasicChatCompletionData.d.ts +0 -0
  117. /package/{lib → dist}/types/BasicChatCompletionResponse.d.ts +0 -0
  118. /package/{lib → dist}/types/CreateBasicChatCompletionParams.d.ts +0 -0
  119. /package/{lib → dist}/types/CreateClaudeChatCompletionParams.d.ts +0 -0
  120. /package/{lib → dist}/types/CreateGenericChatCompletionParams.d.ts +0 -0
  121. /package/{lib → dist}/types/CreateStreamResponse.d.ts +0 -0
  122. /package/{lib → dist}/types/CreateStreamingChatCompletionParams.d.ts +0 -0
  123. /package/{lib → dist}/types/CreateStreamingChatCompletionResponse.d.ts +0 -0
  124. /package/{lib → dist}/types/CreateStructuredChatCompletionParams.d.ts +0 -0
  125. /package/{lib → dist}/types/FencyProviderProps.d.ts +0 -0
  126. /package/{lib → dist}/types/StreamData.d.ts +0 -0
  127. /package/{lib → dist}/types/StreamError.d.ts +0 -0
  128. /package/{lib → dist}/types/StreamingChatCompletion.d.ts +0 -0
  129. /package/{lib → dist}/types/StreamingChatCompletionData.d.ts +0 -0
  130. /package/{lib → dist}/types/StructuredChatCompletion.d.ts +0 -0
  131. /package/{lib → dist}/types/StructuredChatCompletionData.d.ts +0 -0
  132. /package/{lib → dist}/types/StructuredChatCompletionResponse.d.ts +0 -0
  133. /package/{lib → dist}/types/UseStream.d.ts +0 -0
  134. /package/{lib → dist}/types/UseStreamProps.d.ts +0 -0
  135. /package/{lib → dist}/types/UseStreamingChatCompletionsProps.d.ts +0 -0
  136. /package/{lib → dist}/types/UseStructuredChatCompletions.d.ts +0 -0
@@ -1,169 +0,0 @@
1
- export const toSpecificChatCompletionParams = (openai, gemini, claude, generic) => {
2
- if (openai) {
3
- return {
4
- openai,
5
- };
6
- }
7
- if (gemini) {
8
- return {
9
- gemini,
10
- };
11
- }
12
- if (claude) {
13
- return {
14
- claude,
15
- };
16
- }
17
- if (generic) {
18
- if (isOpenAiModel(generic.model)) {
19
- return {
20
- openai: {
21
- model: generic.model,
22
- messages: generic.messages,
23
- temperature: generic.temperature,
24
- topP: generic.topP,
25
- },
26
- };
27
- }
28
- if (isGeminiModel(generic.model)) {
29
- return {
30
- gemini: {
31
- model: generic.model,
32
- messages: toGeminiChatCompletionMessages(generic.messages),
33
- systemPrompt: getSystemPromptFromMessages(generic.messages),
34
- temperature: generic.temperature,
35
- topP: generic.topP,
36
- topK: generic.topK,
37
- },
38
- };
39
- }
40
- if (isAnthropicModel(generic.model)) {
41
- return {
42
- claude: {
43
- model: generic.model,
44
- messages: toClaudeChatCompletionMessages(generic.messages),
45
- systemPrompt: getSystemPromptFromMessages(generic.messages),
46
- temperature: generic.temperature,
47
- topP: generic.topP,
48
- topK: generic.topK,
49
- },
50
- };
51
- }
52
- }
53
- throw new Error('No model provided');
54
- };
55
- const getSystemPromptFromMessages = (messages) => {
56
- const allSystemPrompts = messages
57
- .filter((message) => message.role === 'system')
58
- .map((message) => message.content);
59
- return allSystemPrompts.join('\n');
60
- };
61
- const toGeminiChatCompletionMessages = (messages) => {
62
- const convertedMessages = messages.flatMap((message) => {
63
- if (message.role === 'system') {
64
- return [];
65
- }
66
- if (message.role === 'user') {
67
- return [{ role: 'user', content: message.content }];
68
- }
69
- if (message.role === 'assistant') {
70
- return [{ role: 'model', content: message.content }];
71
- }
72
- return [];
73
- });
74
- return convertedMessages;
75
- };
76
- const toClaudeChatCompletionMessages = (messages) => {
77
- const convertedMessages = messages.flatMap((message) => {
78
- if (message.role === 'system') {
79
- return [];
80
- }
81
- if (message.role === 'user') {
82
- return [{ role: 'user', content: message.content }];
83
- }
84
- if (message.role === 'assistant') {
85
- return [{ role: 'assistant', content: message.content }];
86
- }
87
- return [];
88
- });
89
- return convertedMessages;
90
- };
91
- const isOpenAiModel = (model) => {
92
- switch (model) {
93
- // OpenAI models
94
- case 'gpt-4.1':
95
- return true;
96
- case 'gpt-4.1-mini':
97
- return true;
98
- case 'gpt-4.1-nano':
99
- return true;
100
- case 'gpt-4o':
101
- return true;
102
- case 'gpt-4o-mini':
103
- return true;
104
- // Gemini models
105
- case 'gemini-2.5-pro':
106
- return true;
107
- case 'gemini-2.5-flash':
108
- return true;
109
- case 'gemini-2.5-flash-lite-preview-06-17':
110
- return true;
111
- // Claude models
112
- case 'claude-opus-4-0':
113
- return true;
114
- case 'claude-sonnet-4-0':
115
- return true;
116
- }
117
- };
118
- const isGeminiModel = (model) => {
119
- switch (model) {
120
- case 'gpt-4.1':
121
- return false;
122
- case 'gpt-4.1-mini':
123
- return false;
124
- case 'gpt-4.1-nano':
125
- return false;
126
- case 'gpt-4o':
127
- return false;
128
- case 'gpt-4o-mini':
129
- return false;
130
- // Gemini models
131
- case 'gemini-2.5-pro':
132
- return true;
133
- case 'gemini-2.5-flash':
134
- return true;
135
- case 'gemini-2.5-flash-lite-preview-06-17':
136
- return true;
137
- // Claude models
138
- case 'claude-opus-4-0':
139
- return false;
140
- case 'claude-sonnet-4-0':
141
- return false;
142
- }
143
- };
144
- const isAnthropicModel = (model) => {
145
- switch (model) {
146
- case 'gpt-4.1':
147
- return false;
148
- case 'gpt-4.1-mini':
149
- return false;
150
- case 'gpt-4.1-nano':
151
- return false;
152
- case 'gpt-4o':
153
- return false;
154
- case 'gpt-4o-mini':
155
- return false;
156
- // Gemini models
157
- case 'gemini-2.5-pro':
158
- return false;
159
- case 'gemini-2.5-flash':
160
- return false;
161
- case 'gemini-2.5-flash-lite-preview-06-17':
162
- return false;
163
- // Claude models
164
- case 'claude-opus-4-0':
165
- return true;
166
- case 'claude-sonnet-4-0':
167
- return true;
168
- }
169
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- export interface CreateWebsiteParams {
2
- url: string;
3
- extractHtmlContent?: boolean;
4
- extractTextContent?: boolean;
5
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import { FencyInstance } from '@fencyai/js';
2
- export interface FencyContext {
3
- fency: FencyInstance;
4
- loading: boolean;
5
- error: Error | null;
6
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- import { PaginationDto } from '@fencyai/js/lib/openapi';
2
- import { FencyListFileItem } from '@fencyai/js/lib/types/FencyListFileItem';
3
- export interface ListFilesPage {
4
- items: FencyListFileItem[];
5
- hasNextPage: boolean;
6
- hasPreviousPage: boolean;
7
- pagination: PaginationDto;
8
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- import { ApiError } from '@fencyai/js';
2
- import { ListFilesPage } from './ListFilesPage';
3
- export type ListFilesResult = {
4
- type: 'success';
5
- page: ListFilesPage;
6
- } | {
7
- type: 'error';
8
- error: ApiError;
9
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- export interface SearchFilesParams {
2
- text: string;
3
- fetchClientSecret: () => Promise<{
4
- clientSecret: string;
5
- }>;
6
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import { CreateFileResponse, FencyFile } from '@fencyai/js';
2
- import { CreateFileParams } from './CreateFileParams';
3
- export interface UseCreateFiles {
4
- createFile: (params: CreateFileParams) => Promise<CreateFileResponse>;
5
- files: FencyFile[];
6
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import { FileSearchIndexReady, FileTextContentReady, FileUploadCompleted } from './StreamData';
2
- export interface UseCreateFilesProps {
3
- onUploadCompleted?: (event: FileUploadCompleted) => void;
4
- onTextContentReady?: (event: FileTextContentReady) => void;
5
- onFileSearchIndexReady?: (event: FileSearchIndexReady) => void;
6
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- import { ListFilesPage } from './ListFilesPage';
2
- import { ListFilesParams } from './ListFilesParams';
3
- import { ListFilesResult } from './ListFilesResult';
4
- export interface UseListFiles {
5
- listFirstPage: (params: ListFilesParams) => Promise<ListFilesResult>;
6
- listNextPage: (params: ListFilesParams) => Promise<ListFilesResult>;
7
- listPreviousPage: (params: ListFilesParams) => Promise<ListFilesResult>;
8
- refetchCurrentPage: () => Promise<ListFilesResult>;
9
- currentPage: ListFilesPage | null;
10
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export interface UseListFilesProps {
2
- pageSize?: number;
3
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import { FileSearchItem, SearchFilesResponse } from '@fencyai/js';
2
- import { SearchFilesParams } from './SearchFilesParams';
3
- export interface UseSearchFiles {
4
- searchFiles: (params: SearchFilesParams) => Promise<SearchFilesResponse>;
5
- searchResults?: FileSearchItem[];
6
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import { CreateWebsiteResponse, Website } from '@fencyai/js';
2
- import { CreateWebsiteParams } from './CreateWebsiteParams';
3
- export interface UseWebsites {
4
- websites: Website[];
5
- createWebsite: (params: CreateWebsiteParams) => Promise<CreateWebsiteResponse>;
6
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- import { WebsiteHtmlContentReady, WebsiteTextContentReady } from './StreamData';
2
- export interface UseWebsitesProps {
3
- onHtmlContentReady?: (event: WebsiteHtmlContentReady) => void;
4
- onTextContentReady?: (event: WebsiteTextContentReady) => void;
5
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,48 +0,0 @@
1
- // Provider types
2
- export * from './FencyContext';
3
- export * from './FencyProviderProps';
4
- // Chat completion parameter types
5
- export * from './CreateClaudeChatCompletionParams';
6
- export * from './CreateGeminiChatCompletionParams';
7
- export * from './CreateOpenAiChatCompletionParams';
8
- // Basic chat completion types
9
- export * from './BasicChatCompletion';
10
- export * from './BasicChatCompletionData';
11
- export * from './BasicChatCompletionResponse';
12
- export * from './CreateBasicChatCompletionParams';
13
- export * from './UseBasicChatCompletions';
14
- // Streaming chat completion types
15
- export * from './CreateStreamingChatCompletionParams';
16
- export * from './CreateStreamingChatCompletionResponse';
17
- export * from './StreamingChatCompletion';
18
- export * from './StreamingChatCompletionData';
19
- export * from './UseStreamingChatCompletions';
20
- export * from './UseStreamingChatCompletionsProps';
21
- // Structured chat completion types
22
- export * from './CreateStructuredChatCompletionParams';
23
- export * from './StructuredChatCompletion';
24
- export * from './StructuredChatCompletionData';
25
- export * from './StructuredChatCompletionResponse';
26
- export * from './UseStructuredChatCompletions';
27
- // Stream types
28
- export * from './CreateStreamResponse';
29
- export * from './StreamError';
30
- export * from './UseStream';
31
- export * from './UseStreamProps';
32
- // File upload types
33
- export * from './CreateFileParams';
34
- export * from './SearchFilesParams';
35
- export * from './UseSearchFiles';
36
- // Website types
37
- export * from './CreateWebsiteParams';
38
- export * from './UseWebsites';
39
- export * from './UseWebsitesProps';
40
- // List files types
41
- export * from './ListFilesPage';
42
- export * from './ListFilesParams';
43
- export * from './ListFilesResult';
44
- export * from './UseListFiles';
45
- export * from './UseListFilesProps';
46
- // Search files types
47
- export * from './SearchFilesParams';
48
- export * from './UseSearchFiles';
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes