OPEA Chat History microservice is based on a MongoDB database and is designed to allow users to stor
2.9K
This README provides setup guides and all the necessary information about the Chat History microservice with MongoDB database.
export http_proxy=${your_http_proxy}
export https_proxy=${your_http_proxy}
export MONGO_HOST=${MONGO_HOST}
export MONGO_PORT=27017
export DB_NAME=${DB_NAME}
export COLLECTION_NAME=${COLLECTION_NAME}
cd ../../../../
docker build -t opea/chathistory-mongo:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/chathistory/src/Dockerfile .
Run MongoDB image container
docker run -d -p 27017:27017 --name=mongo mongo:latest
Run the Chat History microservice
docker run -d --name="chathistory-mongo" -p 6012:6012 -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e MONGO_HOST=${MONGO_HOST} -e MONGO_PORT=${MONGO_PORT} -e DB_NAME=${DB_NAME} -e COLLECTION_NAME=${COLLECTION_NAME} opea/chathistory-mongo:latest
docker compose -f ../deployment/docker_compose/compose.yaml up -d
The Chat History microservice exposes the following API endpoints:
Create new chat conversation
curl -X 'POST' \
http://${host_ip}:6012/v1/chathistory/create \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"data": {
"messages": "test Messages", "user": "test"
}
}'
Get all the Conversations for a user
curl -X 'POST' \
http://${host_ip}:6012/v1/chathistory/get \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"user": "test"}'
Get a specific conversation by id.
curl -X 'POST' \
http://${host_ip}:6012/v1/chathistory/get \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"user": "test", "id":"668620173180b591e1e0cd74"}'
Update the conversation by id.
curl -X 'POST' \
http://${host_ip}:6012/v1/chathistory/create \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"data": {
"messages": "test Messages Update", "user": "test"
},
"id":"668620173180b591e1e0cd74"
}'
Delete a stored conversation.
curl -X 'POST' \
http://${host_ip}:6012/v1/chathistory/delete \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"user": "test", "id":"668620173180b591e1e0cd74"}'
Content type
Image
Digest
sha256:976dddaf0…
Size
269.4 MB
Last updated
about 1 year ago
docker pull opea/chathistory-mongo