Chatkit invalid upload file types

I’m embedding Chatkit into one of my projects. After managing to get the chat working, enabling file uploads at session creation and in the Chatkit config I’m getting bad request errors when uploading XLSX and CSVs.

Other users reported the same issue at the bottom of this thread: How to enable File Uploads in Chatkit?
I’m reopening here because that one started with a different question and it’s now marked as solved.

For context my backend session creation code is the following

const chatSession = await this.openai.beta.chatkit.sessions.create({
  user: user.id,
  chatkit_configuration: { file_upload: { enabled: true } },
  workflow: {
    id: chatkitConfig.workflowId,
    version: chatkitConfig.workflowVersion,
    state_variables: {
      user_id: user.id,
      user_name: user.name,
      user_role: user.role,
    },
  },
});

Chatkit config

chatkit.setOptions({
  api: {
    getClientSecret: async (currentClientSecret: string | null) => {
      const session = await this.assistantService.getAssistantSession(currentClientSecret === null);
      return session.client_secret;
    },
  },
  locale: 'es',
  theme: 'dark',
  composer: {
    attachments: {
      enabled: true,
    },
  },
});

Upload error when loading a CSV file (Browser console)

{
    "message": "Uploaded file type is not allowed for this session.",
    "type": "invalid_request_error",
    "param": null,
    "code": "chatkit.file_upload_type_rejected"
}

Capture of the error (UI)

The version of the backend OpenAI API Node library is 6.7.0 (latest as of now).

I’m using the webcomponent version for the frontend since I’m embedding this into an Angular project.

The same CSV file can be added to the demo ChatKit Studio as well as the agent builder Preview with no issues.

I would appreciate any feedback on this if because this is a really cool product and I would love to get it working. Thanks.

1 Like