Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Help uploading rst docs #3

Open
konsumer opened this issue May 18, 2024 · 0 comments
Open

Help uploading rst docs #3

konsumer opened this issue May 18, 2024 · 0 comments

Comments

@konsumer
Copy link

konsumer commented May 18, 2024

Pardon me if this is not be the place to ask, but I am having trouble ingesting the godot docs (rst text format.)

Here is my code:

import { glob } from 'glob'
import r from 'r2r-js'

const { R2RClient } = r

const baseUrl = 'http://localhost:8000';
const client = new R2RClient(baseUrl)

for (const f of await glob('data/**/*.rst')) {
  const tags = f.split('/')
  tags.shift()
  tags.unshift('godot')
  const fname = tags.pop()
  tags.push(fname.split('.')[0])
  try {
    const uploadResponse = await client.uploadAndProcessFile(tags.join('/'), f, {tags})
    console.log('Upload response:', uploadResponse)
  } catch(e) {
    console.error(e.response.data.detail)
  }
}

I get a ton of error Invalid file type. Allowed types are: txt, json, html, pdf.

How do I tell it that it's a txt document?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant