Skip to content

Commit 46d6977

Browse files
authored
Fix list of file import types (microsoft#402)
### Motivation and Context <!-- Thank you for your contribution to the chat-copilot repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> Semantic memory supports additional file types for import: *.docx, *.bmp, *.gif Web-application not updated to allow import of these types. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Add additional types to import on chat and documents tabs: ![image](https://github.com/microsoft/chat-copilot/assets/66376200/364fe575-b71f-4c71-8a3d-c206a6cdc8c9) ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] The PR follows the [Contribution Guidelines](https://github.com/microsoft/chat-copilot/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/chat-copilot/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone 😄
1 parent eb9472d commit 46d6977

4 files changed

Lines changed: 5 additions & 3 deletions

File tree

webapp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Option 2: Using [mkcert](https://github.com/FiloSottile/mkcert#installation)
118118
## Authentication
119119
120120
This sample uses the Microsoft Authentication Library (MSAL) for React to authenticate users.
121-
Learn more about it here: https://learn.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-react.
121+
Learn more about it here: https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-single-page-app-react-sign-in.
122122
123123
## Debug the web app
124124

webapp/src/Constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const Constants = {
55
name: 'Copilot',
66
updateCheckIntervalSeconds: 60 * 5,
77
CONNECTION_ALERT_ID: 'connection-alert',
8+
importTypes: '.txt,.pdf,.docx,.md,.jpg,.jpeg,.png,.tif,.tiff,.bmp,.gif',
89
},
910
msal: {
1011
method: 'redirect', // 'redirect' | 'popup'

webapp/src/components/chat/ChatInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export const ChatInput: React.FC<ChatInputProps> = ({ isDraggingOver, onDragLeav
224224
type="file"
225225
ref={documentFileRef}
226226
style={{ display: 'none' }}
227-
accept=".txt,.pdf,.md,.jpg,.jpeg,.png,.tif,.tiff"
227+
accept={Constants.app.importTypes}
228228
multiple={true}
229229
onChange={() => {
230230
void fileHandler.handleImport(selectedId, documentFileRef);

webapp/src/components/chat/tabs/DocumentsTab.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import * as React from 'react';
3535
import { useRef } from 'react';
3636
import { useChat, useFile } from '../../../libs/hooks';
3737
import { ChatMemorySource } from '../../../libs/models/ChatMemorySource';
38+
import { Constants } from '../../../Constants';
3839
import { useAppSelector } from '../../../redux/app/hooks';
3940
import { RootState } from '../../../redux/app/store';
4041
import { timestampToDateString } from '../../utils/TextUtils';
@@ -131,7 +132,7 @@ export const DocumentsTab: React.FC = () => {
131132
type="file"
132133
ref={documentFileRef}
133134
style={{ display: 'none' }}
134-
accept=".txt,.pdf,.md,.jpg,.jpeg,.png,.tif,.tiff"
135+
accept={Constants.app.importTypes}
135136
multiple={true}
136137
onChange={() => {
137138
void fileHandler.handleImport(selectedId, documentFileRef);

0 commit comments

Comments
 (0)