summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/components
diff options
context:
space:
mode:
authorBrendan Allan <[email protected]>2026-03-20 23:02:07 +0800
committerGitHub <[email protected]>2026-03-20 15:02:07 +0000
commitd0a57305efcf03f4fd69ca180d97ea85e6cb2f1d (patch)
treec4112592fa632f24544deab42e465b0e2c1d0ff6 /packages/app/src/components
parent27a70ad70f30faf30d159f56b394c01f9474c7a4 (diff)
downloadopencode-d0a57305efcf03f4fd69ca180d97ea85e6cb2f1d.tar.gz
opencode-d0a57305efcf03f4fd69ca180d97ea85e6cb2f1d.zip
app: file type filter on desktop + multiple files (#18403)
Diffstat (limited to 'packages/app/src/components')
-rw-r--r--packages/app/src/components/prompt-input.tsx9
-rw-r--r--packages/app/src/components/prompt-input/files.ts59
2 files changed, 10 insertions, 58 deletions
diff --git a/packages/app/src/components/prompt-input.tsx b/packages/app/src/components/prompt-input.tsx
index 55cfaa490..f3d3e135d 100644
--- a/packages/app/src/components/prompt-input.tsx
+++ b/packages/app/src/components/prompt-input.tsx
@@ -1383,11 +1383,16 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
<input
ref={fileInputRef}
type="file"
+ multiple
accept={ACCEPTED_FILE_TYPES.join(",")}
class="hidden"
onChange={(e) => {
- const file = e.currentTarget.files?.[0]
- if (file) void addAttachment(file)
+ const list = e.currentTarget.files
+ if (list) {
+ for (const file of Array.from(list)) {
+ void addAttachment(file)
+ }
+ }
e.currentTarget.value = ""
}}
/>
diff --git a/packages/app/src/components/prompt-input/files.ts b/packages/app/src/components/prompt-input/files.ts
index 594991d07..eae8af03d 100644
--- a/packages/app/src/components/prompt-input/files.ts
+++ b/packages/app/src/components/prompt-input/files.ts
@@ -1,4 +1,6 @@
-export const ACCEPTED_IMAGE_TYPES = ["image/png", "image/jpeg", "image/gif", "image/webp"]
+import { ACCEPTED_FILE_TYPES, ACCEPTED_IMAGE_TYPES } from "@/constants/file-picker"
+
+export { ACCEPTED_FILE_TYPES }
const IMAGE_MIMES = new Set(ACCEPTED_IMAGE_TYPES)
const IMAGE_EXTS = new Map([
@@ -18,61 +20,6 @@ const TEXT_MIMES = new Set([
"application/yaml",
])
-export const ACCEPTED_FILE_TYPES = [
- ...ACCEPTED_IMAGE_TYPES,
- "application/pdf",
- "text/*",
- "application/json",
- "application/ld+json",
- "application/toml",
- "application/x-toml",
- "application/x-yaml",
- "application/xml",
- "application/yaml",
- ".c",
- ".cc",
- ".cjs",
- ".conf",
- ".cpp",
- ".css",
- ".csv",
- ".cts",
- ".env",
- ".go",
- ".gql",
- ".graphql",
- ".h",
- ".hh",
- ".hpp",
- ".htm",
- ".html",
- ".ini",
- ".java",
- ".js",
- ".json",
- ".jsx",
- ".log",
- ".md",
- ".mdx",
- ".mjs",
- ".mts",
- ".py",
- ".rb",
- ".rs",
- ".sass",
- ".scss",
- ".sh",
- ".sql",
- ".toml",
- ".ts",
- ".tsx",
- ".txt",
- ".xml",
- ".yaml",
- ".yml",
- ".zsh",
-]
-
const SAMPLE = 4096
function kind(type: string) {