@e-llm-studio/citation 0.0.117 → 0.0.119

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/README.md CHANGED
@@ -1,9 +1,135 @@
1
- # e-llm-studio-lib/citation
1
+ # 📚 e-llm-studio/citation
2
2
 
3
- This library contains React components for rendering various types of citations and related UI elements within the e-LLM Studio ecosystem. It provides a comprehensive set of reusable components designed to display citations, reasoning, code snippets, PDFs, and other content types with rich interactive features and customizable styling.
3
+
4
+ ## Table of Contents
5
+
6
+ 1. [Project Overview](#project-overview)
7
+ 2. [Installation](#installation)
8
+ 3. [Available Components](#available-citations)
9
+ - [Citation Components](#citation-components)
10
+ - [BookCitation](#bookcitation) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/BookCitation/README.MD)
11
+ - [ChatCitation](#chatcitation) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/ChatCitation/ChatCitationReadme.md)
12
+ - [CitationRenderer](#citationrenderer) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/CitationRenderer/CitationRendererReadme.md)
13
+ - [CognitiveDecisioningCard](#cognitivedecisioningcard) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/CognitiveDecisioning/CognitiveDecisioningReadme.md)
14
+ - [CognitiveInternalGPTReasoning](#cognitiveinternalgptreasoning) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/CognitiveInternalgptReasoning/README.md)
15
+ - [CodeCitation](#codecitation) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/CodeCitation/README.md)
16
+ - [CitationsViewer](#citationsviewer) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/CitationViewer/CitationViewerReadme.md)
17
+ - [PdfEditorCitation](#pdfeditorcitation) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/PdfEditorCitation/README.md)
18
+ - [RequirementAICitation](#requirementaicitation) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/RequirementAiCitations/RequirementAiCitationsReadme.md)
19
+ - [Other Components](#other-components)
20
+ - [Bookemon](#bookemon) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/Bookemon/BookemonReadme.md)
21
+ - [DatagestMon](#datagestmon) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/DatagestMon/README.md)
22
+ - [DataSelector](#dataselector)[<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/DataSelector/DataSelectorReadme.md)
23
+ - [PaginatedTable](#paginatedtable) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/PaginatedTable/PaginatedTableReadme.md)
24
+ - [PdfViewer](#pdfviewer) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/PdfViewer/PdfViewerReadme.md)
25
+ - [ProjectAccordion](#projectaccordion) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/ProjectAccordion/README.md)
26
+ - [UploadData](#uploaddata) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/UploadData/README.md)
27
+ 4. [Common Use Cases](#common-use-cases)
28
+ 5. [Development & Contribution](#development--contribution)
29
+ 6. [License](#license)
30
+
31
+
32
+ ## Project Overview
33
+
34
+ The @e-llm-studio/citation library is a comprehensive React component library designed to render various types of citations and related UI elements within the e-LLM Studio ecosystem. It provides a robust set of reusable, production-ready components that enable developers to display citations, reasoning chains, code snippets, PDFs, and other content types with rich interactive features and highly customizable styling.
35
+
36
+ This library serves as a foundational building block for applications that need to present complex information in an organized, user-friendly manner. Whether you're displaying book citations with highlighted passages, rendering AI reasoning with confidence scores, showcasing code with syntax highlighting, or managing large datasets with pagination, the citation library offers flexible, well-documented components that integrate seamlessly into modern React applications.
37
+
38
+ The library emphasizes developer experience through comprehensive documentation, TypeScript support, and extensive customization options. Each component is designed with accessibility and performance in mind, ensuring that applications built with these components provide excellent user experiences across different devices and use cases.
39
+
40
+ ---
41
+
42
+ ## Installation
43
+
44
+ ### Prerequisites
45
+
46
+ Before you begin, ensure you have the following installed on your system:
47
+
48
+ - **Node.js & npm** - Required for package management and running build scripts
49
+ - **Git** - Required for cloning the repository
50
+ - Basic familiarity with Git and the command line
51
+
52
+ ### Installation Steps
53
+
54
+ #### 1. Clone the Repository
55
+
56
+ Start by cloning the citation library repository to your local machine:
57
+
58
+ ```bash
59
+ git clone https://github.com/e-llm-studio/citation.git
60
+
61
+ cd citation
62
+ ```
63
+
64
+ #### 2. Install Dependencies
65
+
66
+ Install all required dependencies using npm:
67
+
68
+ ```bash
69
+ npm install
70
+ ```
71
+
72
+ Alternatively, you can use yarn if you prefer:
73
+
74
+ ```bash
75
+ yarn install
76
+ ```
77
+
78
+ #### 3. Link the Library Locally (Optional)
79
+
80
+ If you want to test the library in another project before publishing, you can link it locally:
81
+
82
+ ```bash
83
+ # In the citation library folder
84
+ npm link
85
+
86
+ # In your test project folder
87
+ cd ../your-project
88
+ npm link @e-llm-studio/citation
89
+ ```
90
+
91
+ This allows you to test changes in your local library without publishing to npm.
92
+
93
+ #### 4. Build the Library
94
+
95
+ Build the library to compile TypeScript and prepare distribution files:
96
+
97
+ ```bash
98
+ npm run build
99
+ ```
100
+
101
+ #### 5. Test Locally
102
+
103
+ After building, you can test the library in your project:
104
+
105
+ ```bash
106
+ # In your test project
107
+ npm start
108
+ # or
109
+ npm run build
110
+ ```
111
+
112
+ Import the library components and verify that your changes work as expected.
113
+
114
+ ### Quick Installation for End Users
115
+
116
+ If you're installing the published package from npm:
117
+
118
+ ```bash
119
+ # Using npm
120
+ npm install @e-llm-studio/citation
121
+
122
+ # Using yarn
123
+ yarn add @e-llm-studio/citation
124
+
125
+ # Using pnpm
126
+ pnpm add @e-llm-studio/citation
127
+ ```
4
128
 
5
129
  ---
6
130
 
131
+
132
+ # Citation Components
7
133
  ## BookCitation
8
134
 
9
135
  ### Overview
@@ -20,40 +146,21 @@ The BookCitation component is designed to display book citations with an interac
20
146
  - **Support for book cover images and external links** - Displays book cover images and provides clickable external links
21
147
  - **Customizable styling through the customStyle prop** - Allows fine-grained control over component appearance
22
148
 
23
- ### Installation
24
149
 
25
- ```bash
26
- npm install @e-llm-studio/citation
27
- ```
28
-
29
- ### Usage
150
+ ### Usage:
30
151
 
31
152
  ```tsx
32
153
  import BookCitation from '@e-llm-studio/citation/BookCitation'
33
154
 
34
- const MyComponent = () => {
35
- return (
36
- <BookCitation
37
- citationNumber={1}
38
- partialMatch={true}
39
- citationTitle="Sample Book Citation"
40
- title="Sample Book Citation"
41
- paragraphs={[
42
- `<p><strong>"This is a sample paragraph from a book..."</strong></p>`
43
- ]}
44
- textToHighlight={['This is a sample paragraph']}
45
- customStyle={{
46
- citationButton: {
47
- color: 'rgb(214, 51, 132)',
48
- fontSize: '16px',
49
- },
50
- }}
51
- />
52
- )
53
- }
155
+ <BookCitation
156
+ citationTitle="Sample Book"
157
+ paragraphs={['<p>Highlighted text example</p>']}
158
+ textToHighlight={['example']}
159
+ partialMatch={true}
160
+ />
54
161
  ```
55
162
 
56
- ### Props
163
+ ### Props:
57
164
 
58
165
  | Prop Name | Type | Description |
59
166
  |-----------|------|-------------|
@@ -75,63 +182,6 @@ const MyComponent = () => {
75
182
 
76
183
  ---
77
184
 
78
- ## Bookemon
79
-
80
- ### Overview
81
-
82
- Bookemon is a composable, dialog-based React UI component designed for deep book inspection. It features a resizable split-panel layout that allows users to browse detailed metadata while simultaneously viewing and interacting with specific manuscript content. The component is designed to be highly customizable via style injections and handles complex logic for smart text citation, server-side pagination, and focus-mode blurring.
83
-
84
- ### Features
85
-
86
- - **Resizable split-panel layout** - Left panel for metadata, right panel for content preview
87
- - **Deep book inspection** - Browse detailed metadata including overview, elements, copyrights, and awards
88
- - **Smart text citation** - Automatically highlights and focuses on specific text passages
89
- - **Server-side pagination** - Efficiently handles large datasets with pagination support
90
- - **Focus-mode blurring** - Blur non-highlighted text to focus reader attention on relevant content
91
- - **Highly customizable styling** - Inject custom styles for layout containers and citation elements
92
- - **Interactive accordions** - Collapsible sections for book metadata organization
93
-
94
- ### Installation
95
-
96
- ```bash
97
- npm install @e-llm-studio/citation
98
- ```
99
-
100
- ### Usage
101
-
102
- ```tsx
103
- import Bookemon from '@e-llm-studio/citation/Bookemon'
104
-
105
- <Bookemon
106
- open={isOpen}
107
- onClose={() => setIsOpen(false)}
108
- data={bookData}
109
- isBlurToggleVisible={true}
110
- isNonHighlightedBlur={true}
111
- getHighlightContent={api.fetchChunks}
112
- handleFetchManuscriptElements={api.fetchPaginatedElements}
113
- customStyle={{
114
- dialogDimension: { maxWidth: '1400px', height: '95vh' },
115
- }}
116
- />
117
- ```
118
-
119
- ### Props
120
-
121
- | Prop Name | Type | Description |
122
- |-----------|------|-------------|
123
- | `open` | `boolean` | Controls the visibility of the dialog |
124
- | `onClose` | `() => void` | Callback function triggered when the dialog is closed |
125
- | `data` | `BookemonData` | Object containing book metadata and elements |
126
- | `getHighlightContent` | `(chunkIds: string[]) => Promise<ContentItem[]>` | Async handler to fetch content for highlighting |
127
- | `handleFetchManuscriptElements` | `(params: FetchElementsParams) => Promise<PaginatedResponse>` | Async handler for fetching paginated manuscript elements |
128
- | `isBookemon` | `boolean` | Default: true. Feature flag for Bookemon-specific behavior |
129
- | `isBlurToggleVisible` | `boolean` | Default: false. Shows the blur switch in header |
130
- | `isNonHighlightedBlur` | `boolean` | Default: false. Initial blur state |
131
- | `showComingSoon` | `boolean` | Default: false. Gates the UI with coming soon overlay |
132
- | `customStyle` | `BookemonCustomStyles` | Optional custom styles for layout and citation elements |
133
-
134
- ---
135
185
 
136
186
  ## ChatCitation
137
187
 
@@ -149,36 +199,21 @@ ChatCitation is a composable React UI component for rendering chat-based citatio
149
199
  - **Tab-based navigation** - Toggle between summarized and detailed views
150
200
  - **Flexible content rendering** - Support for custom renderers and markdown components
151
201
 
152
- ### Installation
153
-
154
- ```bash
155
- npm install @e-llm-studio/citation
156
- ```
157
-
158
202
  ### Usage
159
203
 
160
204
  ```tsx
161
205
  import ChatCitation from '@e-llm-studio/citation/ChatCitation'
162
206
 
163
207
  <ChatCitation
164
- rootContainer={{
165
- title: "AI Reasoning",
166
- relevanceScore: 0.87,
167
- }}
168
- chatContainer={{
169
- title: "Conversation",
170
- chatData,
171
- summarizedTab: {
172
- chip: { show: true, isActive: true },
173
- },
174
- detailedTab: {
175
- chip: { isActive: false },
176
- },
177
- }}
178
- ruleBookContainer={{
179
- title: "Referenced Rules",
180
- data: ruleBookItems,
181
- }}
208
+ chatContainer={{
209
+ chatData: [
210
+ { role: 'user', message: 'Hello', userName: 'User1', timeStamp: dayjs() }
211
+ ]
212
+ }}
213
+ ruleBookContainer={{
214
+ title: 'References',
215
+ data: { content: 'Rule content', highlighted_texts: ['important'] }
216
+ }}
182
217
  />
183
218
  ```
184
219
 
@@ -193,7 +228,8 @@ import ChatCitation from '@e-llm-studio/citation/ChatCitation'
193
228
 
194
229
  ---
195
230
 
196
- ## Citation (CitationRenderer)
231
+
232
+ ## CitationRenderer
197
233
 
198
234
  ### Overview
199
235
 
@@ -208,33 +244,21 @@ CitationRenderer is a versatile, interactive "Pill" component designed to displa
208
244
  - **Flexible styling** - Customize appearance through style props
209
245
  - **Callback support** - Optional callbacks for side effects on toggle
210
246
 
211
- ### Installation
212
-
213
- ```bash
214
- npm install @e-llm-studio/citation
215
- ```
216
-
217
247
  ### Usage
218
248
 
219
249
  ```tsx
220
250
  import CitationRenderer from '@e-llm-studio/citation/CitationRenderer'
221
- import MarkdownRenderer from '@e-llm-studio/citation/CitationRenderer/MarkdownRenderer'
222
-
223
- const SimpleCitation = () => (
224
- <CitationRenderer
225
- inLineCitation={true}
226
- citationTitle="Source: Q3 Financial Report"
227
- citationIcon={<FaBook />}
228
- chevronDownComponent={<FaChevronDown />}
229
- chevronUpComponent={<FaChevronUp />}
230
- citationComponent={
231
- <MarkdownRenderer value="**Revenue grew by 20%** compared to last year." />
232
- }
233
- />
234
- )
251
+
252
+ <CitationRenderer
253
+ inLineCitation={true}
254
+ citationTitle="Reference 1"
255
+ citationComponent={<div>Detailed content here</div>}
256
+ chevronDownComponent={<ChevronDownIcon />}
257
+ chevronUpComponent={<ChevronUpIcon />}
258
+ />
235
259
  ```
236
260
 
237
- ### Props
261
+ ### Props
238
262
 
239
263
  | Prop Name | Type | Description |
240
264
  |-----------|------|-------------|
@@ -251,55 +275,6 @@ const SimpleCitation = () => (
251
275
 
252
276
  ---
253
277
 
254
- ## CitationRenderer
255
-
256
- ### Overview
257
-
258
- CitationRenderer is the same as the Citation component - a versatile, interactive "Pill" component designed to display a compact reference citation that expands into detailed content. It provides a space-efficient toggle mechanism for displaying source material, footnotes, or reasoning chains.
259
-
260
- ### Features
261
-
262
- - **Expandable pill button** - Compact display that expands on click
263
- - **Customizable icons** - Support for custom icons for chevron and citation indicators
264
- - **Markdown content support** - Render rich text content using MarkdownRenderer
265
- - **Controlled and uncontrolled modes** - Manage state internally or externally
266
- - **Flexible styling** - Customize appearance through style props
267
-
268
- ### Installation
269
-
270
- ```bash
271
- npm install @e-llm-studio/citation
272
- ```
273
-
274
- ### Usage
275
-
276
- ```tsx
277
- import CitationRenderer from '@e-llm-studio/citation/CitationRenderer'
278
-
279
- const SimpleCitation = () => (
280
- <CitationRenderer
281
- inLineCitation={true}
282
- citationTitle="Source: Q3 Financial Report"
283
- citationComponent={<div>Content here</div>}
284
- />
285
- )
286
- ```
287
-
288
- ### Props
289
-
290
- | Prop Name | Type | Description |
291
- |-----------|------|-------------|
292
- | `inLineCitation` | `boolean` | Must be true to enable expand/collapse behavior |
293
- | `citationTitle` | `string` | The text displayed inside the pill button |
294
- | `citationComponent` | `ReactNode` | The content to render when expanded |
295
- | `citationIcon` | `ReactNode` | Icon displayed to the left of the title |
296
- | `chevronUpComponent` | `ReactNode` | Icon shown when the citation is expanded |
297
- | `chevronDownComponent` | `ReactNode` | Icon shown when the citation is collapsed |
298
- | `styles` | `Object` | CSS overrides for styling |
299
- | `isOpen` | `boolean` | Forces the expanded state (controlled mode) |
300
- | `onToggle` | `func` | Callback fired when the pill is clicked |
301
-
302
- ---
303
278
 
304
279
  ## CognitiveDecisioningCard
305
280
 
@@ -307,9 +282,6 @@ const SimpleCitation = () => (
307
282
 
308
283
  CognitiveDecisioningCard is a specialized React UI component designed to provide transparency into AI workflows. It renders a toggleable "Pill" that expands into a detailed card, displaying the AI's Reasoning, identified Gaps, and a confidence Score. It features a nested accordion design, robust Markdown rendering for content, and full styling customization.
309
284
 
310
- **Note:** `CognitiveInternalGPTReasoning` is a 'non web search citation' component, exported as `NonWebReasoningComponent`.
311
-
312
- **Note:** `RequirementAICitation` is 'ai reasoning', with reference to the explanation within the `CognitiveDecisioningCard` component.
313
285
 
314
286
  ### Features
315
287
 
@@ -321,30 +293,41 @@ CognitiveDecisioningCard is a specialized React UI component designed to provide
321
293
  - **Icon customization** - Replace default icons with custom components
322
294
  - **Advanced section customization** - Override default sections with custom data structures
323
295
 
324
- ### Installation
325
-
326
- ```bash
327
- npm install @e-llm-studio/citation
328
- ```
329
-
330
296
  ### Usage
331
297
 
332
298
  ```tsx
333
299
  import CognitiveDecisioningCard from '@e-llm-studio/citation/CognitiveDecisioningCard'
334
300
 
335
- const AIView = () => {
336
- const [isOpen, setIsOpen] = useState(false)
337
-
338
- return (
339
- <CognitiveDecisioningCard
340
- isOpen={isOpen}
341
- onToggle={() => setIsOpen(!isOpen)}
342
- score="92"
343
- reasoning="**Analysis:** The user is asking about account limits. Based on the documentation, the limit is $500."
344
- gap="The user did not specify *which* account type they are referring to."
345
- />
346
- )
347
- }
301
+ <CognitiveDecisioningCard
302
+ isOpen={isOpen}
303
+ onToggle={() => setIsOpen(!isOpen)}
304
+ score="92"
305
+ reasoning="**Analysis:** Based on document review..."
306
+ gap="Missing date information in section 3."
307
+ title="AI Analysis Report"
308
+ />
309
+ ```
310
+
311
+ **Advanced Customization**:
312
+ ```tsx
313
+ const customSections = [
314
+ {
315
+ id: 'step1',
316
+ title: 'Data Retrieval',
317
+ subtitle: '3 sources processed',
318
+ icon: <CheckIcon />,
319
+ content: 'Data retrieved successfully'
320
+ }
321
+ ]
322
+
323
+ <CognitiveDecisioningCard
324
+ isOpen={true}
325
+ sections={customSections}
326
+ score="100"
327
+ mdComponents={{
328
+ a: ({ node, ...props }) => <a {...props} target="_blank" />
329
+ }}
330
+ />
348
331
  ```
349
332
 
350
333
  ### Props
@@ -367,6 +350,50 @@ const AIView = () => {
367
350
 
368
351
  ---
369
352
 
353
+ ## CognitiveInternalGPTReasoning
354
+
355
+ ### Overview
356
+
357
+ The CognitiveInternalgptReasoningComponent is a React component designed to render non-web search reasoning citations with advanced interactive features. It provides a comprehensive display of reasoning data with support for expandable content, highlight navigation, and modal fullscreen viewing. This component is particularly useful for displaying AI-generated reasoning, training data citations, and confidence scores in a user-friendly format.
358
+
359
+ ### Features
360
+
361
+ - **Expandable Content** - Display a paraphrase text that expands to show the full data source content
362
+ - **Highlight Navigation** - Automatically extract and navigate between highlighted sections within the content
363
+ - **Confidence Score Display** - Show confidence percentage in both expanded view and modal
364
+ - **Fullscreen Modal View** - Open a fullscreen modal for detailed examination of reasoning data
365
+ - **Text Formatting Support** - Handle bold text, list items, headers, and special highlight tags
366
+ - **Custom Icon Support** - Replace default icons with custom React components
367
+
368
+ ### Usage
369
+
370
+ ```tsx
371
+ import NonWebReasoningComponent from '@e-llm-studio/citation/CognitiveInternalgptReasoningComponent'
372
+
373
+ const reasoningData = {
374
+ text: "Reasoning text here",
375
+ dataSource: "Source with <highlight>highlighted text</highlight>",
376
+ trainingDataTitle: "Training Dataset v1.0",
377
+ confidence_score: 95,
378
+ paraphrase: "Brief summary"
379
+ }
380
+
381
+ <NonWebReasoningComponent
382
+ item={reasoningData}
383
+ index={1}
384
+ headerTitle="GPT Reasoning"
385
+ />
386
+ ```
387
+
388
+ **Highlight Navigation**:
389
+ - Extracts `<highlight>` tags from dataSource
390
+ - Provides navigation between highlighted sections
391
+ - Shows current position (e.g., "2/5 highlights")
392
+ - Auto-scrolls to active highlight
393
+
394
+ ---
395
+
396
+
370
397
  ## CodeCitation
371
398
 
372
399
  ### Overview
@@ -385,36 +412,51 @@ CodeCitation is a composable React UI component for rendering code citations wit
385
412
  - **Fullscreen view support** - View code in fullscreen modal
386
413
  - **Responsive design** - Works well on various screen sizes
387
414
 
388
- ### Installation
389
-
390
- ```bash
391
- npm install @e-llm-studio/citation
392
- ```
393
-
394
415
  ### Usage
395
416
 
396
417
  ```tsx
397
418
  import { CodeCitation } from '@e-llm-studio/citation/CodeCitation'
398
419
 
399
- const App = () => {
400
- const sampleCode = `function greet(name) {
401
- console.log("Hello, " + name);
402
- }`
403
-
404
- return (
405
- <CodeCitation
406
- citationTitle="Example Code"
407
- filename="example.js"
408
- filepath="/example.js"
409
- inLineCitation={true}
410
- isDarkModeEnabled={false}
411
- showThemeToggle={true}
412
- editorHeight={300}
413
- editorWidth="100%"
414
- customCode={sampleCode}
415
- />
416
- )
417
- }
420
+ <CodeCitation
421
+ citationTitle="Example Code"
422
+ filename="example.js"
423
+ filepath="/src/example.js"
424
+ customCode={`function hello() { return "world"; }`}
425
+ inLineCitation={true}
426
+ isDarkModeEnabled={false}
427
+ showThemeToggle={true}
428
+ editorHeight={400}
429
+ />
430
+ ```
431
+
432
+ **Advanced Features**:
433
+ ```tsx
434
+ const diagnostics = [
435
+ {
436
+ range: { lineStart: 2, lineEnd: 2, columnStart: 6, columnEnd: 11 },
437
+ severity: 1
438
+ }
439
+ ]
440
+
441
+ const highlightRanges = [
442
+ {
443
+ startIndex: 2,
444
+ endIndex: 5,
445
+ color: 'rgba(255, 255, 0, 0.3)',
446
+ lightModeColor: 'rgba(255, 255, 0, 0.2)'
447
+ }
448
+ ]
449
+
450
+ <CodeCitation
451
+ customCode={sampleCode}
452
+ diagnostics={diagnostics}
453
+ diagnosticStylesBySeverity={{
454
+ 1: { style: { backgroundColor: 'rgba(255,0,0,0.2)' } }
455
+ }}
456
+ startIndex={2}
457
+ endIndex={5}
458
+ isHighlightingEnabled={true}
459
+ />
418
460
  ```
419
461
 
420
462
  ### Props
@@ -442,6 +484,246 @@ const App = () => {
442
484
 
443
485
  ---
444
486
 
487
+ ## CitationsViewer
488
+
489
+ ### Overview
490
+
491
+ The Citation Viewer is a rich, interactive React component designed to display AI-generated audio citations. It features a synchronized audio waveform player, a transcript view that highlights active segments, and a summary of key takeaways. This component is ideal for displaying RAG (Retrieval-Augmented Generation) results where the source material is audio or video, allowing users to listen to the specific segment referenced by the AI.
492
+
493
+ ### Features
494
+
495
+ - **Interactive Waveform** - Visualizes audio using `wavesurfer.js` with playback controls
496
+ - **Smart Highlighting** - Automatically highlights the specific time range referenced in the citation on the waveform
497
+ - **Synchronized Transcript** - Displays chat history and highlights the active message segment
498
+ - **Key Takeaways** - Renders extracted insights with bold text formatting and keyword tags
499
+ - **GCS Integration** - Built-in hook to resolve Google Cloud Storage (`gs://`) URLs to signed URLs via a backend endpoint
500
+ - **Themable** - Fully customizable colors and typography via a theme config object
501
+
502
+ ### Usage
503
+
504
+ ```tsx
505
+ import CitationsViewer from '@e-llm-studio/citation/CitationsViewer'
506
+
507
+ <CitationsViewer
508
+ artifact={{
509
+ baseUrl: "https://api.example.com",
510
+ artifactTitle: "Quarterly Earnings Call",
511
+ fileUrl: "gs://bucket/audio.mp3",
512
+ chatHistory: [
513
+ {
514
+ role: "Speaker 1",
515
+ message: "Revenue increased by 20%",
516
+ timestamp: "10:30",
517
+ timestamp_start: 120.5,
518
+ timestamp_end: 125.0
519
+ }
520
+ ],
521
+ keyTakeaways: [
522
+ {
523
+ takeawayId: "1",
524
+ name: "Revenue Growth",
525
+ content: "**20% year-over-year growth**",
526
+ keywords: ["Revenue", "Growth"]
527
+ }
528
+ ]
529
+ }}
530
+ onCloseHandler={() => console.log('Closed')}
531
+ />
532
+ ```
533
+
534
+ ### Props
535
+
536
+ | Prop Name | Type | Required | Description |
537
+ |-----------|------|----------|-------------|
538
+ | `artifact` | `ArtifactData` | ✅ | The main data object containing audio, transcript, and metadata |
539
+ | `onCloseHandler` | `() => void` | ❌ | Callback function triggered when the close (X) button is clicked |
540
+ | `theme` | `ThemeConfig` | ❌ | Object to override default colors and fonts |
541
+ | `iconsConfig` | `IconsConfig` | ❌ | Object to inject custom React icons (Play, Pause, Close) |
542
+
543
+ ---
544
+
545
+
546
+ ## PdfEditorCitation
547
+
548
+ ### Overview
549
+
550
+ PdfEditorCitation is a core component for the Advanced Document Management and Citation System. It provides a user-friendly interface for viewing, editing, and citing PDF documents directly within the application. It combines interactive PDF viewing capabilities with a collapsible UI pattern, allowing users to manage document space efficiently while maintaining full access to PDF editing and annotation features.
551
+
552
+ ### Features
553
+
554
+ - **Collapsible PDF viewer functionality** - Users can expand and collapse the PDF editor section
555
+ - **Interactive PDF editing capabilities** - Full support for PDF editing, annotations, and collaborative features
556
+ - **Sentence highlighting support** - Ability to highlight specific sentences within PDF documents
557
+ - **Customizable UI through CSS classes** - Flexible styling options for seamless integration
558
+
559
+ ### Usage
560
+
561
+ ```tsx
562
+ import { PdfEditorCitation } from '@e-llm-studio/citation/PdfEditorCitation'
563
+
564
+ <PdfEditorCitation
565
+ citationTitleElement={<div>Research Paper.pdf</div>}
566
+ pdfUrl="https://example.com/document.pdf"
567
+ pdfEditorBackendBaseUrl="https://pdf-backend.example.com"
568
+ sentenceHighlightDetails={{
569
+ pdfPageNumber: 5,
570
+ sentenceToHighlight: "key finding in the research"
571
+ }}
572
+ currentUserId="user-123"
573
+ />
574
+ ```
575
+
576
+ ### Props
577
+
578
+ | Prop Name | Type | Description |
579
+ |-----------|------|-------------|
580
+ | `citationTitleElement` | `ReactElement` | A React element to display as the clickable title |
581
+ | `pdfUrl` | `string` | The URL of the PDF file to be displayed and edited |
582
+ | `pdfEditorBackendBaseUrl` | `string` | The base URL of the PDF editor backend service |
583
+ | `citationRootClassName` | `string` | Optional CSS class name for the root container |
584
+ | `citationBodyClassName` | `string` | Optional CSS class name for the body section |
585
+ | `citationBodyWhenCollapsedClassName` | `string` | Optional CSS class name for collapsed state |
586
+ | `citationTitleClassName` | `string` | Optional CSS class name for the title section |
587
+ | `rlefEventServiceBaseUrl` | `string` | Optional base URL for the RLEF event service |
588
+ | `currentUserId` | `string` | Optional user ID of the current user |
589
+ | `sentenceHighlightDetails` | `object` | Optional sentence highlighting configuration |
590
+
591
+ ---
592
+
593
+
594
+ ## RequirementAICitation
595
+
596
+ ### Overview
597
+
598
+ RequirementAICitation is a comprehensive React module for displaying AI-generated insights and rich media evidence. It serves two primary purposes: displaying an AI Reasoning Card with expandable sections for logic, gaps, and confidence scores with embedded citations, and providing standalone media citations for Files, Images, and Web Links.
599
+
600
+ ### Features
601
+
602
+ - **AI Reasoning Card** - Complex, expandable card displaying AI logic, gaps, and confidence scores with embedded, clickable citations
603
+ - **Standalone Media Citations** - Individual, stylized citation pills for Files, Images, and Web Links
604
+ - **Multiple Citation Types** - Support for file citations (PDFs), image citations, and web citations
605
+ - **Relevance Scoring** - Display AI relevance scores for all citation types
606
+ - **Rich Media Preview** - Integrated viewers for PDFs, images, and web content
607
+ - **Customizable Styling** - Deep CSS injection for all components
608
+
609
+ ### Usage
610
+
611
+ ```tsx
612
+ import { AiReasoningCitation } from '@e-llm-studio/citation'
613
+
614
+ <AiReasoningCitation
615
+ title="AI Analysis"
616
+ aiReason={{
617
+ id: "1",
618
+ relevance_score: 95,
619
+ reason: "The <a href='document_citation$1'>ADK.pdf</a> mentions...",
620
+ gap: "Registry mechanism undefined"
621
+ }}
622
+ citationList={{
623
+ file_citations: [{
624
+ citation_number: "1",
625
+ customMetadata: {
626
+ type: "book_citation_pdf",
627
+ file_name: "ADK.pdf",
628
+ highlighted_pdf_signed_url: "https://storage.googleapis.com/..."
629
+ }
630
+ }]
631
+ }}
632
+ aiReasoningAccordionProps={{
633
+ icons: {
634
+ chevronUp: <i className="pi pi-angle-up" />,
635
+ chevronDown: <i className="pi pi-angle-down" />
636
+ }
637
+ }}
638
+ />
639
+ ```
640
+
641
+ **Embedded Citation Types**:
642
+ 1. **FileCitationContent**: PDF documents with signed URLs
643
+ 2. **ImageCitationContent**: Images with relevance scores
644
+ 3. **WebCitationWithImageContent**: Web pages with screenshots
645
+
646
+ **Standalone Media Citations**:
647
+ ```tsx
648
+ import { CitationRenderer, FileCitationContent } from '@e-llm-studio/citation'
649
+
650
+ <CitationRenderer
651
+ inLineCitation={true}
652
+ citationTitle="Technical Spec.pdf"
653
+ citationComponent={
654
+ <FileCitationContent
655
+ title="Spec.pdf"
656
+ relevanceScore={88}
657
+ signedUrl="https://example.com/sample.pdf"
658
+ styles={{ pdfWrapper: { height: "750px" } }}
659
+ />
660
+ }
661
+ />
662
+ ```
663
+ ### Props
664
+
665
+ | Prop Name | Type | Required | Description |
666
+ |-----------|------|----------|-------------|
667
+ | `title` | `string` | ✅ | Title on the main pill |
668
+ | `aiReason` | `TAIReasoning` | ✅ | Contains `reason`, `gap`, `relevance_score` |
669
+ | `citationList` | `Citations` | ✅ | Lookup object for all referenced files/images |
670
+ | `aiReasoningAccordionProps` | `Object` | ✅ | Must contain `icons: { chevronUp, chevronDown }` |
671
+ | `projectDetails` | `Array` | ❌ | Context for specific app-mod logic |
672
+ | `cachingConfig` | `Object` | ❌ | If using `gsUtilPath` instead of `signedUrl` |
673
+
674
+ ---
675
+
676
+
677
+ # Other Components
678
+ ## Bookemon
679
+
680
+ ### Overview
681
+
682
+ Bookemon is a composable, dialog-based React UI component designed for deep book inspection. It features a resizable split-panel layout that allows users to browse detailed metadata while simultaneously viewing and interacting with specific manuscript content. The component is designed to be highly customizable via style injections and handles complex logic for smart text citation, server-side pagination, and focus-mode blurring.
683
+
684
+ ### Features
685
+
686
+ - **Resizable split-panel layout** - Left panel for metadata, right panel for content preview
687
+ - **Deep book inspection** - Browse detailed metadata including overview, elements, copyrights, and awards
688
+ - **Smart text citation** - Automatically highlights and focuses on specific text passages
689
+ - **Server-side pagination** - Efficiently handles large datasets with pagination support
690
+ - **Focus-mode blurring** - Blur non-highlighted text to focus reader attention on relevant content
691
+ - **Highly customizable styling** - Inject custom styles for layout containers and citation elements
692
+ - **Interactive accordions** - Collapsible sections for book metadata organization
693
+
694
+
695
+ ### Usage
696
+
697
+ ```tsx
698
+ import Bookemon from '@e-llm-studio/citation/Bookemon'
699
+
700
+ <Bookemon
701
+ open={isOpen}
702
+ onClose={() => setIsOpen(false)}
703
+ data={bookData}
704
+ getHighlightContent={fetchContent}
705
+ isBlurToggleVisible={true}
706
+ />
707
+ ```
708
+
709
+ ### Props
710
+
711
+ | Prop Name | Type | Description |
712
+ |-----------|------|-------------|
713
+ | `open` | `boolean` | Controls the visibility of the dialog |
714
+ | `onClose` | `() => void` | Callback function triggered when the dialog is closed |
715
+ | `data` | `BookemonData` | Object containing book metadata and elements |
716
+ | `getHighlightContent` | `(chunkIds: string[]) => Promise<ContentItem[]>` | Async handler to fetch content for highlighting |
717
+ | `handleFetchManuscriptElements` | `(params: FetchElementsParams) => Promise<PaginatedResponse>` | Async handler for fetching paginated manuscript elements |
718
+ | `isBookemon` | `boolean` | Default: true. Feature flag for Bookemon-specific behavior |
719
+ | `isBlurToggleVisible` | `boolean` | Default: false. Shows the blur switch in header |
720
+ | `isNonHighlightedBlur` | `boolean` | Default: false. Initial blur state |
721
+ | `showComingSoon` | `boolean` | Default: false. Gates the UI with coming soon overlay |
722
+ | `customStyle` | `BookemonCustomStyles` | Optional custom styles for layout and citation elements |
723
+
724
+ ---
725
+
726
+
445
727
  ## DatagestMon
446
728
 
447
729
  ### Overview
@@ -457,42 +739,36 @@ DatagestMon is a React component for monitoring and displaying structured data f
457
739
  - **Material-UI Dialog** - Professional modal presentation
458
740
  - **Graceful error handling** - Handle missing or malformed data gracefully
459
741
 
460
- ### Installation
461
-
462
- ```bash
463
- npm install @e-llm-studio/citation
464
- ```
465
-
466
742
  ### Usage
467
743
 
468
744
  ```tsx
469
- import DatagestMon from '@e-llm-studio/citation'
470
-
471
- function DatagestMonExample() {
472
- const [isOpen, setIsOpen] = useState(false)
473
-
474
- const data = {
475
- "analysis": {
476
- "processed_data": {
477
- "summary": "Analysis completed successfully",
478
- "functions": "Extracted 15 key functions",
479
- },
480
- "error_data": {}
481
- },
482
- }
483
-
484
- return (
485
- <div>
486
- <button onClick={() => setIsOpen(true)}>Open DatagestMon</button>
487
- <DatagestMon
488
- open={isOpen}
489
- onClose={() => setIsOpen(false)}
490
- data={data}
491
- url="https://example.com/sample.epub"
492
- />
493
- </div>
494
- )
745
+ import DatagestMon from '@e-llm-studio/citation/DatagestMon'
746
+
747
+ const pipelineData = {
748
+ "analysis": {
749
+ "processed_data": {
750
+ "summary": "Analysis completed",
751
+ "functions": "15 functions extracted"
752
+ },
753
+ "error_data": {
754
+ "rate_limit_exceeded": true
755
+ }
756
+ },
757
+ "transform": {
758
+ "processed_data": {
759
+ "embeddings": 123,
760
+ "transformed_records": 1200
761
+ },
762
+ "error_data": {}
763
+ }
495
764
  }
765
+
766
+ <DatagestMon
767
+ open={isOpen}
768
+ onClose={() => setIsOpen(false)}
769
+ data={pipelineData}
770
+ url="https://example.com/document.epub"
771
+ />
496
772
  ```
497
773
 
498
774
  ### Props
@@ -506,8 +782,9 @@ function DatagestMonExample() {
506
782
 
507
783
  ---
508
784
 
509
- ## DataSelector
510
785
 
786
+ ## DataSelector
787
+
511
788
  ### Overview
512
789
 
513
790
  DataSelector is a robust, multi-step wizard designed to handle complex data import workflows. It acts as a central hub where users can select data from various sources—including remote RLEF projects, historical copilot data, saved datasets, or local file uploads—and aggregates them into a unified selection state. It features a built-in state machine for navigation, breadcrumb management, and context-driven state sharing.
@@ -522,38 +799,31 @@ DataSelector is a robust, multi-step wizard designed to handle complex data impo
522
799
  - **State machine navigation** - Robust step management
523
800
  - **Context-driven state sharing** - Centralized state management via React Context
524
801
 
525
- ### Installation
526
-
527
- ```bash
528
- npm install @e-llm-studio/citation
529
- ```
530
-
531
802
  ### Usage
532
803
 
533
804
  ```tsx
534
- import { DataSelectedContextProvider } from './context/DataSelectedContext'
805
+ import { DataSelectedContextProvider } from '@e-llm-studio/citation/context/DataSelectedContext'
535
806
  import DataSelector from '@e-llm-studio/citation/DataSelector'
536
807
 
537
- const App = () => {
538
- const [selectedResources, setSelectedResources] = useState([])
539
- const [localFiles, setLocalFiles] = useState([])
540
-
541
- return (
542
- <DataSelectedContextProvider>
543
- <div style={{ height: '600px', width: '100%' }}>
544
- <DataSelector
545
- pageTitle="Import Dataset"
546
- selectedRlefResources={selectedResources}
547
- setSelectedRlefResources={setSelectedResources}
548
- selectedLocalFiles={localFiles}
549
- setSelectedLocalFiles={setLocalFiles}
550
- />
551
- </div>
552
- </DataSelectedContextProvider>
553
- )
554
- }
808
+ <DataSelectedContextProvider>
809
+ <DataSelector
810
+ pageTitle="Import Dataset"
811
+ selectedRlefResources={resources}
812
+ setSelectedRlefResources={setResources}
813
+ selectedLocalFiles={files}
814
+ setSelectedLocalFiles={setFiles}
815
+ />
816
+ </DataSelectedContextProvider>
555
817
  ```
556
818
 
819
+ **Wizard Steps**:
820
+ 1. **Data source selection** - Choose from RLEF, Local, Google Drive, Saved Datasets
821
+ 2. **Project/task selection** - Select specific projects or tasks
822
+ 3. **Data collection selection** - Choose from available data collections
823
+ 4. **Data point selection** - Select specific data points within collections
824
+ 5. **Final review** - Review and confirm selections
825
+
826
+
557
827
  ### Props
558
828
 
559
829
  | Prop Name | Type | Description |
@@ -582,30 +852,30 @@ PaginatedTable is a high-performance React component designed to display large d
582
852
  - **Loading states** - Displays a skeleton loader row when fetching more data
583
853
  - **Customizable** - Supports custom dimensions and granular style overrides
584
854
 
585
- ### Installation
586
-
587
- ```bash
588
- npm install @e-llm-studio/citation
589
- ```
590
-
591
855
  ### Usage
592
856
 
593
857
  ```tsx
594
858
  import PaginatedTable from '@e-llm-studio/citation/PaginatedTable'
595
859
 
596
860
  <PaginatedTable
597
- headers={["ID", "Name", "Status"]}
598
- tableData={data}
599
- totalFileRecords={1000}
600
- onNextPage={fetchNextPage}
601
- loadingMore={loading}
602
- headerRefs={headerRefs}
603
- columnWidth={200}
604
- rowHeight={50}
605
- style={{ height: "100%" }}
861
+ headers={["ID", "Name", "Email", "Status"]}
862
+ tableData={users}
863
+ totalFileRecords={10000}
864
+ onNextPage={fetchNextPage}
865
+ loadingMore={isLoading}
866
+ headerRefs={headerRefs}
867
+ columnWidth={200}
868
+ rowHeight={50}
869
+ style={{ height: "600px" }}
606
870
  />
607
871
  ```
608
872
 
873
+ **Performance Characteristics**:
874
+ - Renders only visible rows (windowed rendering)
875
+ - Handles thousands of rows efficiently
876
+ - Smooth scrolling even with large datasets
877
+ - Memory efficient for large data volumes
878
+
609
879
  ### Props
610
880
 
611
881
  | Prop Name | Type | Description |
@@ -624,57 +894,6 @@ import PaginatedTable from '@e-llm-studio/citation/PaginatedTable'
624
894
 
625
895
  ---
626
896
 
627
- ## PdfEditorCitation
628
-
629
- ### Overview
630
-
631
- PdfEditorCitation is a core component for the Advanced Document Management and Citation System. It provides a user-friendly interface for viewing, editing, and citing PDF documents directly within the application. It combines interactive PDF viewing capabilities with a collapsible UI pattern, allowing users to manage document space efficiently while maintaining full access to PDF editing and annotation features.
632
-
633
- ### Features
634
-
635
- - **Collapsible PDF viewer functionality** - Users can expand and collapse the PDF editor section
636
- - **Interactive PDF editing capabilities** - Full support for PDF editing, annotations, and collaborative features
637
- - **Sentence highlighting support** - Ability to highlight specific sentences within PDF documents
638
- - **Customizable UI through CSS classes** - Flexible styling options for seamless integration
639
-
640
- ### Installation
641
-
642
- ```bash
643
- npm install @e-llm-studio/citation
644
- ```
645
-
646
- ### Usage
647
-
648
- ```tsx
649
- import { PdfEditorCitation } from './features/PdfEditorCitation/PdfEditorCitation'
650
-
651
- export function BasicPdfExample() {
652
- return (
653
- <PdfEditorCitation
654
- citationTitleElement={<div>My Document.PDF</div>}
655
- pdfUrl="https://example.com/documents/sample.pdf"
656
- pdfEditorBackendBaseUrl="https://pdf-backend.example.com"
657
- />
658
- )
659
- }
660
- ```
661
-
662
- ### Props
663
-
664
- | Prop Name | Type | Description |
665
- |-----------|------|-------------|
666
- | `citationTitleElement` | `ReactElement` | A React element to display as the clickable title |
667
- | `pdfUrl` | `string` | The URL of the PDF file to be displayed and edited |
668
- | `pdfEditorBackendBaseUrl` | `string` | The base URL of the PDF editor backend service |
669
- | `citationRootClassName` | `string` | Optional CSS class name for the root container |
670
- | `citationBodyClassName` | `string` | Optional CSS class name for the body section |
671
- | `citationBodyWhenCollapsedClassName` | `string` | Optional CSS class name for collapsed state |
672
- | `citationTitleClassName` | `string` | Optional CSS class name for the title section |
673
- | `rlefEventServiceBaseUrl` | `string` | Optional base URL for the RLEF event service |
674
- | `currentUserId` | `string` | Optional user ID of the current user |
675
- | `sentenceHighlightDetails` | `object` | Optional sentence highlighting configuration |
676
-
677
- ---
678
897
 
679
898
  ## PdfViewer
680
899
 
@@ -691,35 +910,26 @@ PdfViewer is a specialized React component designed to render PDF documents with
691
910
  - **Custom toolbar** - Sticky header with navigation controls
692
911
  - **Responsive design** - Works well on various screen sizes
693
912
 
694
- ### Installation
695
-
696
- ```bash
697
- npm install @e-llm-studio/citation
698
- ```
699
-
700
913
  ### Usage
701
914
 
702
915
  ```tsx
703
916
  import PdfViewer from '@e-llm-studio/citation/PdfViewer'
704
917
 
705
- const DocumentReview = () => {
706
- const pdfUrl = "https://example.com/contract.pdf"
707
- const searchKeywords = ["termination clause", "liability", "date"]
708
- const pagesWithKeywords = [3, 8, 12]
709
-
710
- return (
711
- <div style={{ height: "800px", width: "100%" }}>
712
- <PdfViewer
713
- pdfUrl={pdfUrl}
714
- highlightText={searchKeywords}
715
- highlightPages={pagesWithKeywords}
716
- jumpToPageValue={3}
717
- />
718
- </div>
719
- )
720
- }
918
+ <PdfViewer
919
+ pdfUrl="https://example.com/contract.pdf"
920
+ highlightText={["confidential", "termination", "liability"]}
921
+ highlightPages={[3, 8, 12]}
922
+ jumpToPageValue={3}
923
+ />
721
924
  ```
722
925
 
926
+ ### Navigation Behavior
927
+ - "Next" button jumps to next page with highlights
928
+ - "Previous" button jumps to previous highlighted page
929
+ - Direct page navigation based on highlightPages array
930
+ - Auto-zoom to actual size on load
931
+
932
+
723
933
  ### Props
724
934
 
725
935
  | Prop Name | Type | Description |
@@ -739,26 +949,49 @@ ProjectAccordion is a React component designed to display project-related inform
739
949
 
740
950
  ### Features
741
951
 
742
- - Accordion-based layout for organizing project information
743
- - Expandable/collapsible sections
744
- - Markdown support for content rendering
745
-
746
- ### Installation
747
-
748
- ```bash
749
- npm install @e-llm-studio/citation
750
- ```
952
+ - Expandable/collapsible accordion design
953
+ - Markdown rendering for executive summaries
954
+ - Checkbox selection support
955
+ - API integration for fetching summaries
956
+ - Customizable styling
751
957
 
752
958
  ### Usage
753
959
 
754
- Further details to be added.
960
+ ```tsx
961
+ import ProjectAccordion from '@e-llm-studio/citation/ProjectAccordion'
962
+
963
+ <ProjectAccordion
964
+ baseUrl="https://api.example.com"
965
+ taskId="project-123"
966
+ citationTitle="Executive Summary"
967
+ isChecked={selected}
968
+ onCheckChange={(checked) => setSelected(checked)}
969
+ chevronUpComponent={<UpIcon />}
970
+ chevronDownComponent={<DownIcon />}
971
+ styles={{
972
+ pillButton: {
973
+ fontFamily: 'Plus Jakarta Sans, sans-serif',
974
+ border: '0px',
975
+ padding: '8px',
976
+ cursor: 'pointer'
977
+ }
978
+ }}
979
+ />
980
+ ```
755
981
 
756
982
  ### Props
757
-
758
- Further details to be added.
983
+ | Prop | Type | Required | Description |
984
+ |------|------|----------|-------------|
985
+ | `baseUrl` | string | Yes | API base URL |
986
+ | `taskId` | string | Yes | Task/project identifier |
987
+ | `citationTitle` | string \| ReactNode | Yes | Accordion header title |
988
+ | `isChecked` | boolean | No | Controlled checkbox state |
989
+ | `onCheckChange` | function | No | Checkbox change callback |
990
+ | `execSummary` | string | No | Pre-fetched summary text |
759
991
 
760
992
  ---
761
993
 
994
+
762
995
  ## UploadData
763
996
 
764
997
  ### Overview
@@ -773,28 +1006,258 @@ UploadData is a feature within the DataSelector component that handles data impo
773
1006
  - **Cloud integration** - Google Drive integration for cloud-based data
774
1007
  - **Saved dataset management** - Access and manage previously saved datasets
775
1008
 
776
- ### Installation
1009
+ ### Usage
777
1010
 
778
- ```bash
779
- npm install @e-llm-studio/citation
1011
+ ```tsx
1012
+ import { UploadData } from '@e-llm-studio/citation'
1013
+ import { DataSelectedProvider } from '@e-llm-studio/citation/context/DataSelectedContext'
1014
+
1015
+ <DataSelectedProvider>
1016
+ <UploadData />
1017
+ </DataSelectedProvider>
780
1018
  ```
781
1019
 
782
- ### Usage
1020
+ ### Upload Sources
783
1021
 
784
- UploadData is typically used as part of the DataSelector component workflow. It manages the data import process through various sub-components that handle specific data sources.
1022
+ - **RLEF Projects**: Data from Research Learning Ecosystem Framework
1023
+ - **Google Drive**: Cloud-based file storage
1024
+ - **Local Files**: Direct file upload from device
1025
+ - **Saved Datasets**: Previously saved data collections
785
1026
 
786
- ### Props
787
1027
 
788
- Further details to be added.
1028
+ **Integration Example**:
1029
+ ```tsx
1030
+ import { useSelectDataContext } from '@e-llm-studio/citation/context/DataSelectedContext'
1031
+
1032
+ const MyComponent = () => {
1033
+ const { selectedRlefResources, saveSelectedDataAsDataSet } = useSelectDataContext()
1034
+
1035
+ return (
1036
+ <DataSelectedProvider>
1037
+ <UploadData />
1038
+ <button onClick={() => saveSelectedDataAsDataSet()}>
1039
+ Save as Dataset
1040
+ </button>
1041
+ </DataSelectedProvider>
1042
+ )
1043
+ }
1044
+ ```
789
1045
 
790
1046
  ---
791
1047
 
792
- ## License
1048
+ ## Common Use Cases
793
1049
 
794
- This library is licensed under the MIT License. See the LICENSE file for details.
1050
+ ### RAG (Retrieval Augmented Generation) Applications
1051
+ ```tsx
1052
+ // Display book citations in RAG responses
1053
+ <BookCitation
1054
+ citationTitle="Source: Machine Learning Textbook"
1055
+ paragraphs={[relevantParagraph]}
1056
+ textToHighlight={[queryKeywords]}
1057
+ />
1058
+
1059
+ // Show AI reasoning behind answers
1060
+ <CognitiveDecisioningCard
1061
+ score="88"
1062
+ reasoning="Based on chapter 3 of the textbook..."
1063
+ gap="The textbook doesn't cover recent developments after 2020"
1064
+ />
1065
+ ```
1066
+
1067
+ ### Code Review and Documentation
1068
+ ```tsx
1069
+ // Display code snippets with diagnostics
1070
+ <CodeCitation
1071
+ filename="utils.js"
1072
+ customCode={problematicCode}
1073
+ diagnostics={lintErrors}
1074
+ isHighlightingEnabled={true}
1075
+ startIndex={errorLine - 1}
1076
+ endIndex={errorLine + 1}
1077
+ />
1078
+
1079
+ // Show training data citations for code explanations
1080
+ <NonWebReasoningComponent
1081
+ item={trainingDataCitation}
1082
+ index={1}
1083
+ headerTitle="Training Data Reference"
1084
+ />
1085
+ ```
1086
+
1087
+ ### Audio/Video Content Analysis
1088
+ ```tsx
1089
+ // Show audio citations with synchronized transcripts
1090
+ <CitationsViewer
1091
+ artifact={audioAnalysis}
1092
+ onCloseHandler={closePlayer}
1093
+ />
1094
+
1095
+ // Display key takeaways from audio content
1096
+ <CitationsViewer
1097
+ artifact={{
1098
+ fileUrl: "gs://bucket/interview.mp3",
1099
+ keyTakeaways: [
1100
+ {
1101
+ takeawayId: "1",
1102
+ name: "Key Insight",
1103
+ content: "**Important finding** from the interview",
1104
+ keywords: ["insight", "finding"]
1105
+ }
1106
+ ]
1107
+ }}
1108
+ />
1109
+ ```
1110
+
1111
+ ### Document Review Workflows
1112
+ ```tsx
1113
+ // PDF review with highlighting
1114
+ <PdfViewer
1115
+ pdfUrl={contractUrl}
1116
+ highlightText={keyClauses}
1117
+ highlightPages={relevantPages}
1118
+ />
1119
+
1120
+ // Collaborative PDF editing
1121
+ <PdfEditorCitation
1122
+ citationTitleElement={<div>Legal Document.pdf</div>}
1123
+ pdfUrl={legalDocUrl}
1124
+ currentUserId={user.id}
1125
+ pdfEditorBackendBaseUrl="https://pdf-backend.example.com"
1126
+ />
1127
+ ```
1128
+
1129
+ ### Data Import and Management
1130
+ ```tsx
1131
+ // Multi-step data import wizard
1132
+ <DataSelectedContextProvider>
1133
+ <DataSelector
1134
+ pageTitle="Import Training Data"
1135
+ selectedRlefResources={trainingData}
1136
+ setSelectedRlefResources={setTrainingData}
1137
+ />
1138
+ </DataSelectedContextProvider>
1139
+
1140
+ // Upload interface wrapper
1141
+ <DataSelectedProvider>
1142
+ <UploadData />
1143
+ </DataSelectedProvider>
1144
+ ```
1145
+
1146
+ ### Performance-Optimized Data Display
1147
+ ```tsx
1148
+ // Virtualized table for large datasets
1149
+ <PaginatedTable
1150
+ headers={columns}
1151
+ tableData={largeDataset}
1152
+ totalFileRecords={100000}
1153
+ onNextPage={loadMoreData}
1154
+ loadingMore={loading}
1155
+ style={{ height: "500px" }}
1156
+ />
1157
+ ```
795
1158
 
796
1159
  ---
797
1160
 
798
- ## Contributing
1161
+ ## Development & Contribution
1162
+
1163
+ Contributions are welcome! This guide walks you through making changes to the citation library.
1164
+
1165
+ ### Prerequisites
1166
+
1167
+ - **Node.js & npm** installed
1168
+ - **Git** installed
1169
+ - Basic familiarity with Git and the command line
1170
+
1171
+ ### Development Setup
1172
+
1173
+ 1. **Fork & Clone the Repository**
1174
+ ```bash
1175
+ git clone https://github.com/<your-username>/citation.git
1176
+ cd citation
1177
+ ```
1178
+
1179
+ 2. **Install Dependencies**
1180
+ ```bash
1181
+ npm install
1182
+ ```
1183
+
1184
+ 3. **Link the Library Locally** (Optional - for testing before publishing)
1185
+ ```bash
1186
+ git checkout -b my-change-branch
1187
+ npm link
1188
+
1189
+ # In your test project folder
1190
+ npm link @e-llm-studio/citation
1191
+ ```
1192
+
1193
+ 4. **Build the Library**
1194
+ ```bash
1195
+ npm run build
1196
+ ```
1197
+
1198
+ 5. **Test Locally**
1199
+ - Start or build your test project to verify changes work as expected
1200
+ - Ensure all existing tests pass
1201
+
1202
+ ### Making Changes
1203
+
1204
+ - Edit source files in the `src/` directory
1205
+ - Add or update tests as needed
1206
+ - Follow the existing code style and formatting guidelines
1207
+ - Ensure your changes are well-documented with comments
1208
+
1209
+ ### Submitting Changes
1210
+
1211
+ 1. **Commit Your Changes**
1212
+ ```bash
1213
+ git add .
1214
+ git commit -m "fix: describe your change"
1215
+ git push origin my-change-branch
1216
+ ```
1217
+
1218
+ 2. **Submit a Pull Request**
1219
+ - Open a pull request on GitHub with a clear description of your changes
1220
+ - Reference any related issues
1221
+ - Ensure all tests pass before submitting
1222
+
1223
+ ### Versioning
1224
+
1225
+ When publishing updates, follow [Semantic Versioning](https://semver.org/):
1226
+
1227
+ ```bash
1228
+ npm version patch # for bug fixes
1229
+ npm version minor # for new features
1230
+ npm version major # for breaking changes
1231
+ ```
1232
+
1233
+ For more details, refer to the [npm version documentation](https://docs.npmjs.com/cli/v8/commands/npm-version).
1234
+
1235
+ ### Publishing to npm
1236
+
1237
+ > Ensure you have npm account permissions and are on the correct branch.
1238
+
1239
+ ```bash
1240
+ npm login
1241
+ npm publish --access public
1242
+ ```
1243
+
1244
+ After publishing, verify the package:
1245
+
1246
+ ```bash
1247
+ npm unlink @e-llm-studio/citation
1248
+ npm install @e-llm-studio/citation@latest
1249
+ ```
1250
+
1251
+ ### Additional Tips
1252
+
1253
+ - Use `npm pack` to generate a `.tgz` and test installation before publishing
1254
+ - Open a Pull Request when ready for review
1255
+ - We appreciate your help in improving the citation library through bug fixes, feature enhancements, and documentation improvements
1256
+
1257
+ ---
1258
+
1259
+ ## License
1260
+
1261
+ This library is released under the MIT License. See the LICENSE file for more details.
799
1262
 
800
- Contributions are welcome! Please submit a pull request or open an issue for any feature requests or bug fixes. We appreciate your help in improving the citation library through bug fixes, feature enhancements, and documentation improvements.
1263
+ The license information is also available in the `citation/package.json` file under the 'license' field.