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

Help uploading rst docs #3

Open
@konsumer

Description

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions