diff --git a/copilot-widget/lib/contexts/index.html b/copilot-widget/lib/contexts/index.html new file mode 100644 index 000000000..ace92cdf8 --- /dev/null +++ b/copilot-widget/lib/contexts/index.html @@ -0,0 +1,40 @@ + + + diff --git a/docs/api-reference/endpoint/get.mdx b/docs/api-reference/endpoint/get.mdx index 6bb41349a..f6b3ae7c5 100644 --- a/docs/api-reference/endpoint/get.mdx +++ b/docs/api-reference/endpoint/get.mdx @@ -1,6 +1,6 @@ --- title: "Get All Copilots" -api: "GET https://cloud.opencopilot.so/backend/copilot" +api: "GET https://api.opencopilot.so/backend/copilot" description: "Get a list of all copilots in the database." --- diff --git a/docs/api-reference/endpoint/ingest-knowldge.mdx b/docs/api-reference/endpoint/ingest-knowldge.mdx new file mode 100644 index 000000000..0f929bdb8 --- /dev/null +++ b/docs/api-reference/endpoint/ingest-knowldge.mdx @@ -0,0 +1,48 @@ +--- +title: "Ingest Knowledge (alpha)" +api: "POST https://api.opencopilot.so/backend/knowledge/:bot_id" +description: "Ingest knowledge into the copilot." +--- + + +**Important**: This endpoint is in alpha and may change in the future. please report any issues or feedback to the [issue tracker](https://github.com/openchatai/OpenCopilot/issues/new/choose). + + + +**Important**: this endpoint only supports URLs, if you have a local file that you want to ingest, you can upload it to a cloud storage service and provide the URL to the file. + + + +# Ingest Knowledge +Knowledge is any information that the copilot can use to answer questions. as for now, the copilot can ingest knowledge in the following formats: + +- Website: when you provide a URL, the copilot will scrape the content of the website recursively and ingest the content into its knowledge base, you can also provide a list of URLs to scrape. +- Files: you can provide a list of files to ingest, the copilot will ingest the content of the files into its knowledge base, currently, the copilot supports the following file types: + - PDF + - Markdown + + + + + +```bash Example Request +curl --location 'http://localhost:8888/backend/knowldgebase/:bot_id' \ + --header 'Authorization: Bearer TOKEN' \ + --header 'Content-Type: application/json' \ + --data '{ + "sources": ["https://en.wikipedia.org/wiki/Huffman_coding", "https://example.com/file.pdf"] + }' +``` + + + + +```json Response +[ + { + "message": "Knowledge has been queued for ingestion" + } +] +``` + + diff --git a/docs/api-reference/endpoint/stages:.yml b/docs/api-reference/endpoint/stages:.yml new file mode 100644 index 000000000..f4c89e2e8 --- /dev/null +++ b/docs/api-reference/endpoint/stages:.yml @@ -0,0 +1,26 @@ +stages: + - deploy + +update-copilot-actions: + stage: deploy + when: manual + script: + - > + echo "Updating Copilot actions..." + + # Delete all actions from Copilot using environment variables for ID and token + curl -f --location --request DELETE "https://api.opencopilot.so/backend/actions/bot/$COPILOT_ID" \ + --header 'Accept: application/json' \ + --header "Authorization: Bearer $AUTH_TOKEN" + + # Wait a bit for the delete action to propagate + sleep 5 + + # Import actions from the updated Swagger file using environment variables + curl -f --location --request PUT "https://api.opencopilot.so/backend/actions/bot/$COPILOT_ID/import-from-swagger" \ + --header 'Accept: application/json' \ + --header "Authorization: Bearer $AUTH_TOKEN" \ + --form 'file=@"./swagger.json"' + + echo "Copilot actions updated." + image: curlimages/curl:latest # Use an image with curl installed diff --git a/docs/mint.json b/docs/mint.json index 6893bdf4d..9634ac772 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -58,11 +58,22 @@ "pages": [ "api-notes", "api-reference/endpoint/get", - "api-reference/endpoint/delete", + "api-reference/endpoint/delete" + ] + }, + { + "group": "Actions", + "pages": [ "api-reference/endpoint/delete-all-actions", "api-reference/endpoint/import-actions-from-swagger" ] }, + { + "group": "Knowledge Base", + "pages": [ + "api-reference/endpoint/ingest-knowldge" + ] + }, { "group": "Chat API", "pages": [