@nlweb-ai/search-components 0.1.9

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 nlweb-ai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,200 @@
1
+ # @nlweb-ai/search-components
2
+
3
+ A React component library for integrating nlweb search capabilities into your applications. Built with TypeScript and Tailwind CSS.
4
+ [Playground](https://nlweb-ai.github.io/search-components/)
5
+
6
+ ## Features
7
+
8
+ - 🔍 **nlweb Integration** - Connect directly to nlweb search API
9
+ - 💬 **Chat Interface** - Conversational search experience
10
+ - 🎨 **Styled with Tailwind CSS** - Beautiful, customizable components
11
+ - 📦 **TypeScript Support** - Full type definitions included
12
+ - ⚡ **Tree-shakeable** - Optimized bundle size
13
+ - 📱 **Responsive** - Mobile-friendly designs
14
+
15
+
16
+ ## Installation
17
+
18
+ This package is published to GitHub Packages. First, configure your `~/.npmrc`:
19
+
20
+ ```bash
21
+ @nlweb-ai:registry=https://npm.pkg.github.com
22
+ ```
23
+
24
+ **Authentication Required**: To install packages from GitHub Packages, you need to authenticate with a GitHub Personal Access Token (PAT) with `read:packages` scope. Add the following line to your `.npmrc`:
25
+
26
+ ```bash
27
+ //npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
28
+ ```
29
+
30
+ Or set the token as an environment variable:
31
+
32
+ ```bash
33
+ export GITHUB_TOKEN=your_token_here
34
+ ```
35
+
36
+ Then install the package using pnpm:
37
+
38
+ ```bash
39
+ pnpm add @nlweb-ai/search-components
40
+ ```
41
+
42
+ Or using npm:
43
+
44
+ ```bash
45
+ npm install @nlweb-ai/search-components
46
+ ```
47
+
48
+ Or using yarn:
49
+
50
+ ```bash
51
+ yarn add @nlweb-ai/search-components
52
+ ```
53
+
54
+ ## Components
55
+
56
+ ### ChatSearch
57
+
58
+ The main component for integrating nlweb's conversational search interface into your application. It provides a complete chat-based search experience with message history, streaming responses, and rich search results.
59
+
60
+ ```tsx
61
+ import { ChatSearch } from '@nlweb-ai/search-components';
62
+
63
+ function App() {
64
+ return (
65
+ <ChatSearch
66
+ endpoint="https://your-nlweb-endpoint.com/ask"
67
+ site="your-site-domain.com"
68
+ />
69
+ );
70
+ }
71
+ ```
72
+
73
+ > **Note**: Styles are automatically injected when you import the components. No need to import CSS separately.
74
+
75
+ ## Hooks
76
+
77
+ ### useNlWeb Hook
78
+
79
+ A custom React hook for direct integration with the nlweb search API. Use this hook when you need more control over the search experience or want to build your own custom UI.
80
+
81
+ ```tsx
82
+ import { useNlWeb } from '@nlweb-ai/search-components';
83
+
84
+ function SearchComponent() {
85
+ const nlweb = useNlWeb({
86
+ endpoint: 'https://your-nlweb-endpoint.com/ask',
87
+ site: 'your-site-domain.com',
88
+ maxResults: 50 // optional, defaults to 50
89
+ });
90
+
91
+ const handleSearch = async () => {
92
+ const response = await nlweb.search({
93
+ query: 'your search query',
94
+ conversationHistory: [], // optional
95
+ numResults: 10, // optional
96
+ userId: 'user-123', // optional
97
+ remember: true // optional
98
+ });
99
+ };
100
+
101
+ return (
102
+ <div>
103
+ {nlweb.isLoading && <p>Loading...</p>}
104
+ {nlweb.error && <p>Error: {nlweb.error}</p>}
105
+ {nlweb.summary && <p>{nlweb.summary}</p>}
106
+ <ul>
107
+ {nlweb.results.map((result, i) => (
108
+ <li key={i}>{result.name}</li>
109
+ ))}
110
+ </ul>
111
+ </div>
112
+ );
113
+ }
114
+ ```
115
+
116
+ ## Examples
117
+
118
+ To see live examples and interact with the components, start the Storybook development environment:
119
+
120
+ ```bash
121
+ pnpm storybook
122
+ ```
123
+
124
+ This will launch an interactive playground where you can:
125
+ - See the ChatSearch component in action
126
+ - Experiment with different configurations
127
+ - Test the component with your own API key
128
+ - Explore the component's features and capabilities
129
+
130
+ ## Development
131
+
132
+ ### Setup
133
+
134
+ ```bash
135
+ # Install dependencies
136
+ pnpm install
137
+
138
+ # Run type checking
139
+ pnpm run typecheck
140
+
141
+ # Run linting
142
+ pnpm run lint
143
+
144
+ # Format code
145
+ pnpm run format
146
+
147
+ # Build the library
148
+ pnpm run build
149
+
150
+ # Watch mode for development
151
+ pnpm run dev
152
+ ```
153
+
154
+ ### Publishing
155
+
156
+ The package is configured to publish to GitHub Packages. Make sure you have the proper authentication token configured.
157
+
158
+ ```bash
159
+ # Build and publish
160
+ pnpm run build
161
+ pnpm publish
162
+ ```
163
+
164
+ ## Component Props
165
+
166
+ ### ChatSearch
167
+
168
+ | Prop | Type | Default | Description |
169
+ |------|------|---------|-------------|
170
+ | `endpoint` | `string` | - | The nlweb API endpoint URL (required) |
171
+ | `site` | `string` | - | The site domain to search within (required) |
172
+
173
+ ### useNlWeb Hook
174
+
175
+ **Configuration:**
176
+
177
+ | Property | Type | Default | Description |
178
+ |----------|------|---------|-------------|
179
+ | `endpoint` | `string` | - | The nlweb API endpoint URL (required) |
180
+ | `site` | `string` | - | The site domain to search within (required) |
181
+ | `maxResults` | `number` | `50` | Maximum number of results to return |
182
+
183
+ **Returned State:**
184
+
185
+ | Property | Type | Description |
186
+ |----------|------|-------------|
187
+ | `results` | `NlwebResult[]` | Array of search results |
188
+ | `summary` | `string \| undefined` | AI-generated summary of the search results |
189
+ | `decontextualizedQuery` | `string \| undefined` | The reformulated query for better context |
190
+ | `isLoading` | `boolean` | Loading state indicator |
191
+ | `error` | `string \| null` | Error message if search fails |
192
+ | `search` | `(params: NLWebSearchParams) => Promise<SearchResponse>` | Function to perform a search |
193
+ | `cancelSearch` | `() => void` | Function to cancel ongoing search |
194
+ | `clearResults` | `() => void` | Function to clear search results |
195
+
196
+ For more detailed usage examples and advanced configurations, please refer to the Storybook documentation (run `pnpm storybook`).
197
+
198
+ ## License
199
+
200
+ MIT
@@ -0,0 +1,317 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import { z } from 'zod';
4
+
5
+ declare const RecipeSchema: z.ZodObject<{
6
+ "@type": z.ZodUnion<readonly [z.ZodLiteral<"Recipe">, z.ZodArray<z.ZodString>]>;
7
+ "@id": z.ZodString;
8
+ score: z.ZodNumber;
9
+ site: z.ZodString;
10
+ name: z.ZodOptional<z.ZodString>;
11
+ recipeIngredient: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodString]>>;
12
+ recipeInstructions: z.ZodOptional<z.ZodAny>;
13
+ recipeYield: z.ZodOptional<z.ZodAny>;
14
+ cookTime: z.ZodOptional<z.ZodString>;
15
+ prepTime: z.ZodOptional<z.ZodString>;
16
+ totalTime: z.ZodOptional<z.ZodString>;
17
+ description: z.ZodOptional<z.ZodString>;
18
+ image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
19
+ "@type": z.ZodOptional<z.ZodLiteral<"ImageObject">>;
20
+ "@id": z.ZodString;
21
+ url: z.ZodOptional<z.ZodString>;
22
+ contentUrl: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$loose>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
24
+ "@type": z.ZodOptional<z.ZodLiteral<"ImageObject">>;
25
+ "@id": z.ZodString;
26
+ url: z.ZodOptional<z.ZodString>;
27
+ contentUrl: z.ZodOptional<z.ZodString>;
28
+ }, z.core.$loose>]>>]>>;
29
+ }, z.core.$loose>;
30
+ type RecipeResult = z.infer<typeof RecipeSchema>;
31
+ declare const ArticleSchema: z.ZodObject<{
32
+ "@type": z.ZodUnion<readonly [z.ZodLiteral<"Article">, z.ZodLiteral<"NewsArticle">, z.ZodLiteral<"BlogPosting">, z.ZodArray<z.ZodString>]>;
33
+ "@id": z.ZodString;
34
+ score: z.ZodNumber;
35
+ site: z.ZodString;
36
+ headline: z.ZodOptional<z.ZodString>;
37
+ description: z.ZodOptional<z.ZodString>;
38
+ image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
39
+ "@type": z.ZodOptional<z.ZodLiteral<"ImageObject">>;
40
+ "@id": z.ZodString;
41
+ url: z.ZodOptional<z.ZodString>;
42
+ contentUrl: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$loose>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
44
+ "@type": z.ZodOptional<z.ZodLiteral<"ImageObject">>;
45
+ "@id": z.ZodString;
46
+ url: z.ZodOptional<z.ZodString>;
47
+ contentUrl: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$loose>]>>]>>;
49
+ author: z.ZodOptional<z.ZodAny>;
50
+ publisher: z.ZodOptional<z.ZodAny>;
51
+ datePublished: z.ZodOptional<z.ZodString>;
52
+ dateModified: z.ZodOptional<z.ZodString>;
53
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
54
+ }, z.core.$loose>;
55
+ type ArticleResult = z.infer<typeof ArticleSchema>;
56
+ declare const MovieSchema: z.ZodObject<{
57
+ "@type": z.ZodUnion<readonly [z.ZodLiteral<"Movie">, z.ZodArray<z.ZodString>]>;
58
+ "@id": z.ZodString;
59
+ score: z.ZodNumber;
60
+ site: z.ZodString;
61
+ name: z.ZodOptional<z.ZodString>;
62
+ description: z.ZodOptional<z.ZodString>;
63
+ image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
64
+ "@type": z.ZodOptional<z.ZodLiteral<"ImageObject">>;
65
+ "@id": z.ZodString;
66
+ url: z.ZodOptional<z.ZodString>;
67
+ contentUrl: z.ZodOptional<z.ZodString>;
68
+ }, z.core.$loose>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
69
+ "@type": z.ZodOptional<z.ZodLiteral<"ImageObject">>;
70
+ "@id": z.ZodString;
71
+ url: z.ZodOptional<z.ZodString>;
72
+ contentUrl: z.ZodOptional<z.ZodString>;
73
+ }, z.core.$loose>]>>]>>;
74
+ url: z.ZodOptional<z.ZodString>;
75
+ genre: z.ZodOptional<z.ZodArray<z.ZodString>>;
76
+ datePublished: z.ZodOptional<z.ZodString>;
77
+ director: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
78
+ "@type": z.ZodOptional<z.ZodLiteral<"Person">>;
79
+ name: z.ZodString;
80
+ url: z.ZodOptional<z.ZodString>;
81
+ }, z.core.$loose>, z.ZodArray<z.ZodObject<{
82
+ "@type": z.ZodOptional<z.ZodLiteral<"Person">>;
83
+ name: z.ZodString;
84
+ url: z.ZodOptional<z.ZodString>;
85
+ }, z.core.$loose>>]>>;
86
+ actor: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
87
+ "@type": z.ZodOptional<z.ZodLiteral<"Person">>;
88
+ name: z.ZodString;
89
+ url: z.ZodOptional<z.ZodString>;
90
+ }, z.core.$loose>, z.ZodArray<z.ZodObject<{
91
+ "@type": z.ZodOptional<z.ZodLiteral<"Person">>;
92
+ name: z.ZodString;
93
+ url: z.ZodOptional<z.ZodString>;
94
+ }, z.core.$loose>>]>>;
95
+ aggregateRating: z.ZodOptional<z.ZodObject<{
96
+ "@type": z.ZodOptional<z.ZodLiteral<"AggregateRating">>;
97
+ ratingValue: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
98
+ bestRating: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
99
+ worstRating: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
100
+ ratingCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
101
+ reviewCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
102
+ }, z.core.$loose>>;
103
+ duration: z.ZodOptional<z.ZodString>;
104
+ contentRating: z.ZodOptional<z.ZodString>;
105
+ productionCompany: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
106
+ "@type": z.ZodOptional<z.ZodLiteral<"Organization">>;
107
+ name: z.ZodString;
108
+ url: z.ZodOptional<z.ZodString>;
109
+ }, z.core.$loose>, z.ZodArray<z.ZodObject<{
110
+ "@type": z.ZodOptional<z.ZodLiteral<"Organization">>;
111
+ name: z.ZodString;
112
+ url: z.ZodOptional<z.ZodString>;
113
+ }, z.core.$loose>>]>>;
114
+ trailer: z.ZodOptional<z.ZodObject<{
115
+ "@type": z.ZodOptional<z.ZodLiteral<"VideoObject">>;
116
+ name: z.ZodOptional<z.ZodString>;
117
+ description: z.ZodOptional<z.ZodString>;
118
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
119
+ uploadDate: z.ZodOptional<z.ZodString>;
120
+ contentUrl: z.ZodOptional<z.ZodString>;
121
+ embedUrl: z.ZodOptional<z.ZodString>;
122
+ duration: z.ZodOptional<z.ZodString>;
123
+ }, z.core.$loose>>;
124
+ review: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
125
+ "@type": z.ZodOptional<z.ZodLiteral<"Review">>;
126
+ datePublished: z.ZodOptional<z.ZodString>;
127
+ reviewBody: z.ZodOptional<z.ZodString>;
128
+ reviewRating: z.ZodOptional<z.ZodObject<{
129
+ "@type": z.ZodOptional<z.ZodLiteral<"Rating">>;
130
+ ratingValue: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
131
+ bestRating: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
132
+ worstRating: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
133
+ }, z.core.$loose>>;
134
+ author: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
135
+ "@type": z.ZodOptional<z.ZodLiteral<"Person">>;
136
+ name: z.ZodString;
137
+ url: z.ZodOptional<z.ZodString>;
138
+ }, z.core.$loose>, z.ZodObject<{
139
+ "@type": z.ZodOptional<z.ZodLiteral<"Organization">>;
140
+ name: z.ZodString;
141
+ url: z.ZodOptional<z.ZodString>;
142
+ }, z.core.$loose>, z.ZodString]>>;
143
+ }, z.core.$loose>, z.ZodArray<z.ZodObject<{
144
+ "@type": z.ZodOptional<z.ZodLiteral<"Review">>;
145
+ datePublished: z.ZodOptional<z.ZodString>;
146
+ reviewBody: z.ZodOptional<z.ZodString>;
147
+ reviewRating: z.ZodOptional<z.ZodObject<{
148
+ "@type": z.ZodOptional<z.ZodLiteral<"Rating">>;
149
+ ratingValue: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
150
+ bestRating: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
151
+ worstRating: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
152
+ }, z.core.$loose>>;
153
+ author: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
154
+ "@type": z.ZodOptional<z.ZodLiteral<"Person">>;
155
+ name: z.ZodString;
156
+ url: z.ZodOptional<z.ZodString>;
157
+ }, z.core.$loose>, z.ZodObject<{
158
+ "@type": z.ZodOptional<z.ZodLiteral<"Organization">>;
159
+ name: z.ZodString;
160
+ url: z.ZodOptional<z.ZodString>;
161
+ }, z.core.$loose>, z.ZodString]>>;
162
+ }, z.core.$loose>>]>>;
163
+ sameAs: z.ZodOptional<z.ZodArray<z.ZodString>>;
164
+ countryOfOrigin: z.ZodOptional<z.ZodAny>;
165
+ musicBy: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
166
+ "@type": z.ZodOptional<z.ZodLiteral<"Person">>;
167
+ name: z.ZodString;
168
+ url: z.ZodOptional<z.ZodString>;
169
+ }, z.core.$loose>, z.ZodArray<z.ZodObject<{
170
+ "@type": z.ZodOptional<z.ZodLiteral<"Person">>;
171
+ name: z.ZodString;
172
+ url: z.ZodOptional<z.ZodString>;
173
+ }, z.core.$loose>>]>>;
174
+ producer: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
175
+ "@type": z.ZodOptional<z.ZodLiteral<"Person">>;
176
+ name: z.ZodString;
177
+ url: z.ZodOptional<z.ZodString>;
178
+ }, z.core.$loose>, z.ZodObject<{
179
+ "@type": z.ZodOptional<z.ZodLiteral<"Organization">>;
180
+ name: z.ZodString;
181
+ url: z.ZodOptional<z.ZodString>;
182
+ }, z.core.$loose>, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
183
+ "@type": z.ZodOptional<z.ZodLiteral<"Person">>;
184
+ name: z.ZodString;
185
+ url: z.ZodOptional<z.ZodString>;
186
+ }, z.core.$loose>, z.ZodObject<{
187
+ "@type": z.ZodOptional<z.ZodLiteral<"Organization">>;
188
+ name: z.ZodString;
189
+ url: z.ZodOptional<z.ZodString>;
190
+ }, z.core.$loose>]>>]>>;
191
+ }, z.core.$loose>;
192
+ type MovieResult = z.infer<typeof MovieSchema>;
193
+ type NlwebResult = RecipeResult | ArticleResult | MovieResult;
194
+
195
+ /**
196
+ * Search state
197
+ */
198
+ interface NLWebSearchState {
199
+ results: NlwebResult[];
200
+ resultOffset?: number;
201
+ streamingIndex: number;
202
+ summary?: string;
203
+ decontextualizedQuery?: string;
204
+ query: string | null;
205
+ loading: boolean;
206
+ error: string | null;
207
+ rawLogs?: object[];
208
+ }
209
+ interface NLWeb extends NLWebSearchState {
210
+ search: (params: NLWebSearchParams) => Promise<SearchResponse>;
211
+ cancelSearch: () => void;
212
+ clearResults: () => void;
213
+ }
214
+ /**
215
+ * Search request parameters
216
+ */
217
+ interface NLWebSearchParams {
218
+ query: string;
219
+ mode?: "list" | "list,summarize";
220
+ userId?: string;
221
+ remember?: boolean;
222
+ conversationHistory?: string[];
223
+ resultOffset?: number;
224
+ }
225
+ /**
226
+ * Hook configuration
227
+ */
228
+ interface UseNlWebConfig {
229
+ endpoint: string;
230
+ site: string;
231
+ maxResults?: number;
232
+ numRetrievalResults?: number;
233
+ }
234
+ interface SearchResponse {
235
+ results: NlwebResult[];
236
+ decontextualizedQuery?: string;
237
+ summary?: string;
238
+ rawLogs?: object[];
239
+ }
240
+ /**
241
+ * Custom hook for NLWeb search with SSE streaming support
242
+ *
243
+ * @param config - Hook configuration including endpoint URL
244
+ * @returns Search state and search function
245
+ */
246
+ declare function useNlWeb(config: UseNlWebConfig): NLWeb;
247
+
248
+ interface QueryResultSet {
249
+ id?: string;
250
+ sessionId: string;
251
+ query: string;
252
+ response: SearchResponse;
253
+ }
254
+ interface Backend {
255
+ site: string;
256
+ endpoint: string;
257
+ }
258
+ interface SearchSession {
259
+ query: string;
260
+ sessionId: string;
261
+ backend: Backend;
262
+ updated: Date;
263
+ created: Date;
264
+ }
265
+
266
+ declare function useSearchSessions(): {
267
+ sessions: SearchSession[];
268
+ startSession: (sessionId: string, query: string, backend: Backend) => Promise<void>;
269
+ deleteSession: (sessionId: string) => Promise<void>;
270
+ };
271
+ interface SearchSessionManager {
272
+ searches: QueryResultSet[];
273
+ addSearch: (data: QueryResultSet) => Promise<void>;
274
+ addResults: (id: string, results: NlwebResult[]) => Promise<void>;
275
+ }
276
+ declare function useSearchSession(sessionId: string | null): SearchSessionManager;
277
+
278
+ declare function ChatSearch({ searches, addSearch, addResults, startSession, endSession, nlweb, config, children, sidebar, sessionId, }: {
279
+ sessionId?: string;
280
+ searches: QueryResultSet[];
281
+ addSearch: (r: QueryResultSet) => Promise<void> | void;
282
+ addResults: (id: string, results: NlwebResult[]) => Promise<void>;
283
+ startSession: (query: string) => Promise<string> | void;
284
+ endSession: () => void;
285
+ nlweb: NLWeb;
286
+ config: UseNlWebConfig;
287
+ children?: ReactNode;
288
+ sidebar?: ReactNode;
289
+ }): react_jsx_runtime.JSX.Element;
290
+
291
+ declare function HistorySidebar({ selected, sessions, onSelect, onDelete, onCreate, }: {
292
+ selected?: string;
293
+ sessions: SearchSession[];
294
+ onSelect: (session: SearchSession) => void;
295
+ onDelete: (sessionId: string) => void;
296
+ onCreate: () => void;
297
+ }): react_jsx_runtime.JSX.Element;
298
+
299
+ declare function DebugTool({ searches, streamingState, config, }: {
300
+ searches: QueryResultSet[];
301
+ streamingState: NLWebSearchState;
302
+ config: UseNlWebConfig;
303
+ }): react_jsx_runtime.JSX.Element;
304
+
305
+ interface Site {
306
+ featured?: boolean;
307
+ url: string;
308
+ }
309
+ interface SiteDropdownProps {
310
+ sites: Site[];
311
+ selected: Site;
312
+ onSelect: (url: string | null) => void;
313
+ placeholder?: string;
314
+ }
315
+ declare function SiteDropdown({ sites, selected, onSelect, placeholder, }: SiteDropdownProps): react_jsx_runtime.JSX.Element;
316
+
317
+ export { ChatSearch, DebugTool, HistorySidebar, type QueryResultSet, type SearchSession, type Site, SiteDropdown, useNlWeb, useSearchSession, useSearchSessions };