Spaces:
Running
Running
chore (maintainance): Update depdencies, copyright and minimal support for chat template.
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- README.md +4 -3
- next.config.js +1 -1
- notebooks/validate_input_file.ipynb +1 -1
- package.json +30 -27
- public/app.LICENSE.txt +1 -1
- src/app/cookbooks/page.tsx +1 -1
- src/app/documentation/page.tsx +1 -1
- src/app/examples/[example_id]/layout.tsx +1 -1
- src/app/examples/[example_id]/page.tsx +1 -1
- src/app/examples/page.tsx +1 -1
- src/app/global.scss +1 -1
- src/app/layout.tsx +1 -1
- src/app/loading.tsx +1 -1
- src/app/page.tsx +1 -1
- src/app/visualize/layout.tsx +1 -1
- src/app/visualize/loading.tsx +1 -1
- src/app/visualize/page.tsx +1 -1
- src/components/avatar/Avatar.module.scss +37 -0
- src/components/avatar/Avatar.tsx +45 -0
- src/components/chatline/ChatLine.module.scss +165 -0
- src/components/chatline/ChatLine.tsx +271 -0
- src/components/comments/AddCommentModal.module.scss +1 -1
- src/components/comments/AddCommentModal.tsx +1 -1
- src/components/comments/CommentViewer.module.scss +1 -1
- src/components/comments/CommentsViewer.tsx +1 -1
- src/components/comments/EditCommentModal.tsx +1 -1
- src/components/disabled/DisabledTab.module.scss +1 -1
- src/components/disabled/DisabledTab.tsx +1 -1
- src/components/documents-viewer/DocumentsViewer.module.scss +109 -0
- src/components/documents-viewer/DocumentsViewer.tsx +168 -0
- src/components/example-tile/ExampleTile.module.scss +1 -1
- src/components/example-tile/ExampleTile.tsx +3 -24
- src/components/example-tile/SkeletonExampleTile.tsx +1 -1
- src/components/expression-builder/ExpressionBuilder.module.scss +1 -1
- src/components/expression-builder/ExpressionBuilder.tsx +1 -1
- src/components/filters/Filters.module.scss +1 -1
- src/components/filters/Filters.tsx +1 -1
- src/components/filters/SkeletonFilters.tsx +1 -1
- src/components/header/Header.jsx +4 -4
- src/components/header/Header.module.scss +1 -1
- src/components/notification/Notification.module.scss +1 -1
- src/components/notification/Notification.tsx +1 -1
- src/components/selectors/AggregatorSelector.tsx +1 -1
- src/components/selectors/MetricSelector.tsx +1 -1
- src/components/selectors/ModelSelector.tsx +1 -1
- src/components/task-tile/SkeletonTaskTile.tsx +1 -1
- src/components/task-tile/TaskTile.module.scss +1 -1
- src/components/task-tile/TaskTile.tsx +1 -1
- src/dataloader.ts +1 -1
- src/hooks/useBackButton.ts +8 -7
README.md
CHANGED
|
@@ -219,9 +219,10 @@ Notes:
|
|
| 219 |
Notes:
|
| 220 |
|
| 221 |
1. Each task must have a unique `task_id`.
|
| 222 |
-
2. Task type can be of `
|
| 223 |
-
3. `input` is an array of utterances. An utterance's speaker could be either `user` or `agent`. Each utterance must have a `text` field.
|
| 224 |
-
4. `
|
|
|
|
| 225 |
5. `targets` field is an array of expected gold or reference texts.
|
| 226 |
6. `category` is an optional field that represents the type of task for grouping similar tasks.
|
| 227 |
7. `filters` is a top-level field (parallel to `tasks`) which specifies an array of fields defined inside `tasks` for filtering tasks during analysis.
|
|
|
|
| 219 |
Notes:
|
| 220 |
|
| 221 |
1. Each task must have a unique `task_id`.
|
| 222 |
+
2. Task type can be of `rag`, or of `text_generation`, or of `chat` type.
|
| 223 |
+
3. For `rag` and `text_generation` type task, `input` is an array of utterances. An utterance's speaker could be either `user` or `agent`. Each utterance must have a `text` field.
|
| 224 |
+
4. For `chat` type task, `input` must be array of messages as defined by OpenAI's chat completion APIs (https://platform.openai.com/docs/api-reference/chat/create#chat-create-messages).
|
| 225 |
+
4. For `rag` task, `contexts` field represents a subset of documents from the `documents` field relevant to the `input` and is available to the generative models.
|
| 226 |
5. `targets` field is an array of expected gold or reference texts.
|
| 227 |
6. `category` is an optional field that represents the type of task for grouping similar tasks.
|
| 228 |
7. `filters` is a top-level field (parallel to `tasks`) which specifies an array of fields defined inside `tasks` for filtering tasks during analysis.
|
next.config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
notebooks/validate_input_file.ipynb
CHANGED
|
@@ -196,7 +196,7 @@
|
|
| 196 |
" f\"Invalid type: {type(task['task_type'])} for 'task_type' field in {task}\"\n",
|
| 197 |
" )\n",
|
| 198 |
"\n",
|
| 199 |
-
" if task[\"task_type\"] not in [\"
|
| 200 |
" raise ValueError(f\"Invalid task_type: {task['task_type']} in {task}\")\n",
|
| 201 |
"\n",
|
| 202 |
" # Validate `contexts` field\n",
|
|
|
|
| 196 |
" f\"Invalid type: {type(task['task_type'])} for 'task_type' field in {task}\"\n",
|
| 197 |
" )\n",
|
| 198 |
"\n",
|
| 199 |
+
" if task[\"task_type\"] not in [\"rag\", \"text_generation\", \"json_generation\", \"chat\"]:\n",
|
| 200 |
" raise ValueError(f\"Invalid task_type: {task['task_type']} in {task}\")\n",
|
| 201 |
"\n",
|
| 202 |
" # Validate `contexts` field\n",
|
package.json
CHANGED
|
@@ -6,12 +6,13 @@
|
|
| 6 |
"author": "[email protected]",
|
| 7 |
"license": "ISC",
|
| 8 |
"scripts": {
|
| 9 |
-
"postinstall": "husky
|
| 10 |
"dev": "next dev",
|
| 11 |
-
"build": "next build
|
| 12 |
"start": "next start",
|
| 13 |
"lint": "next lint && stylelint \"**/*.{css,scss}\"",
|
| 14 |
-
"format": "prettier --write ."
|
|
|
|
| 15 |
},
|
| 16 |
"husky": {
|
| 17 |
"hooks": {
|
|
@@ -19,42 +20,44 @@
|
|
| 19 |
}
|
| 20 |
},
|
| 21 |
"devDependencies": {
|
| 22 |
-
"@next/eslint-plugin-next": "^
|
| 23 |
-
"@types/node": "
|
| 24 |
"cross-env": "^7.0.3",
|
| 25 |
-
"eslint": "^
|
| 26 |
-
"eslint-config-next": "^
|
| 27 |
-
"eslint-config-prettier": "^
|
| 28 |
-
"husky": "^
|
| 29 |
-
"
|
| 30 |
-
"
|
| 31 |
-
"
|
| 32 |
-
"
|
| 33 |
-
"stylelint": "
|
| 34 |
-
"stylelint-config-standard-scss": "13.0.0"
|
| 35 |
},
|
| 36 |
"dependencies": {
|
| 37 |
-
"@carbon/colors": "^11.
|
| 38 |
-
"@carbon/themes": "^11.
|
| 39 |
-
"@carbon/icons-react": "^11.
|
| 40 |
-
"@carbon/pictograms-react": "^11.
|
| 41 |
-
"@carbon/charts": "^1.
|
| 42 |
-
"@carbon/charts-react": "^1.
|
| 43 |
-
"@carbon/react": "
|
| 44 |
"d3": "^7.8.4",
|
| 45 |
"date-fns": "^2.30.0",
|
| 46 |
"dompurify": "3.1.7",
|
| 47 |
"html-react-parser": "^5.1.1",
|
| 48 |
-
"lodash": "^4.17.
|
| 49 |
"next": "^14.1.1",
|
| 50 |
-
"prop-types": "^15.7.2",
|
| 51 |
"react": "^18.2.0",
|
| 52 |
"react-dom": "^18.2.0",
|
| 53 |
"react-intl": "^6.1.0",
|
| 54 |
-
"react-markdown": "^
|
| 55 |
"rehype-raw": "^7.0.0",
|
| 56 |
-
"remark-gfm": "^
|
| 57 |
"statistics.js": "^1.0.0",
|
| 58 |
-
"uuid": "^9.0.1"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
}
|
| 60 |
}
|
|
|
|
| 6 |
"author": "[email protected]",
|
| 7 |
"license": "ISC",
|
| 8 |
"scripts": {
|
| 9 |
+
"postinstall": "husky init",
|
| 10 |
"dev": "next dev",
|
| 11 |
+
"build": "next build",
|
| 12 |
"start": "next start",
|
| 13 |
"lint": "next lint && stylelint \"**/*.{css,scss}\"",
|
| 14 |
+
"format": "prettier --write .",
|
| 15 |
+
"prepare": "husky"
|
| 16 |
},
|
| 17 |
"husky": {
|
| 18 |
"hooks": {
|
|
|
|
| 20 |
}
|
| 21 |
},
|
| 22 |
"devDependencies": {
|
| 23 |
+
"@next/eslint-plugin-next": "^15.2.1",
|
| 24 |
+
"@types/node": "^22.13.10",
|
| 25 |
"cross-env": "^7.0.3",
|
| 26 |
+
"eslint": "^9.22.0",
|
| 27 |
+
"eslint-config-next": "^15.2.1",
|
| 28 |
+
"eslint-config-prettier": "^10.1.1",
|
| 29 |
+
"husky": "^9.1.7",
|
| 30 |
+
"prettier": "^3.5.3",
|
| 31 |
+
"sass": "^1.85.1",
|
| 32 |
+
"typescript": "^5.8.2",
|
| 33 |
+
"stylelint": "^16.15.0",
|
| 34 |
+
"stylelint-config-standard-scss": "^14.0.0"
|
|
|
|
| 35 |
},
|
| 36 |
"dependencies": {
|
| 37 |
+
"@carbon/colors": "^11.30.0",
|
| 38 |
+
"@carbon/themes": "^11.47.0",
|
| 39 |
+
"@carbon/icons-react": "^11.56.0",
|
| 40 |
+
"@carbon/pictograms-react": "^11.73.0",
|
| 41 |
+
"@carbon/charts": "^1.23.0",
|
| 42 |
+
"@carbon/charts-react": "^1.23.0",
|
| 43 |
+
"@carbon/react": "1.75.0",
|
| 44 |
"d3": "^7.8.4",
|
| 45 |
"date-fns": "^2.30.0",
|
| 46 |
"dompurify": "3.1.7",
|
| 47 |
"html-react-parser": "^5.1.1",
|
| 48 |
+
"lodash": "^4.17.21",
|
| 49 |
"next": "^14.1.1",
|
|
|
|
| 50 |
"react": "^18.2.0",
|
| 51 |
"react-dom": "^18.2.0",
|
| 52 |
"react-intl": "^6.1.0",
|
| 53 |
+
"react-markdown": "^10.0.0",
|
| 54 |
"rehype-raw": "^7.0.0",
|
| 55 |
+
"remark-gfm": "^4.0.1",
|
| 56 |
"statistics.js": "^1.0.0",
|
| 57 |
+
"uuid": "^9.0.1",
|
| 58 |
+
"react-wrap-balancer": "^1.1.1"
|
| 59 |
+
},
|
| 60 |
+
"resolutions": {
|
| 61 |
+
"@carbon/styles": "1.75.0"
|
| 62 |
}
|
| 63 |
}
|
public/app.LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/*!
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/*!
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/app/cookbooks/page.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/app/documentation/page.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/app/examples/[example_id]/layout.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/app/examples/[example_id]/page.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/app/examples/page.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/app/global.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/app/layout.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/app/loading.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/app/page.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/app/visualize/layout.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/app/visualize/loading.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/app/visualize/page.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/avatar/Avatar.module.scss
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*
|
| 17 |
+
**/
|
| 18 |
+
|
| 19 |
+
@use '@carbon/react/scss/spacing' as *;
|
| 20 |
+
@use '@carbon/colors' as *;
|
| 21 |
+
|
| 22 |
+
.wrapper {
|
| 23 |
+
height: 52px;
|
| 24 |
+
width: 52px;
|
| 25 |
+
border-radius: 50%;
|
| 26 |
+
background-color: var(--cds-layer-active-01);
|
| 27 |
+
display: flex;
|
| 28 |
+
align-items: center;
|
| 29 |
+
justify-content: center;
|
| 30 |
+
overflow: hidden;
|
| 31 |
+
object-fit: none;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
.wrapper img {
|
| 35 |
+
height: 52px;
|
| 36 |
+
width: 52px;
|
| 37 |
+
}
|
src/components/avatar/Avatar.tsx
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*
|
| 17 |
+
**/
|
| 18 |
+
|
| 19 |
+
import cx from 'classnames';
|
| 20 |
+
import { User, Compass, Bot, Tools } from '@carbon/icons-react';
|
| 21 |
+
|
| 22 |
+
import classes from './Avatar.module.scss';
|
| 23 |
+
|
| 24 |
+
// ===================================================================================
|
| 25 |
+
// MAIN FUNCTION
|
| 26 |
+
// ===================================================================================
|
| 27 |
+
export default function Avatar({
|
| 28 |
+
role,
|
| 29 |
+
}: {
|
| 30 |
+
role: 'system' | 'developer' | 'user' | 'tool' | 'assistant';
|
| 31 |
+
}) {
|
| 32 |
+
return (
|
| 33 |
+
<div className={cx(classes.wrapper)}>
|
| 34 |
+
{role === 'assistant' ? (
|
| 35 |
+
<Bot width="32px" height="32px" />
|
| 36 |
+
) : role === 'tool' ? (
|
| 37 |
+
<Tools width="32px" height="32px" />
|
| 38 |
+
) : role === 'system' || role === 'developer' ? (
|
| 39 |
+
<Compass width="32px" height="32px" />
|
| 40 |
+
) : (
|
| 41 |
+
<User width="32px" height="32px" />
|
| 42 |
+
)}
|
| 43 |
+
</div>
|
| 44 |
+
);
|
| 45 |
+
}
|
src/components/chatline/ChatLine.module.scss
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*
|
| 17 |
+
**/
|
| 18 |
+
|
| 19 |
+
@use '@carbon/react/scss/spacing' as *;
|
| 20 |
+
@use '@carbon/colors' as *;
|
| 21 |
+
|
| 22 |
+
.line {
|
| 23 |
+
display: flex;
|
| 24 |
+
flex-direction: row-reverse;
|
| 25 |
+
justify-content: flex-start;
|
| 26 |
+
align-items: flex-end;
|
| 27 |
+
margin-bottom: 1.25rem;
|
| 28 |
+
gap: 24px;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
.assistantLine {
|
| 32 |
+
justify-content: flex-start;
|
| 33 |
+
flex-direction: row;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
.latestResponse {
|
| 37 |
+
margin-bottom: 3rem;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
.baloon {
|
| 41 |
+
display: flex;
|
| 42 |
+
flex-direction: column;
|
| 43 |
+
border-radius: 1rem;
|
| 44 |
+
border-bottom-right-radius: 0;
|
| 45 |
+
background: var(--cds-layer-01);
|
| 46 |
+
width: 80%;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
.assistantBaloon {
|
| 50 |
+
border-bottom-left-radius: 0;
|
| 51 |
+
border-bottom-right-radius: 1rem;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.toolCallBaloon {
|
| 55 |
+
background-color: var(--cds-highlight);
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
.toolResponseBaloon {
|
| 59 |
+
background-color: var(--cds-tag-background-green);
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
.message {
|
| 63 |
+
font-size: 16px;
|
| 64 |
+
line-height: 22px;
|
| 65 |
+
margin: $spacing-04 $spacing-05;
|
| 66 |
+
min-width: 120px;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
.toolCall {
|
| 70 |
+
display: flex;
|
| 71 |
+
flex-direction: column;
|
| 72 |
+
row-gap: $spacing-03;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
.toolCall :global(.cds--snippet--multi) {
|
| 76 |
+
min-inline-size: 100%;
|
| 77 |
+
max-inline-size: 100%;
|
| 78 |
+
padding: 0 0 $spacing-03;
|
| 79 |
+
background-color: var(--cds-background);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
.toolCall :global(.cds--snippet-container) {
|
| 83 |
+
padding: $spacing-03;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.toolResponse {
|
| 87 |
+
display: flex;
|
| 88 |
+
flex-direction: column;
|
| 89 |
+
row-gap: $spacing-03;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
.toolResponse :global(.cds--snippet--multi) {
|
| 93 |
+
max-inline-size: 100%;
|
| 94 |
+
padding: 0 0 $spacing-03;
|
| 95 |
+
background-color: var(--cds-background);
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
.toolResponse :global(.cds--snippet-container) {
|
| 99 |
+
padding: $spacing-03;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
.viewDocumentsButton {
|
| 103 |
+
border: 1px solid var(--cds-background-inverse);
|
| 104 |
+
border-radius: 50%;
|
| 105 |
+
width: 32px;
|
| 106 |
+
height: 32px;
|
| 107 |
+
margin: -10px auto -16px;
|
| 108 |
+
background: var(--cds-background);
|
| 109 |
+
cursor: pointer;
|
| 110 |
+
display: flex;
|
| 111 |
+
justify-content: center;
|
| 112 |
+
align-items: center;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
.viewDocumentsIcon {
|
| 116 |
+
color: var(--cds-background-inverse);
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.toolbar {
|
| 120 |
+
border: none;
|
| 121 |
+
cursor: pointer;
|
| 122 |
+
display: flex;
|
| 123 |
+
justify-content: flex-end;
|
| 124 |
+
margin: 0 $spacing-05;
|
| 125 |
+
align-items: baseline;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
.btnActive {
|
| 129 |
+
background-color: var(--cds-background-selected);
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
.superscript {
|
| 133 |
+
vertical-align: super;
|
| 134 |
+
font-size: 12px;
|
| 135 |
+
margin-left: $spacing-01;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
.citations {
|
| 139 |
+
margin: 0 $spacing-05;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
.feedbackContainer {
|
| 143 |
+
width: 500px;
|
| 144 |
+
display: flex;
|
| 145 |
+
flex-direction: column;
|
| 146 |
+
margin: 0 $spacing-05 $spacing-03;
|
| 147 |
+
align-self: flex-start;
|
| 148 |
+
row-gap: $spacing-03;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
.feedbackMetricContainer {
|
| 152 |
+
display: flex;
|
| 153 |
+
justify-content: space-between;
|
| 154 |
+
align-items: center;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
.feedbackMetricDescription {
|
| 158 |
+
display: flex;
|
| 159 |
+
column-gap: $spacing-02;
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
.feedbackMetricValues {
|
| 163 |
+
margin-left: auto;
|
| 164 |
+
align-self: flex-end;
|
| 165 |
+
}
|
src/components/chatline/ChatLine.tsx
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*
|
| 17 |
+
**/
|
| 18 |
+
|
| 19 |
+
import cx from 'classnames';
|
| 20 |
+
import Balancer from 'react-wrap-balancer';
|
| 21 |
+
import { useState, useEffect, useRef } from 'react';
|
| 22 |
+
|
| 23 |
+
import { CodeSnippet } from '@carbon/react';
|
| 24 |
+
|
| 25 |
+
import { Message, ToolCall, ToolMessage, AssistantMessage } from '@/src/types';
|
| 26 |
+
import Avatar from '@/src/components/avatar/Avatar';
|
| 27 |
+
import DocumentsViewer from '@/src/components/documents-viewer/DocumentsViewer';
|
| 28 |
+
|
| 29 |
+
import classes from './ChatLine.module.scss';
|
| 30 |
+
|
| 31 |
+
// ===================================================================================
|
| 32 |
+
// TYPES
|
| 33 |
+
// ===================================================================================
|
| 34 |
+
interface ChatLineProps {
|
| 35 |
+
messageId: string;
|
| 36 |
+
message: Message;
|
| 37 |
+
latestResponse?: boolean;
|
| 38 |
+
onSelection?: Function;
|
| 39 |
+
focused?: boolean;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
// ===================================================================================
|
| 43 |
+
// RENDER FUNCTIONS
|
| 44 |
+
// ===================================================================================
|
| 45 |
+
function Tool({ tool }: { tool: ToolCall }) {
|
| 46 |
+
return (
|
| 47 |
+
<div className={cx(classes.message, classes.toolCall)}>
|
| 48 |
+
<span>
|
| 49 |
+
Tool ID: {tool.id}
|
| 50 |
+
{tool.function.name ? <span>({tool.function.name})</span> : null}
|
| 51 |
+
</span>
|
| 52 |
+
{tool.function.arguments ? (
|
| 53 |
+
<CodeSnippet type="multi" hideCopyButton wrapText>
|
| 54 |
+
{JSON.stringify(tool.function.arguments, null, 2)}
|
| 55 |
+
</CodeSnippet>
|
| 56 |
+
) : null}
|
| 57 |
+
</div>
|
| 58 |
+
);
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
function ToolResponse({
|
| 62 |
+
messageId,
|
| 63 |
+
message,
|
| 64 |
+
onSelection,
|
| 65 |
+
}: {
|
| 66 |
+
messageId: string;
|
| 67 |
+
message: ToolMessage;
|
| 68 |
+
onSelection?: Function;
|
| 69 |
+
}) {
|
| 70 |
+
// Step 1: Initialize state and necessary variables
|
| 71 |
+
const [documentIndex, setDocumentIndex] = useState<number>(0);
|
| 72 |
+
|
| 73 |
+
// Step 2: Render
|
| 74 |
+
return (
|
| 75 |
+
<div className={cx(classes.message, classes.toolResponse)}>
|
| 76 |
+
<span>
|
| 77 |
+
Tool ID: {message.tool_id}
|
| 78 |
+
{message.name ? <span>({message.name})</span> : null}
|
| 79 |
+
</span>
|
| 80 |
+
{message.type === 'documents' && Array.isArray(message.content) ? (
|
| 81 |
+
<DocumentsViewer
|
| 82 |
+
key={`${messageId}__documents--${message.content.length}`}
|
| 83 |
+
id={`${messageId}__documents`}
|
| 84 |
+
documents={message.content}
|
| 85 |
+
documentIndex={documentIndex}
|
| 86 |
+
setDocumentIndex={setDocumentIndex}
|
| 87 |
+
onSelection={onSelection}
|
| 88 |
+
></DocumentsViewer>
|
| 89 |
+
) : message.type === 'json' ? (
|
| 90 |
+
<CodeSnippet type="multi" hideCopyButton wrapText>
|
| 91 |
+
{JSON.stringify(message.content, null, 2)}
|
| 92 |
+
</CodeSnippet>
|
| 93 |
+
) : (
|
| 94 |
+
<Balancer
|
| 95 |
+
className={cx(classes.message, classes.toolMessage)}
|
| 96 |
+
ratio={0.2}
|
| 97 |
+
onMouseDown={() => {
|
| 98 |
+
if (onSelection) {
|
| 99 |
+
onSelection(
|
| 100 |
+
`messages[${messageId.split('--').slice(-1)[0]}].content`,
|
| 101 |
+
);
|
| 102 |
+
}
|
| 103 |
+
}}
|
| 104 |
+
onMouseUp={() => {
|
| 105 |
+
if (onSelection) {
|
| 106 |
+
onSelection(
|
| 107 |
+
`messages[${messageId.split('--').slice(-1)[0]}].content`,
|
| 108 |
+
);
|
| 109 |
+
}
|
| 110 |
+
}}
|
| 111 |
+
>
|
| 112 |
+
{typeof message.content === 'string'
|
| 113 |
+
? message.content.split('\n').map((line, i) => (
|
| 114 |
+
<span key={i}>
|
| 115 |
+
{line}
|
| 116 |
+
<br />
|
| 117 |
+
</span>
|
| 118 |
+
))
|
| 119 |
+
: message.content}
|
| 120 |
+
</Balancer>
|
| 121 |
+
)}
|
| 122 |
+
</div>
|
| 123 |
+
);
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
function AssistantResponse({
|
| 127 |
+
messageId,
|
| 128 |
+
message,
|
| 129 |
+
onSelection,
|
| 130 |
+
}: {
|
| 131 |
+
messageId: string;
|
| 132 |
+
message: AssistantMessage;
|
| 133 |
+
onSelection?: Function;
|
| 134 |
+
}) {
|
| 135 |
+
return (
|
| 136 |
+
<div className={classes.assistantResponse}>
|
| 137 |
+
{message.content ? (
|
| 138 |
+
<Balancer
|
| 139 |
+
className={cx(classes.message, classes.assistantMessage)}
|
| 140 |
+
ratio={0.2}
|
| 141 |
+
onMouseDown={() => {
|
| 142 |
+
if (onSelection) {
|
| 143 |
+
onSelection(
|
| 144 |
+
`messages[${messageId.split('--').slice(-1)[0]}].content`,
|
| 145 |
+
);
|
| 146 |
+
}
|
| 147 |
+
}}
|
| 148 |
+
onMouseUp={() => {
|
| 149 |
+
if (onSelection) {
|
| 150 |
+
onSelection(
|
| 151 |
+
`messages[${messageId.split('--').slice(-1)[0]}].content`,
|
| 152 |
+
);
|
| 153 |
+
}
|
| 154 |
+
}}
|
| 155 |
+
>
|
| 156 |
+
{message.content.split('\n').map((line, i) => (
|
| 157 |
+
<span key={i}>
|
| 158 |
+
{line}
|
| 159 |
+
<br />
|
| 160 |
+
</span>
|
| 161 |
+
))}
|
| 162 |
+
</Balancer>
|
| 163 |
+
) : null}
|
| 164 |
+
{message.tool_calls
|
| 165 |
+
? message.tool_calls.map((tool, toolIdx) => {
|
| 166 |
+
return (
|
| 167 |
+
<Tool key={`message-${messageId}__tool-${toolIdx}`} tool={tool} />
|
| 168 |
+
);
|
| 169 |
+
})
|
| 170 |
+
: null}
|
| 171 |
+
</div>
|
| 172 |
+
);
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
// ===================================================================================
|
| 176 |
+
// MAIN FUNCTIONS
|
| 177 |
+
// ===================================================================================
|
| 178 |
+
export default function ChatLine({
|
| 179 |
+
messageId,
|
| 180 |
+
message,
|
| 181 |
+
latestResponse,
|
| 182 |
+
onSelection,
|
| 183 |
+
focused,
|
| 184 |
+
}: ChatLineProps) {
|
| 185 |
+
// Step 1: Initialize state and necessary variables
|
| 186 |
+
const anchorRef = useRef<HTMLDivElement>(null);
|
| 187 |
+
|
| 188 |
+
// Step 2: Run effects
|
| 189 |
+
// Step 2.a: Scroll into view
|
| 190 |
+
useEffect(() => {
|
| 191 |
+
if (anchorRef.current && focused) {
|
| 192 |
+
anchorRef.current.scrollIntoView({
|
| 193 |
+
behavior: 'smooth',
|
| 194 |
+
block: message.role === 'user' ? 'start' : 'center',
|
| 195 |
+
inline: 'center',
|
| 196 |
+
});
|
| 197 |
+
}
|
| 198 |
+
}, [focused, message.role]);
|
| 199 |
+
|
| 200 |
+
// Step 3: Render
|
| 201 |
+
// Step 3.a: Return "null" if message is undefined
|
| 202 |
+
if (!message) {
|
| 203 |
+
return null;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
// Step 3.b: Render chat line
|
| 207 |
+
return (
|
| 208 |
+
<div
|
| 209 |
+
ref={anchorRef}
|
| 210 |
+
className={cx(classes.line, {
|
| 211 |
+
[classes.assistantLine]: message.role === 'assistant',
|
| 212 |
+
[classes.latestResponse]: latestResponse,
|
| 213 |
+
})}
|
| 214 |
+
>
|
| 215 |
+
<Avatar role={message.role} />
|
| 216 |
+
<div
|
| 217 |
+
className={cx(
|
| 218 |
+
classes.baloon,
|
| 219 |
+
message.role === 'assistant'
|
| 220 |
+
? //@ts-ignore
|
| 221 |
+
message.tool_calls
|
| 222 |
+
? classes.toolCallBaloon
|
| 223 |
+
: classes.assistantBaloon
|
| 224 |
+
: message.role === 'tool'
|
| 225 |
+
? classes.toolResponseBaloon
|
| 226 |
+
: null,
|
| 227 |
+
)}
|
| 228 |
+
>
|
| 229 |
+
{message.role === 'system' ||
|
| 230 |
+
message.role === 'developer' ||
|
| 231 |
+
message.role === 'user' ? (
|
| 232 |
+
<Balancer
|
| 233 |
+
className={cx(classes.message)}
|
| 234 |
+
ratio={0.2}
|
| 235 |
+
onMouseDown={() => {
|
| 236 |
+
if (onSelection) {
|
| 237 |
+
onSelection(
|
| 238 |
+
`messages[${messageId.split('--').slice(-1)[0]}].text`,
|
| 239 |
+
);
|
| 240 |
+
}
|
| 241 |
+
}}
|
| 242 |
+
onMouseUp={() => {
|
| 243 |
+
if (onSelection) {
|
| 244 |
+
onSelection(
|
| 245 |
+
`messages[${messageId.split('--').slice(-1)[0]}].text`,
|
| 246 |
+
);
|
| 247 |
+
}
|
| 248 |
+
}}
|
| 249 |
+
>
|
| 250 |
+
{message.content.split('\n').map((line, i) => (
|
| 251 |
+
<span key={i}>
|
| 252 |
+
{line}
|
| 253 |
+
<br />
|
| 254 |
+
</span>
|
| 255 |
+
))}
|
| 256 |
+
</Balancer>
|
| 257 |
+
) : message.role === 'tool' ? (
|
| 258 |
+
//@ts-ignore
|
| 259 |
+
<ToolResponse messageId={messageId} message={message} />
|
| 260 |
+
) : (
|
| 261 |
+
<AssistantResponse
|
| 262 |
+
messageId={messageId}
|
| 263 |
+
//@ts-ignore
|
| 264 |
+
message={message}
|
| 265 |
+
onSelection={onSelection}
|
| 266 |
+
/>
|
| 267 |
+
)}
|
| 268 |
+
</div>
|
| 269 |
+
</div>
|
| 270 |
+
);
|
| 271 |
+
}
|
src/components/comments/AddCommentModal.module.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/comments/AddCommentModal.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/comments/CommentViewer.module.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/comments/CommentsViewer.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/comments/EditCommentModal.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/disabled/DisabledTab.module.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/disabled/DisabledTab.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/documents-viewer/DocumentsViewer.module.scss
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*
|
| 17 |
+
**/
|
| 18 |
+
|
| 19 |
+
@use '@carbon/react/scss/spacing' as *;
|
| 20 |
+
@use '@carbon/colors' as *;
|
| 21 |
+
|
| 22 |
+
.documentsViewer {
|
| 23 |
+
display: flex;
|
| 24 |
+
flex-direction: column;
|
| 25 |
+
align-items: center;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
.container {
|
| 29 |
+
width: 100%;
|
| 30 |
+
display: flex;
|
| 31 |
+
flex-direction: column;
|
| 32 |
+
border: solid 1px var(--cds-border-strong-01);
|
| 33 |
+
margin: 0 $spacing-04 $spacing-03;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
.toolbar {
|
| 37 |
+
display: flex;
|
| 38 |
+
column-gap: $spacing-02;
|
| 39 |
+
align-items: center;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
.document {
|
| 43 |
+
padding: $spacing-03;
|
| 44 |
+
height: 350px;
|
| 45 |
+
overflow: scroll;
|
| 46 |
+
background-color: var(--cds-background);
|
| 47 |
+
display: flex;
|
| 48 |
+
flex-direction: column;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
.document article pre {
|
| 52 |
+
padding: 1%;
|
| 53 |
+
background-color: var(--cds-layer-01);
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
.documentHeader {
|
| 57 |
+
display: flex;
|
| 58 |
+
align-items: center;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
.documentToolbar {
|
| 62 |
+
margin-left: auto;
|
| 63 |
+
align-self: flex-end;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
.disclaimers {
|
| 67 |
+
align-self: flex-start;
|
| 68 |
+
margin: $spacing-03 $spacing-05 $spacing-05;
|
| 69 |
+
display: flex;
|
| 70 |
+
flex-direction: column;
|
| 71 |
+
row-gap: $spacing-02;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
.overlapDisclaimer {
|
| 75 |
+
display: flex;
|
| 76 |
+
align-items: center;
|
| 77 |
+
font-size: 14px;
|
| 78 |
+
color: #6f6f6f;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
.legendCopiedText {
|
| 82 |
+
color: #f1c21b;
|
| 83 |
+
mix-blend-mode: hard-light;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.feedbackContainer {
|
| 87 |
+
width: 95%;
|
| 88 |
+
display: flex;
|
| 89 |
+
flex-direction: column;
|
| 90 |
+
margin: 0 $spacing-05 $spacing-03;
|
| 91 |
+
align-self: flex-start;
|
| 92 |
+
row-gap: $spacing-03;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
.feedbackMetricContainer {
|
| 96 |
+
display: flex;
|
| 97 |
+
justify-content: space-between;
|
| 98 |
+
align-items: center;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
.feedbackMetricDescription {
|
| 102 |
+
display: flex;
|
| 103 |
+
column-gap: $spacing-02;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
.feedbackMetricValues {
|
| 107 |
+
margin-left: auto;
|
| 108 |
+
align-self: flex-end;
|
| 109 |
+
}
|
src/components/documents-viewer/DocumentsViewer.tsx
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
* you may not use this file except in compliance with the License.
|
| 7 |
+
* You may obtain a copy of the License at
|
| 8 |
+
*
|
| 9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
*
|
| 11 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
* See the License for the specific language governing permissions and
|
| 15 |
+
* limitations under the License.
|
| 16 |
+
*
|
| 17 |
+
**/
|
| 18 |
+
|
| 19 |
+
'use client';
|
| 20 |
+
|
| 21 |
+
import { isEmpty } from 'lodash';
|
| 22 |
+
|
| 23 |
+
import { Button } from '@carbon/react';
|
| 24 |
+
import { ChevronLeft, ChevronRight, Link } from '@carbon/icons-react';
|
| 25 |
+
import ReactMarkdown from 'react-markdown';
|
| 26 |
+
import remarkGfm from 'remark-gfm';
|
| 27 |
+
import rehypeRaw from 'rehype-raw';
|
| 28 |
+
|
| 29 |
+
import { ToolMessageDocument } from '@/src/types';
|
| 30 |
+
|
| 31 |
+
import classes from './DocumentsViewer.module.scss';
|
| 32 |
+
|
| 33 |
+
// ===================================================================================
|
| 34 |
+
// TYPES
|
| 35 |
+
// ===================================================================================
|
| 36 |
+
interface Props {
|
| 37 |
+
id: string;
|
| 38 |
+
documents: ToolMessageDocument[];
|
| 39 |
+
documentIndex: number;
|
| 40 |
+
setDocumentIndex: Function;
|
| 41 |
+
onSelection?: Function;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
// ===================================================================================
|
| 45 |
+
// RENDER FUNCTIONS
|
| 46 |
+
// ===================================================================================
|
| 47 |
+
|
| 48 |
+
function DocumentViewer({
|
| 49 |
+
id,
|
| 50 |
+
document,
|
| 51 |
+
onSelection,
|
| 52 |
+
}: {
|
| 53 |
+
id: string;
|
| 54 |
+
document: ToolMessageDocument;
|
| 55 |
+
onSelection?: Function;
|
| 56 |
+
}) {
|
| 57 |
+
return (
|
| 58 |
+
<div className={classes.document}>
|
| 59 |
+
<div className={classes.documentHeader}>
|
| 60 |
+
<div className={classes.documentToolbar}>
|
| 61 |
+
{document.url ? (
|
| 62 |
+
<Button
|
| 63 |
+
kind="ghost"
|
| 64 |
+
renderIcon={Link}
|
| 65 |
+
iconDescription="Click to open link"
|
| 66 |
+
hasIconOnly
|
| 67 |
+
tooltipAlignment="end"
|
| 68 |
+
tooltipPosition="bottom"
|
| 69 |
+
onClick={() => {
|
| 70 |
+
window.open(document.url, '_blank');
|
| 71 |
+
}}
|
| 72 |
+
></Button>
|
| 73 |
+
) : null}
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
|
| 77 |
+
<article
|
| 78 |
+
className={classes.documentContainer}
|
| 79 |
+
onMouseDown={() => {
|
| 80 |
+
if (onSelection) {
|
| 81 |
+
const [segment, documentIdx] = id.split('__documents--');
|
| 82 |
+
onSelection(
|
| 83 |
+
`messages[${segment.split('message--').slice(-1)[0]}].documents[${documentIdx}].text`,
|
| 84 |
+
);
|
| 85 |
+
}
|
| 86 |
+
}}
|
| 87 |
+
onMouseUp={() => {
|
| 88 |
+
if (onSelection) {
|
| 89 |
+
const [segment, documentIdx] = id.split('__documents--');
|
| 90 |
+
onSelection(
|
| 91 |
+
`messages[${segment.split('message--').slice(-1)[0]}].documents[${documentIdx}].text`,
|
| 92 |
+
);
|
| 93 |
+
}
|
| 94 |
+
}}
|
| 95 |
+
>
|
| 96 |
+
<div className={classes.markdown}>
|
| 97 |
+
<ReactMarkdown
|
| 98 |
+
remarkPlugins={[remarkGfm]}
|
| 99 |
+
rehypePlugins={[rehypeRaw]}
|
| 100 |
+
>
|
| 101 |
+
{document.text}
|
| 102 |
+
</ReactMarkdown>
|
| 103 |
+
</div>
|
| 104 |
+
</article>
|
| 105 |
+
</div>
|
| 106 |
+
);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
// ===================================================================================
|
| 110 |
+
// MAIN FUNCTION
|
| 111 |
+
// ===================================================================================
|
| 112 |
+
export default function DocumentsViewer({
|
| 113 |
+
id,
|
| 114 |
+
documents,
|
| 115 |
+
documentIndex,
|
| 116 |
+
setDocumentIndex,
|
| 117 |
+
onSelection,
|
| 118 |
+
}: Props) {
|
| 119 |
+
// Step 1: Render
|
| 120 |
+
if (isEmpty(documents)) {
|
| 121 |
+
return null;
|
| 122 |
+
} else {
|
| 123 |
+
return (
|
| 124 |
+
<div className={classes.documentsViewer}>
|
| 125 |
+
{documents.length > 1 ? (
|
| 126 |
+
<div className={classes.toolbar}>
|
| 127 |
+
<Button
|
| 128 |
+
id={'document--selector-prev'}
|
| 129 |
+
kind="ghost"
|
| 130 |
+
hasIconOnly
|
| 131 |
+
renderIcon={ChevronLeft}
|
| 132 |
+
iconDescription="Previous document"
|
| 133 |
+
onClick={() => {
|
| 134 |
+
if (documentIndex > 0) {
|
| 135 |
+
setDocumentIndex(documentIndex - 1);
|
| 136 |
+
}
|
| 137 |
+
}}
|
| 138 |
+
disabled={documentIndex === 0}
|
| 139 |
+
/>
|
| 140 |
+
<span className={classes.documentIndex}>
|
| 141 |
+
{documentIndex + 1} / {documents.length}
|
| 142 |
+
</span>
|
| 143 |
+
<Button
|
| 144 |
+
id={'document--selector-next'}
|
| 145 |
+
kind="ghost"
|
| 146 |
+
hasIconOnly
|
| 147 |
+
renderIcon={ChevronRight}
|
| 148 |
+
iconDescription="Next document"
|
| 149 |
+
onClick={() => {
|
| 150 |
+
if (documentIndex < documents.length - 1) {
|
| 151 |
+
setDocumentIndex(documentIndex + 1);
|
| 152 |
+
}
|
| 153 |
+
}}
|
| 154 |
+
disabled={documentIndex === documents.length - 1}
|
| 155 |
+
/>
|
| 156 |
+
</div>
|
| 157 |
+
) : null}
|
| 158 |
+
<div className={classes.container}>
|
| 159 |
+
<DocumentViewer
|
| 160 |
+
id={`${id}--${documentIndex}`}
|
| 161 |
+
document={documents[documentIndex]}
|
| 162 |
+
onSelection={onSelection}
|
| 163 |
+
/>
|
| 164 |
+
</div>
|
| 165 |
+
</div>
|
| 166 |
+
);
|
| 167 |
+
}
|
| 168 |
+
}
|
src/components/example-tile/ExampleTile.module.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/example-tile/ExampleTile.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
@@ -24,7 +24,6 @@ import {
|
|
| 24 |
TileAboveTheFoldContent,
|
| 25 |
TileBelowTheFoldContent,
|
| 26 |
Tag,
|
| 27 |
-
Button,
|
| 28 |
DefinitionTooltip,
|
| 29 |
Toggletip,
|
| 30 |
ToggletipButton,
|
|
@@ -33,7 +32,7 @@ import {
|
|
| 33 |
UnorderedList,
|
| 34 |
ListItem,
|
| 35 |
} from '@carbon/react';
|
| 36 |
-
import { Microscope,
|
| 37 |
|
| 38 |
import { TileData } from '@/src/types';
|
| 39 |
import {
|
|
@@ -44,15 +43,13 @@ import { calculateDuration } from '@/src/utilities/time';
|
|
| 44 |
|
| 45 |
import styles from './ExampleTile.module.scss';
|
| 46 |
|
| 47 |
-
export default function
|
| 48 |
data,
|
| 49 |
disableNavigation = false,
|
| 50 |
-
disableActions = false,
|
| 51 |
expanded = true,
|
| 52 |
}: {
|
| 53 |
data: TileData;
|
| 54 |
disableNavigation?: boolean;
|
| 55 |
-
disableActions?: boolean;
|
| 56 |
expanded?: boolean;
|
| 57 |
}) {
|
| 58 |
const [
|
|
@@ -176,24 +173,6 @@ export default function ExperimentTile({
|
|
| 176 |
</div>
|
| 177 |
) : null}
|
| 178 |
</div>
|
| 179 |
-
{!disableActions && (
|
| 180 |
-
<>
|
| 181 |
-
<div className={styles.divider}></div>
|
| 182 |
-
<div className={styles.actions}>
|
| 183 |
-
<Button
|
| 184 |
-
id="download-evaluations"
|
| 185 |
-
renderIcon={Download}
|
| 186 |
-
kind={'ghost'}
|
| 187 |
-
iconDescription={'Download evaluations'}
|
| 188 |
-
tooltipAlignment={'end'}
|
| 189 |
-
tooltipPosition={'bottom'}
|
| 190 |
-
disabled
|
| 191 |
-
>
|
| 192 |
-
Download evaluations
|
| 193 |
-
</Button>
|
| 194 |
-
</div>
|
| 195 |
-
</>
|
| 196 |
-
)}
|
| 197 |
</div>
|
| 198 |
</TileBelowTheFoldContent>
|
| 199 |
</ExpandableTile>
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 24 |
TileAboveTheFoldContent,
|
| 25 |
TileBelowTheFoldContent,
|
| 26 |
Tag,
|
|
|
|
| 27 |
DefinitionTooltip,
|
| 28 |
Toggletip,
|
| 29 |
ToggletipButton,
|
|
|
|
| 32 |
UnorderedList,
|
| 33 |
ListItem,
|
| 34 |
} from '@carbon/react';
|
| 35 |
+
import { Microscope, Information } from '@carbon/icons-react';
|
| 36 |
|
| 37 |
import { TileData } from '@/src/types';
|
| 38 |
import {
|
|
|
|
| 43 |
|
| 44 |
import styles from './ExampleTile.module.scss';
|
| 45 |
|
| 46 |
+
export default function ExampleTile({
|
| 47 |
data,
|
| 48 |
disableNavigation = false,
|
|
|
|
| 49 |
expanded = true,
|
| 50 |
}: {
|
| 51 |
data: TileData;
|
| 52 |
disableNavigation?: boolean;
|
|
|
|
| 53 |
expanded?: boolean;
|
| 54 |
}) {
|
| 55 |
const [
|
|
|
|
| 173 |
</div>
|
| 174 |
) : null}
|
| 175 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
</div>
|
| 177 |
</TileBelowTheFoldContent>
|
| 178 |
</ExpandableTile>
|
src/components/example-tile/SkeletonExampleTile.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/expression-builder/ExpressionBuilder.module.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/expression-builder/ExpressionBuilder.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/filters/Filters.module.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/filters/Filters.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/filters/SkeletonFilters.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/header/Header.jsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
@@ -58,13 +58,13 @@ export default memo(function HeaderView() {
|
|
| 58 |
<HeaderGlobalBar>
|
| 59 |
<HeaderGlobalAction
|
| 60 |
aria-label={
|
| 61 |
-
theme === '
|
| 62 |
}
|
| 63 |
onClick={() => {
|
| 64 |
-
theme === '
|
| 65 |
}}
|
| 66 |
>
|
| 67 |
-
{theme === '
|
| 68 |
</HeaderGlobalAction>
|
| 69 |
<HeaderGlobalAction
|
| 70 |
aria-label="Export"
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 58 |
<HeaderGlobalBar>
|
| 59 |
<HeaderGlobalAction
|
| 60 |
aria-label={
|
| 61 |
+
theme === 'g10' ? 'Switch to dark mode' : 'Switch to light mode'
|
| 62 |
}
|
| 63 |
onClick={() => {
|
| 64 |
+
theme === 'g10' ? set('g90') : set('g10');
|
| 65 |
}}
|
| 66 |
>
|
| 67 |
+
{theme === 'g10' ? <Asleep size={20} /> : <Awake size={20} />}
|
| 68 |
</HeaderGlobalAction>
|
| 69 |
<HeaderGlobalAction
|
| 70 |
aria-label="Export"
|
src/components/header/Header.module.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/notification/Notification.module.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/notification/Notification.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/selectors/AggregatorSelector.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/selectors/MetricSelector.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/selectors/ModelSelector.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/task-tile/SkeletonTaskTile.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/task-tile/TaskTile.module.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/components/task-tile/TaskTile.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/dataloader.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
src/hooks/useBackButton.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
-
* Copyright 2023-
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
@@ -24,10 +24,13 @@ import { useEffect } from 'react';
|
|
| 24 |
*
|
| 25 |
*/
|
| 26 |
export function useBackButton(warningMessage?: string) {
|
| 27 |
-
const BACK_BUTTON_MESSAGE =
|
|
|
|
| 28 |
|
| 29 |
const onBackButtonEvent = (e) => {
|
| 30 |
-
const leaveThisPage = window.confirm(
|
|
|
|
|
|
|
| 31 |
if (leaveThisPage) {
|
| 32 |
// Let user go back
|
| 33 |
window.history.back();
|
|
@@ -44,7 +47,5 @@ export function useBackButton(warningMessage?: string) {
|
|
| 44 |
};
|
| 45 |
}, []);
|
| 46 |
|
| 47 |
-
return {
|
| 48 |
-
|
| 49 |
-
};
|
| 50 |
-
}
|
|
|
|
| 1 |
/**
|
| 2 |
*
|
| 3 |
+
* Copyright 2023-2025 InspectorRAGet Team
|
| 4 |
*
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
|
|
| 24 |
*
|
| 25 |
*/
|
| 26 |
export function useBackButton(warningMessage?: string) {
|
| 27 |
+
const BACK_BUTTON_MESSAGE =
|
| 28 |
+
'Going back will make you lose the current progress. Are you sure you want to go back?';
|
| 29 |
|
| 30 |
const onBackButtonEvent = (e) => {
|
| 31 |
+
const leaveThisPage = window.confirm(
|
| 32 |
+
warningMessage ? warningMessage : BACK_BUTTON_MESSAGE,
|
| 33 |
+
);
|
| 34 |
if (leaveThisPage) {
|
| 35 |
// Let user go back
|
| 36 |
window.history.back();
|
|
|
|
| 47 |
};
|
| 48 |
}, []);
|
| 49 |
|
| 50 |
+
return {};
|
| 51 |
+
}
|
|
|
|
|
|