@knowlearning/agents 0.9.126 → 0.9.127
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.
|
@@ -18,8 +18,8 @@ export default function browserAgent(options={}) {
|
|
|
18
18
|
|
|
19
19
|
const originalUpload = newAgent.upload
|
|
20
20
|
newAgent.upload = async info => {
|
|
21
|
-
if (info
|
|
22
|
-
const file = await selectFile()
|
|
21
|
+
if (info?.browser) {
|
|
22
|
+
const file = await selectFile(info)
|
|
23
23
|
if (!file) return
|
|
24
24
|
|
|
25
25
|
info.data = await file.arrayBuffer()
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export default async function selectFile() {
|
|
1
|
+
export default async function selectFile({ accept }) {
|
|
2
2
|
return new Promise((resolve, reject) => {
|
|
3
3
|
const input = document.createElement('input')
|
|
4
4
|
input.type = 'file'
|
|
5
|
+
input.accept = accept
|
|
5
6
|
|
|
6
7
|
input.addEventListener('change', async (event) => {
|
|
7
8
|
const file = event.target.files[0]
|