@knowlearning/agents 0.9.125 → 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 && info.browser) {
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]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowlearning/agents",
3
- "version": "0.9.125",
3
+ "version": "0.9.127",
4
4
  "description": "API for embedding applications in KnowLearning systems.",
5
5
  "main": "node.js",
6
6
  "browser": "browser.js",
@@ -1,8 +1,8 @@
1
1
  <template>
2
- <span>
3
- <span v-if="value">{{ value === null && placeholder ? placeholder : value }}</span>
4
- <span v-else>loading...</span>
5
- </span>
2
+ <slot :loading="loading" :value="value">
3
+ <span v-if="loading">loading...</span>
4
+ <span v-else>{{ value === null && placeholder ? placeholder : value }}</span>
5
+ </slot>
6
6
  </template>
7
7
 
8
8
  <script>
@@ -17,6 +17,7 @@ export default {
17
17
  },
18
18
  setup(props) {
19
19
  const value = ref(undefined)
20
+ const loading = ref(true)
20
21
  let stopWatching
21
22
  let stopWatchingAttempted = false
22
23
 
@@ -31,13 +32,14 @@ export default {
31
32
  else value.value = val
32
33
  })
33
34
  }
35
+ loading.value = false
34
36
  }
35
37
 
36
38
  watch( [() => props.id, () => props.path], startWatching, { deep: true })
37
39
  onMounted(() => startWatching())
38
40
  onBeforeUnmount(() => stopWatching && stopWatching())
39
41
 
40
- return { value }
42
+ return { loading, value }
41
43
  }
42
44
  };
43
45
  </script>