-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4ee6d90
Showing
269 changed files
with
26,169 additions
and
0 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,4 @@ | ||
.env | ||
.env.local | ||
node_modules | ||
test-results |
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,8 @@ | ||
# Caduceus | ||
DEFAULT_MODEL=gpt-4o-mini | ||
NEXT_PUBLIC_DEFAULT_SYSTEM_PROMPT=You are Caduceus, a healthcare chatBot, built on top of ChatGPT, a Large Language model trained by OpenAI. Doctors and clinicians use you to generate text for patients. They edit your responses. Follow the user's instructions carefully. Respond using markdown. | ||
OPENAI_API_KEY=YOUR_KEY | ||
|
||
GOOGLE_API_KEY=YOUR_API_KEY | ||
GOOGLE_CSE_ID=YOUR_ENGINE_ID |
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,3 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
} |
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,69 @@ | ||
name: Docker | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
|
||
env: | ||
# Use docker.io for Docker Hub if empty | ||
REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio when running outside of PRs. | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2.1.0 | ||
|
||
# Workaround: https://github.com/docker/build-push-action/issues/461 | ||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a | ||
with: | ||
context: . | ||
platforms: "linux/amd64,linux/arm64" | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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,24 @@ | ||
name: Run Unit Tests | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: node:16 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run Vitest Suite | ||
run: npm test |
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 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
/test-results | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
/dist | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
.idea | ||
pnpm-lock.yaml |
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,45 @@ | ||
# Contributing Guidelines | ||
|
||
**Welcome to Caduceus!** | ||
|
||
We appreciate your interest in contributing to our project. | ||
|
||
Before you get started, please read our guidelines for contributing. | ||
|
||
## Types of Contributions | ||
|
||
We welcome the following types of contributions: | ||
|
||
- Bug fixes | ||
- New features | ||
- Documentation improvements | ||
- Code optimizations | ||
- Translations | ||
- Tests | ||
|
||
## Getting Started | ||
|
||
To get started, fork the project on GitHub and clone it locally on your machine. Then, create a new branch to work on your changes. | ||
|
||
``` | ||
git clone https://caduc.eus.git | ||
cd chatbot-ui | ||
git checkout -b my-branch-name | ||
``` | ||
|
||
Before submitting your pull request, please make sure your changes pass our automated tests and adhere to our code style guidelines. | ||
|
||
## Pull Request Process | ||
|
||
1. Fork the project on GitHub. | ||
2. Clone your forked repository locally on your machine. | ||
3. Create a new branch from the main branch. | ||
4. Make your changes on the new branch. | ||
5. Ensure that your changes adhere to our code style guidelines and pass our automated tests. | ||
6. Commit your changes and push them to your forked repository. | ||
7. Submit a pull request to the main branch of the main repository. | ||
|
||
## Contact | ||
|
||
If you have any questions or need help getting started, feel free to reach out to me on [Twitter](https://twitter.com/mckaywrigley). |
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,29 @@ | ||
# ---- Base Node ---- | ||
FROM node:19-alpine AS base | ||
WORKDIR /app | ||
COPY package*.json ./ | ||
|
||
# ---- Dependencies ---- | ||
FROM base AS dependencies | ||
RUN npm ci | ||
|
||
# ---- Build ---- | ||
FROM dependencies AS build | ||
COPY . . | ||
RUN npm run build | ||
|
||
# ---- Production ---- | ||
FROM node:19-alpine AS production | ||
WORKDIR /app | ||
COPY --from=dependencies /app/node_modules ./node_modules | ||
COPY --from=build /app/.next ./.next | ||
COPY --from=build /app/public ./public | ||
COPY --from=build /app/package*.json ./ | ||
COPY --from=build /app/next.config.js ./next.config.js | ||
COPY --from=build /app/next-i18next.config.js ./next-i18next.config.js | ||
|
||
# Expose the port the app will run on | ||
EXPOSE 3000 | ||
|
||
# Start the application | ||
CMD ["npm", "start"] |
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,18 @@ | ||
include .env | ||
|
||
.PHONY: all | ||
|
||
build: | ||
docker build -t chatbot-ui . | ||
|
||
run: | ||
export $(cat .env | xargs) | ||
docker stop chatbot-ui || true && docker rm chatbot-ui || true | ||
docker run --name chatbot-ui --rm -e OPENAI_API_KEY=${OPENAI_API_KEY} -p 3000:3000 chatbot-ui | ||
|
||
logs: | ||
docker logs -f chatbot-ui | ||
|
||
push: | ||
docker tag chatbot-ui:latest ${DOCKER_USER}/chatbot-ui:${DOCKER_TAG} | ||
docker push ${DOCKER_USER}/chatbot-ui:${DOCKER_TAG} |
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,104 @@ | ||
# Caduceus, Open Healthcare AI Scribe | ||
|
||
|
||
Caduceus can transcribe entire office visits in real-time using voice dictation, automatically converting spoken word into structured medical documentation. | ||
|
||
See the current version [here](https://app.caduc.eus/). | ||
|
||
The platform comes with pre-built templates for common healthcare workflows like progress notes, patient communications, and procedure pre-authorizations. You can see a live demo at app.caduc.eus to experience how it streamlines medical documentation. | ||
|
||
Based on [Chatbot UI](https://github.com/mckaywrigley/chatbot-ui). This repo has many updates to the Next.js and React code, so you can similarly use it as a starting point for your own project. | ||
|
||
|
||
## Updates | ||
|
||
I continue work on this project in my spare time, especially while I'm in Egypt and Honduras where the physicians I work with mainly are using it. If you'd like to contribute or have feature requests, please reach out. | ||
|
||
|
||
|
||
## Deploy | ||
|
||
**Vercel** | ||
|
||
Host your own live version of Caduceus with Vercel. | ||
|
||
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fmckaywrigley%2Fchatbot-ui) | ||
|
||
**Docker** | ||
|
||
Build locally: | ||
|
||
```shell | ||
docker build -t chatgpt-ui . | ||
docker run -e OPENAI_API_KEY=xxxxxxxx -p 3000:3000 chatgpt-ui | ||
``` | ||
|
||
Pull from ghcr: | ||
|
||
``` | ||
docker run -e OPENAI_API_KEY=xxxxxxxx -p 3000:3000 ghcr.io/mckaywrigley/chatbot-ui:main | ||
``` | ||
|
||
## Running Locally | ||
|
||
**1. Clone Repo** | ||
|
||
```bash | ||
git clone https://caduc.eus.git | ||
``` | ||
|
||
**2. Install Dependencies** | ||
|
||
```bash | ||
npm i | ||
``` | ||
|
||
**3. Provide OpenAI API Key** | ||
|
||
Create a .env.local file in the root of the repo with your OpenAI API Key: | ||
|
||
```bash | ||
OPENAI_API_KEY=YOUR_KEY | ||
``` | ||
|
||
> You can set `OPENAI_API_HOST` where access to the official OpenAI host is restricted or unavailable, allowing users to configure an alternative host for their specific needs. | ||
> Additionally, if you have multiple OpenAI Organizations, you can set `OPENAI_ORGANIZATION` to specify one. | ||
**4. Run App** | ||
|
||
```bash | ||
npm run dev | ||
``` | ||
|
||
**5. Use It** | ||
|
||
You should be able to start chatting. | ||
|
||
## Configuration | ||
|
||
When deploying the application, the following environment variables can be set: | ||
|
||
| Environment Variable | Default value | Description | | ||
| --------------------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | | ||
| OPENAI_API_KEY | | The default API key used for authentication with OpenAI | | ||
| OPENAI_API_HOST | `https://api.openai.com` | The base url, for Azure use `https://<endpoint>.openai.azure.com` | | ||
| OPENAI_API_TYPE | `openai` | The API type, options are `openai` or `azure` | | ||
| OPENAI_API_VERSION | `2023-03-15-preview` | Only applicable for Azure OpenAI | | ||
| AZURE_DEPLOYMENT_ID | | Needed when Azure OpenAI, Ref [Azure OpenAI API](https://learn.microsoft.com/zh-cn/azure/cognitive-services/openai/reference#completions) | | ||
| OPENAI_ORGANIZATION | | Your OpenAI organization ID | | ||
| DEFAULT_MODEL | `gpt-3.5-turbo` | The default model to use on new conversations, for Azure use `gpt-35-turbo` | | ||
| NEXT_PUBLIC_DEFAULT_SYSTEM_PROMPT | [see here](utils/app/const.ts) | The default system prompt to use on new conversations | | ||
| NEXT_PUBLIC_DEFAULT_TEMPERATURE | 1 | The default temperature to use on new conversations | | ||
| GOOGLE_API_KEY | | See [Custom Search JSON API documentation][GCSE] | | ||
| GOOGLE_CSE_ID | | See [Custom Search JSON API documentation][GCSE] | | ||
|
||
If you do not provide an OpenAI API key with `OPENAI_API_KEY`, users will have to provide their own key. | ||
|
||
If you don't have an OpenAI API key, you can get one [here](https://platform.openai.com/account/api-keys). | ||
|
||
## Contact | ||
|
||
If you have any questions, feel free to reach out to Mckay on [Twitter](https://twitter.com/mckaywrigley). | ||
|
||
[GCSE]: https://developers.google.com/custom-search/v1/overview |
Oops, something went wrong.