xrcopilot.client.public.js v1.0.6
XRCopilotClient.js Documentation
Overview
XRCopilotClient
is a JavaScript class designed to interact with the XRCopilot API. It provides various asynchronous methods to perform operations such as chatting, speech synthesis, data retrieval, file management, and indexing.
Class: XRCopilotClient
Constructor
constructor(apiKey, development)
- apiKey: The API key for authentication.
- development: A boolean indicating if the development version of the API should be used.
Methods
chatAsync(prompt)
Sends a chat prompt to the assistant.
- prompt: The chat prompt to send.
- Returns: A promise that resolves to the assistant's response.
speechAsync(request)
Sends a speech request to the assistant.
- request: The speech request data.
- Returns: A promise that resolves to the speech response containing voice data.
getWelcomeMessageAsync(language)
Retrieves a welcome message in the specified language.
- language: The language code for the welcome message.
- Returns: A promise that resolves to the welcome message.
hasDataAsync(resourceId)
Checks if data exists for the specified resource ID.
- resourceId: The resource ID to check.
- Returns: A promise that resolves to a boolean indicating if data exists.
hasAiAsync(resourceId)
Checks if AI is available for the specified resource ID.
- resourceId: The resource ID to check.
- Returns: A promise that resolves to a boolean indicating if AI is available.
getFrameBasicDataAsync(resourceId, targetName)
Retrieves basic frame data for the specified resource ID and target name.
- resourceId: The resource ID.
- targetName: The target name.
- Returns: A promise that resolves to the frame data.
switchAiAssistantAsync(companyId, resourceId, options)
Switches the AI assistant for the specified company and resource ID.
- companyId: The company ID.
- resourceId: The resource ID.
- options: The options for switching the AI assistant.
- Returns: A promise that resolves to a boolean indicating success.
saveSystemDataAsync(systemData)
Saves system configuration data.
- systemData: The system data to save.
- Returns: A promise that resolves to the saved data.
getSystemDataAsync(resourceId)
Retrieves system configuration data for the specified resource ID.
- resourceId: The resource ID.
- Returns: A promise that resolves to the system data.
uploadFileAsync(resourceId, fileName, fileStream)
Uploads a file to the storage.
- resourceId: The resource ID.
- fileName: The name of the file.
- fileStream: The file stream to upload.
- Returns: A promise that resolves to the response data.
listFilesAsync(resourceId)
Lists files in the storage for the specified resource ID.
- resourceId: The resource ID.
- Returns: A promise that resolves to the list of files.
getFileAsync(resourceId, fileName)
Retrieves a file from the storage.
- resourceId: The resource ID.
- fileName: The name of the file.
- Returns: A promise that resolves to the file stream.
getFileUriAsync(resourceId, fileName)
Retrieves the URI of a file in the storage.
- resourceId: The resource ID.
- fileName: The name of the file.
- Returns: A promise that resolves to the file URI.
deleteFileAsync(resourceId, fileName)
Deletes a file from the storage.
- resourceId: The resource ID.
- fileName: The name of the file.
- Returns: A promise that resolves to a boolean indicating success.
deleteAllAsync(resourceId)
Deletes all files for the specified resource ID.
- resourceId: The resource ID.
- Returns: A promise that resolves to a boolean indicating success.
performIndexingAsync(companyId, resourceId, options)
Performs indexing for the specified company and resource ID.
- companyId: The company ID.
- resourceId: The resource ID.
- options: The options for indexing.
- Returns: A promise that resolves to a boolean indicating success.
deleteIndexAsync(companyId, resourceId)
Deletes the index for the specified company and resource ID.
- companyId: The company ID.
- resourceId: The resource ID.
- Returns: A promise that resolves to a boolean indicating success.