Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/screenshots/camera-menu-mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions web/components/chat/home/ChatComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
memo,
useCallback,
useEffect,
useId,
useLayoutEffect,
useMemo,
useRef,
Expand Down Expand Up @@ -543,6 +544,7 @@ export default memo(function ChatComposer({
const restoreFocusOnReturnRef = useRef(false);
const inputHandleRef = useRef<ComposerInputHandle>(null);
const fileInputRef = useRef<HTMLInputElement>(null);
const cameraInputId = useId();
const draftAttachmentsRef = useRef(attachments);
const addDraftFilesRef = useRef(onAddFiles);
useEffect(() => {
Expand Down Expand Up @@ -1431,6 +1433,16 @@ export default memo(function ChatComposer({
aria-hidden="true"
tabIndex={-1}
/>
<input
id={cameraInputId}
type="file"
accept="image/*"
capture="environment"
onChange={handleFileInputChange}
className="hidden"
aria-hidden="true"
tabIndex={-1}
/>

{inputHeader}
{composerAnswers.length > 0 ? (
Expand Down Expand Up @@ -1559,6 +1571,7 @@ export default memo(function ChatComposer({
panelRef={spaceMenuRef}
materials={(query) => (
<ChatSpaceMenu
cameraInputId={cameraInputId}
variant="resources"
query={query}
selectedCounts={spaceSelectionCounts}
Expand Down
21 changes: 21 additions & 0 deletions web/components/chat/space/ChatSpaceMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
BookMarked,
BookOpen,
Bot,
Camera,
ChevronRight,
Database,
Paperclip,
Expand Down Expand Up @@ -56,6 +57,8 @@ interface ChatSpaceMenuProps {
agentsAvailable?: boolean;
/** Show imported Reading materials on surfaces that wire its picker. */
readingAvailable?: boolean;
/** DOM id of the camera file input rendered by the composer. */
cameraInputId?: string;
onSelectItem: (key: SelectableSpaceKey) => void;
}

Expand Down Expand Up @@ -110,6 +113,7 @@ export default memo(function ChatSpaceMenu({
personaAvailable = true,
agentsAvailable = true,
readingAvailable = false,
cameraInputId,
onSelectItem,
}: ChatSpaceMenuProps) {
const { t } = useTranslation();
Expand Down Expand Up @@ -254,6 +258,23 @@ export default memo(function ChatSpaceMenu({
: "space-y-1"
}
>
{variant === "resources" && cameraInputId && (
<label
htmlFor={cameraInputId}
className="md:hidden col-span-2 flex w-full items-center gap-2.5 px-3 py-2 text-left text-[12px] hover:bg-[var(--muted)]/40"
>
<Camera
size={15}
strokeWidth={1.7}
className="shrink-0 text-[var(--muted-foreground)]"
/>
<span className="min-w-0 flex-1">
<span className="block truncate font-medium text-[var(--foreground)]">
{t("Take photo")}
</span>
</span>
</label>
)}
{items.map(({ key, label, description, icon: Icon }, idx) => {
const count = countFor(key as SelectableSpaceKey, selectedCounts);
const isActive = isMention && idx === activeIdx;
Expand Down
1 change: 1 addition & 0 deletions web/locales/de/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"Attachment processing": "Anhang wird verarbeitet",
"Attach": "Anhängen",
"Attach files": "Dateien anhängen",
"Take photo": "Foto aufnehmen",
"Uploaded to DeepTutor": "Zu DeepTutor hochgeladen",
"Sending to DeepTutor": "Wird an DeepTutor gesendet",
"Sending to document parser": "Wird an den Dokumenten-Parser gesendet",
Expand Down
1 change: 1 addition & 0 deletions web/locales/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
"Attachment processing": "Attachment processing",
"Attach": "Attach",
"Attach files": "Attach files",
"Take photo": "Take photo",
"Uploaded to DeepTutor": "Uploaded to DeepTutor",
"Sending to DeepTutor": "Sending to DeepTutor",
"Sending to document parser": "Sending to document parser",
Expand Down
1 change: 1 addition & 0 deletions web/locales/fr/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"Attachment": "Pièce jointe",
"Attach": "Joindre",
"Attach files": "Joindre des fichiers",
"Take photo": "Prendre une photo",
"Smart Solver": "Résolveur intelligent",
"Vision Solver": "Résolveur visuel",
"Elements": "Éléments",
Expand Down
1 change: 1 addition & 0 deletions web/locales/hu/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"Attachment processing": "Melléklet feldolgozása",
"Attach": "Csatolás",
"Attach files": "Fájlok csatolása",
"Take photo": "Fénykép készítése",
"Uploaded to DeepTutor": "Feltöltve a DeepTutorba",
"Sending to DeepTutor": "Küldés a DeepTutorba",
"Sending to document parser": "Küldés a dokumentumfeldolgozónak",
Expand Down
1 change: 1 addition & 0 deletions web/locales/it/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
"Attachment processing": "Elaborazione degli allegati",
"Attach": "Allega",
"Attach files": "Allega file",
"Take photo": "Scatta foto",
"Uploaded to DeepTutor": "Caricato su DeepTutor",
"Sending to DeepTutor": "Invio a DeepTutor",
"Sending to document parser": "Invio al parser del documento",
Expand Down
1 change: 1 addition & 0 deletions web/locales/ja/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"Attachment processing": "添付ファイルを処理中",
"Attach": "添付",
"Attach files": "ファイルを添付",
"Take photo": "写真を撮る",
"Uploaded to DeepTutor": "DeepTutor にアップロードしました",
"Sending to DeepTutor": "DeepTutor に送信中",
"Sending to document parser": "ドキュメントパーサーに送信中",
Expand Down
1 change: 1 addition & 0 deletions web/locales/ko/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"Attachment processing": "첨부 파일 처리",
"Attach": "첨부",
"Attach files": "파일 첨부",
"Take photo": "사진 찍기",
"Uploaded to DeepTutor": "DeepTutor에 업로드했습니다",
"Sending to DeepTutor": "DeepTutor로 전송 중",
"Sending to document parser": "문서 분석기로 전송 중",
Expand Down
1 change: 1 addition & 0 deletions web/locales/pl/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"Attachment processing": "Przetwarzanie załącznika",
"Attach": "Dołącz",
"Attach files": "Dołącz pliki",
"Take photo": "Zrób zdjęcie",
"Uploaded to DeepTutor": "Przesłano do DeepTutor",
"Sending to DeepTutor": "Wysyłanie do DeepTutor",
"Sending to document parser": "Wysyłanie do analizatora dokumentów",
Expand Down
1 change: 1 addition & 0 deletions web/locales/pt/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"Attachment processing": "Processamento de anexo",
"Attach": "Anexar",
"Attach files": "Anexar arquivos",
"Take photo": "Tirar foto",
"Uploaded to DeepTutor": "Enviado ao DeepTutor",
"Sending to DeepTutor": "Enviando ao DeepTutor",
"Sending to document parser": "Enviando ao processador de documentos",
Expand Down
1 change: 1 addition & 0 deletions web/locales/tr/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"Attachment processing": "Ek işleniyor",
"Attach": "Ekle",
"Attach files": "Dosya ekle",
"Take photo": "Fotoğraf çek",
"Uploaded to DeepTutor": "DeepTutor'a yüklendi",
"Sending to DeepTutor": "DeepTutor'a gönderiliyor",
"Sending to document parser": "Belge ayrıştırıcıya gönderiliyor",
Expand Down
1 change: 1 addition & 0 deletions web/locales/uk/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"Attachment": "Вкладення",
"Attach": "Прикріпити",
"Attach files": "Прикріпити файли",
"Take photo": "Зробити фото",
"Smart Solver": "Smart Solver",
"Vision Solver": "Vision Solver",
"Elements": "Елементи",
Expand Down
1 change: 1 addition & 0 deletions web/locales/vi/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"Attachment processing": "Đang xử lý tệp đính kèm",
"Attach": "Đính kèm",
"Attach files": "Đính kèm tệp",
"Take photo": "Chụp ảnh",
"Uploaded to DeepTutor": "Đã tải lên DeepTutor",
"Sending to DeepTutor": "Đang gửi đến DeepTutor",
"Sending to document parser": "Đang gửi đến trình phân tích tài liệu",
Expand Down
1 change: 1 addition & 0 deletions web/locales/zh-tw/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
"Attachment processing": "附件處理中",
"Attach": "附件",
"Attach files": "上傳附件",
"Take photo": "拍照",
"Uploaded to DeepTutor": "已上傳到 DeepTutor",
"Sending to DeepTutor": "正在傳送到 DeepTutor",
"Sending to document parser": "正在提交到文件解析器",
Expand Down
1 change: 1 addition & 0 deletions web/locales/zh/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
"Attachment processing": "附件处理中",
"Attach": "附件",
"Attach files": "上传附件",
"Take photo": "拍照",
"Uploaded to DeepTutor": "已上传到 DeepTutor",
"Sending to DeepTutor": "正在发送到 DeepTutor",
"Sending to document parser": "正在提交到文档解析器",
Expand Down
Loading