@fencyai/react 0.1.81 → 0.1.83

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 (130) 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/{lib → dist}/index.d.ts +7 -3
  17. package/dist/index.js +34947 -0
  18. package/{lib → dist}/provider/FencyContextValue.d.ts +1 -1
  19. package/{lib → dist}/provider/useFencyContext.d.ts +1 -1
  20. package/dist/types/AiModel.d.ts +2 -0
  21. package/{lib → dist}/types/CreateGeminiChatCompletionParams.d.ts +1 -2
  22. package/{lib → dist}/types/CreateOpenAiChatCompletionParams.d.ts +1 -2
  23. package/dist/types/FencyContext.d.ts +12 -0
  24. package/{lib → dist}/types/UseBasicChatCompletions.d.ts +3 -3
  25. package/{lib → dist}/types/UseStreamingChatCompletions.d.ts +3 -3
  26. package/package.json +23 -15
  27. package/lib/hooks/useBasicChatCompletions/index.js +0 -92
  28. package/lib/hooks/useCreateFiles/index.js +0 -72
  29. package/lib/hooks/useFencyEventSource/index.js +0 -39
  30. package/lib/hooks/useListFiles/index.js +0 -125
  31. package/lib/hooks/useSearchFiles/index.js +0 -26
  32. package/lib/hooks/useStream/index.js +0 -73
  33. package/lib/hooks/useStream/toStreamData.js +0 -116
  34. package/lib/hooks/useStreamingChatCompletions/index.js +0 -205
  35. package/lib/hooks/useStructuredChatCompletions/index.js +0 -124
  36. package/lib/hooks/useWebsites/index.js +0 -55
  37. package/lib/index.js +0 -14
  38. package/lib/provider/FencyContextValue.js +0 -3
  39. package/lib/provider/FencyProvider.js +0 -32
  40. package/lib/provider/useFencyContext.js +0 -12
  41. package/lib/types/AiModel.d.ts +0 -4
  42. package/lib/types/AiModel.js +0 -1
  43. package/lib/types/BasicChatCompletion.js +0 -1
  44. package/lib/types/BasicChatCompletionData.js +0 -1
  45. package/lib/types/BasicChatCompletionResponse.js +0 -1
  46. package/lib/types/CreateBasicChatCompletionParams.js +0 -1
  47. package/lib/types/CreateClaudeChatCompletionParams.js +0 -1
  48. package/lib/types/CreateFileParams.js +0 -1
  49. package/lib/types/CreateGeminiChatCompletionParams.js +0 -1
  50. package/lib/types/CreateGenericChatCompletionParams.js +0 -169
  51. package/lib/types/CreateOpenAiChatCompletionParams.js +0 -1
  52. package/lib/types/CreateStreamResponse.js +0 -1
  53. package/lib/types/CreateStreamingChatCompletionParams.js +0 -1
  54. package/lib/types/CreateStreamingChatCompletionResponse.js +0 -1
  55. package/lib/types/CreateStructuredChatCompletionParams.js +0 -1
  56. package/lib/types/CreateWebsiteParams.js +0 -1
  57. package/lib/types/FencyContext.d.ts +0 -6
  58. package/lib/types/FencyContext.js +0 -1
  59. package/lib/types/FencyProviderProps.js +0 -1
  60. package/lib/types/ListFilesPage.js +0 -1
  61. package/lib/types/ListFilesParams.js +0 -1
  62. package/lib/types/ListFilesResult.js +0 -1
  63. package/lib/types/SearchFilesParams.js +0 -1
  64. package/lib/types/StreamData.js +0 -1
  65. package/lib/types/StreamError.js +0 -1
  66. package/lib/types/StreamingChatCompletion.js +0 -1
  67. package/lib/types/StreamingChatCompletionData.js +0 -1
  68. package/lib/types/StructuredChatCompletion.js +0 -1
  69. package/lib/types/StructuredChatCompletionData.js +0 -1
  70. package/lib/types/StructuredChatCompletionResponse.js +0 -1
  71. package/lib/types/UseBasicChatCompletions.js +0 -1
  72. package/lib/types/UseCreateFiles.js +0 -1
  73. package/lib/types/UseCreateFilesProps.js +0 -1
  74. package/lib/types/UseListFiles.js +0 -1
  75. package/lib/types/UseListFilesProps.js +0 -1
  76. package/lib/types/UseSearchFiles.js +0 -1
  77. package/lib/types/UseStream.js +0 -1
  78. package/lib/types/UseStreamProps.js +0 -1
  79. package/lib/types/UseStreamingChatCompletions.js +0 -1
  80. package/lib/types/UseStreamingChatCompletionsProps.js +0 -1
  81. package/lib/types/UseStructuredChatCompletions.js +0 -1
  82. package/lib/types/UseWebsites.js +0 -1
  83. package/lib/types/UseWebsitesProps.js +0 -1
  84. package/lib/types/index.js +0 -48
  85. /package/{lib → dist}/hooks/useBasicChatCompletions/index.d.ts +0 -0
  86. /package/{lib → dist}/hooks/useCreateFiles/index.d.ts +0 -0
  87. /package/{lib → dist}/hooks/useListFiles/index.d.ts +0 -0
  88. /package/{lib → dist}/hooks/useSearchFiles/index.d.ts +0 -0
  89. /package/{lib → dist}/hooks/useStream/index.d.ts +0 -0
  90. /package/{lib → dist}/hooks/useStream/toStreamData.d.ts +0 -0
  91. /package/{lib → dist}/hooks/useStreamingChatCompletions/index.d.ts +0 -0
  92. /package/{lib → dist}/hooks/useStructuredChatCompletions/index.d.ts +0 -0
  93. /package/{lib → dist}/hooks/useWebsites/index.d.ts +0 -0
  94. /package/{lib → dist}/provider/FencyProvider.d.ts +0 -0
  95. /package/{lib → dist}/types/BasicChatCompletion.d.ts +0 -0
  96. /package/{lib → dist}/types/BasicChatCompletionData.d.ts +0 -0
  97. /package/{lib → dist}/types/BasicChatCompletionResponse.d.ts +0 -0
  98. /package/{lib → dist}/types/CreateBasicChatCompletionParams.d.ts +0 -0
  99. /package/{lib → dist}/types/CreateClaudeChatCompletionParams.d.ts +0 -0
  100. /package/{lib → dist}/types/CreateFileParams.d.ts +0 -0
  101. /package/{lib → dist}/types/CreateGenericChatCompletionParams.d.ts +0 -0
  102. /package/{lib → dist}/types/CreateStreamResponse.d.ts +0 -0
  103. /package/{lib → dist}/types/CreateStreamingChatCompletionParams.d.ts +0 -0
  104. /package/{lib → dist}/types/CreateStreamingChatCompletionResponse.d.ts +0 -0
  105. /package/{lib → dist}/types/CreateStructuredChatCompletionParams.d.ts +0 -0
  106. /package/{lib → dist}/types/CreateWebsiteParams.d.ts +0 -0
  107. /package/{lib → dist}/types/FencyProviderProps.d.ts +0 -0
  108. /package/{lib → dist}/types/ListFilesPage.d.ts +0 -0
  109. /package/{lib → dist}/types/ListFilesParams.d.ts +0 -0
  110. /package/{lib → dist}/types/ListFilesResult.d.ts +0 -0
  111. /package/{lib → dist}/types/SearchFilesParams.d.ts +0 -0
  112. /package/{lib → dist}/types/StreamData.d.ts +0 -0
  113. /package/{lib → dist}/types/StreamError.d.ts +0 -0
  114. /package/{lib → dist}/types/StreamingChatCompletion.d.ts +0 -0
  115. /package/{lib → dist}/types/StreamingChatCompletionData.d.ts +0 -0
  116. /package/{lib → dist}/types/StructuredChatCompletion.d.ts +0 -0
  117. /package/{lib → dist}/types/StructuredChatCompletionData.d.ts +0 -0
  118. /package/{lib → dist}/types/StructuredChatCompletionResponse.d.ts +0 -0
  119. /package/{lib → dist}/types/UseCreateFiles.d.ts +0 -0
  120. /package/{lib → dist}/types/UseCreateFilesProps.d.ts +0 -0
  121. /package/{lib → dist}/types/UseListFiles.d.ts +0 -0
  122. /package/{lib → dist}/types/UseListFilesProps.d.ts +0 -0
  123. /package/{lib → dist}/types/UseSearchFiles.d.ts +0 -0
  124. /package/{lib → dist}/types/UseStream.d.ts +0 -0
  125. /package/{lib → dist}/types/UseStreamProps.d.ts +0 -0
  126. /package/{lib → dist}/types/UseStreamingChatCompletionsProps.d.ts +0 -0
  127. /package/{lib → dist}/types/UseStructuredChatCompletions.d.ts +0 -0
  128. /package/{lib → dist}/types/UseWebsites.d.ts +0 -0
  129. /package/{lib → dist}/types/UseWebsitesProps.d.ts +0 -0
  130. /package/{lib → dist}/types/index.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 +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 +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 +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 +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,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
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes