-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update API endpoint URL and add new knowledge base endpoint
- Loading branch information
Showing
5 changed files
with
127 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
<script src="https://cloud.opencopilot.so/pilot.js"></script> | ||
<script> | ||
const options = { | ||
apiUrl: "https://api.opencopilot.so/backend", | ||
initialMessage: "How are the things", | ||
token: "sxl342VFYrddsvKF", | ||
defaultOpen: true, | ||
triggerSelector: "#triggerSelector", | ||
socketUrl: "https://api.opencopilot.so", | ||
headers: { | ||
// optional: you can pass your authentication tokens to the copilot or any other header you want to send with every request | ||
Authorization: "Bearer your_auth_token_goes_here", | ||
AnyKey: "AnyValue" | ||
}, | ||
queryParams :{ | ||
// optional: you can pass your query params to the copilot or any other query param you want to send with every request | ||
shanur: "is da boss (libral) (gays defnder)", | ||
AnyKey: "AnyValue", | ||
|
||
}, | ||
|
||
user:{ | ||
name:"Default User" | ||
}, | ||
containerProps:{ | ||
style:{ | ||
// optional: you can pass any style you want to the container | ||
width: "400px", | ||
height: "500px", | ||
position: "fixed", | ||
bottom: "0", | ||
right: "0", | ||
zIndex: "9999", | ||
}, | ||
className:"your class name" // if u are using tailwindcss or any className you can use the class name here | ||
} | ||
} | ||
window.addEventListener("DOMContentLoaded", ()=>initAiCoPilot(options)); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
title: "Ingest Knowledge (alpha)" | ||
api: "POST https://api.opencopilot.so/backend/knowledge/:bot_id" | ||
description: "Ingest knowledge into the copilot." | ||
--- | ||
|
||
<Warning> | ||
**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). | ||
</Warning> | ||
|
||
<Warning> | ||
**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. | ||
</Warning> | ||
|
||
|
||
# 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: | ||
- Markdown | ||
|
||
|
||
|
||
<RequestExample> | ||
|
||
```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"] | ||
}' | ||
``` | ||
</RequestExample> | ||
|
||
<ResponseExample> | ||
|
||
```json Response | ||
[ | ||
{ | ||
"message": "Knowledge has been queued for ingestion" | ||
} | ||
] | ||
``` | ||
|
||
</ResponseExample> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters