Skip to content

Commit 3bd3830

Browse files
authored
feat: sso login, demo mode & new mindmap support (#644) bump:minor
* fix: update .env.example * feat: add SSO login * fix: update flowsetting * fix: add requirement * fix: refine UI * fix: update group id-based operation * fix: improve citation logics * fix: UI enhancement * fix: user_id to string in models * fix: improve chat suggestion UI and flow * fix: improve group id handling * fix: improve chat suggestion * fix: secure download for single file * fix: file limiting in docstore * fix: improve chat suggestion logics & language conform * feat: add markmap and select text to highlight function * fix: update Dockerfile * fix: user id auto generate * fix: default user id * feat: add demo mode * fix: update flowsetting * fix: revise default params for demo * feat: sso_app alternative * feat: sso login demo * feat: demo specific customization * feat: add login using API key * fix: disable key-based login * fix: optimize duplicate upload * fix: gradio routing * fix: disable arm build for demo * fix: revise full-text search js logic * feat: add rate limit * fix: update Dockerfile with new launch script * fix: update Dockerfile * fix: update Dockerignore * fix: update ratelimit logic * fix: user_id in user management page * fix: rename conv logic * feat: update demo hint * fix: minor fix * fix: highlight on long PDF load * feat: add HF paper list * fix: update HF papers load logic * feat: fly config * fix: update fly config * fix: update paper list pull api * fix: minor update root routing * fix: minor update root routing * fix: simplify login flow & paper list UI * feat: add paper recommendation * fix: update Dockerfile * fix: update Dockerfile * fix: update default model * feat: add long context Ollama through LCOllama * feat: espose Gradio share to env * fix: revert customized changes * fix: list group at app load * fix: relocate share conv button * fix: update launch script * fix: update Docker CI * feat: add Ollama model selection at first setup * docs: update README
1 parent 3006402 commit 3bd3830

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2478
-927
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ env/
1111
README.md
1212
*.zip
1313
*.sh
14+
15+
!/launch.sh

.env.example

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# settings for OpenAI
44
OPENAI_API_BASE=https://api.openai.com/v1
55
OPENAI_API_KEY=<YOUR_OPENAI_KEY>
6-
OPENAI_CHAT_MODEL=gpt-3.5-turbo
7-
OPENAI_EMBEDDINGS_MODEL=text-embedding-ada-002
6+
OPENAI_CHAT_MODEL=gpt-4o-mini
7+
OPENAI_EMBEDDINGS_MODEL=text-embedding-3-large
88

99
# settings for Azure OpenAI
1010
AZURE_OPENAI_ENDPOINT=
@@ -17,10 +17,8 @@ AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT=text-embedding-ada-002
1717
COHERE_API_KEY=<COHERE_API_KEY>
1818

1919
# settings for local models
20-
LOCAL_MODEL=llama3.1:8b
20+
LOCAL_MODEL=qwen2.5:7b
2121
LOCAL_MODEL_EMBEDDINGS=nomic-embed-text
22-
LOCAL_EMBEDDING_MODEL_DIM = 768
23-
LOCAL_EMBEDDING_MODEL_MAX_TOKENS = 8192
2422

2523
# settings for GraphRAG
2624
GRAPHRAG_API_KEY=<YOUR_OPENAI_KEY>

.github/workflows/build-push-docker.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
target:
2929
- lite
3030
- full
31+
- ollama
3132
steps:
3233
- name: Free Disk Space (Ubuntu)
3334
uses: jlumbroso/free-disk-space@main

.github/workflows/fly-deploy.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/
2+
3+
name: Fly Deploy
4+
on:
5+
push:
6+
branches:
7+
- main
8+
jobs:
9+
deploy:
10+
name: Deploy app
11+
runs-on: ubuntu-latest
12+
concurrency: deploy-group # optional: ensure only one action runs at a time
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: superfly/flyctl-actions/setup-flyctl@master
16+
- run: flyctl deploy --remote-only
17+
env:
18+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ repos:
5757
"types-requests",
5858
"sqlmodel",
5959
"types-Markdown",
60+
"types-cachetools",
6061
types-tzlocal,
6162
]
6263
args: ["--check-untyped-defs", "--ignore-missing-imports"]

Dockerfile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ RUN bash scripts/download_pdfjs.sh $PDFJS_PREBUILT_DIR
3535

3636
# Copy contents
3737
COPY . /app
38+
COPY launch.sh /app/launch.sh
3839
COPY .env.example /app/.env
3940

4041
# Install pip packages
@@ -54,7 +55,7 @@ RUN apt-get autoremove \
5455
&& rm -rf /var/lib/apt/lists/* \
5556
&& rm -rf ~/.cache
5657

57-
CMD ["python", "app.py"]
58+
ENTRYPOINT ["sh", "/app/launch.sh"]
5859

5960
# Full version
6061
FROM lite AS full
@@ -97,7 +98,17 @@ RUN apt-get autoremove \
9798
&& rm -rf /var/lib/apt/lists/* \
9899
&& rm -rf ~/.cache
99100

100-
# Download nltk packages as required for unstructured
101-
# RUN python -c "from unstructured.nlp.tokenize import _download_nltk_packages_if_not_present; _download_nltk_packages_if_not_present()"
101+
ENTRYPOINT ["sh", "/app/launch.sh"]
102102

103-
CMD ["python", "app.py"]
103+
# Ollama-bundled version
104+
FROM full AS ollama
105+
106+
# Install ollama
107+
RUN --mount=type=ssh \
108+
--mount=type=cache,target=/root/.cache/pip \
109+
curl -fsSL https://ollama.com/install.sh | sh
110+
111+
# RUN nohup bash -c "ollama serve &" && sleep 4 && ollama pull qwen2.5:7b
112+
RUN nohup bash -c "ollama serve &" && sleep 4 && ollama pull nomic-embed-text
113+
114+
ENTRYPOINT ["sh", "/app/launch.sh"]

README.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,7 @@ documents and developers who want to build their own RAG pipeline.
9696

9797
### With Docker (recommended)
9898

99-
1. We support both `lite` & `full` version of Docker images. With `full`, the extra packages of `unstructured` will be installed as well, it can support additional file types (`.doc`, `.docx`, ...) but the cost is larger docker image size. For most users, the `lite` image should work well in most cases.
100-
101-
- To use the `lite` version.
102-
103-
```bash
104-
docker run \
105-
-e GRADIO_SERVER_NAME=0.0.0.0 \
106-
-e GRADIO_SERVER_PORT=7860 \
107-
-v ./ktem_app_data:/app/ktem_app_data \
108-
-p 7860:7860 -it --rm \
109-
ghcr.io/cinnamon/kotaemon:main-lite
110-
```
99+
1. We support both `lite` & `full` version of Docker images. With `full` version, the extra packages of `unstructured` will be installed, which can support additional file types (`.doc`, `.docx`, ...) but the cost is larger docker image size. For most users, the `lite` image should work well in most cases.
111100

112101
- To use the `full` version.
113102

@@ -124,9 +113,16 @@ documents and developers who want to build their own RAG pipeline.
124113

125114
```bash
126115
# change image name to
127-
ghcr.io/cinnamon/kotaemon:feat-ollama_docker-full
116+
docker run <...> ghcr.io/cinnamon/kotaemon:main-ollama
128117
```
129118

119+
- To use the `lite` version.
120+
121+
```bash
122+
# change image name to
123+
docker run <...> ghcr.io/cinnamon/kotaemon:main-lite
124+
```
125+
130126
2. We currently support and test two platforms: `linux/amd64` and `linux/arm64` (for newer Mac). You can specify the platform by passing `--platform` in the `docker run` command. For example:
131127

132128
```bash

app.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from theflow.settings import settings as flowsettings
44

55
KH_APP_DATA_DIR = getattr(flowsettings, "KH_APP_DATA_DIR", ".")
6+
KH_GRADIO_SHARE = getattr(flowsettings, "KH_GRADIO_SHARE", False)
67
GRADIO_TEMP_DIR = os.getenv("GRADIO_TEMP_DIR", None)
78
# override GRADIO_TEMP_DIR if it's not set
89
if GRADIO_TEMP_DIR is None:
@@ -21,4 +22,5 @@
2122
"libs/ktem/ktem/assets",
2223
GRADIO_TEMP_DIR,
2324
],
25+
share=KH_GRADIO_SHARE,
2426
)

docs/about.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ An open-source tool for chatting with your documents. Built with both end users
44
developers in mind.
55

66
[Source Code](https://github.com/Cinnamon/kotaemon) |
7-
[Live Demo](https://huggingface.co/spaces/cin-model/kotaemon-demo)
7+
[HF Space](https://huggingface.co/spaces/cin-model/kotaemon-demo)
88

9-
[User Guide](https://cinnamon.github.io/kotaemon/) |
9+
[Installation Guide](https://cinnamon.github.io/kotaemon/) |
1010
[Developer Guide](https://cinnamon.github.io/kotaemon/development/) |
1111
[Feedback](https://github.com/Cinnamon/kotaemon/issues)

docs/online_install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Installation (Online HuggingFace Space)
22

33
1. Go to [HF kotaemon_template](https://huggingface.co/spaces/cin-model/kotaemon_template).
4-
2. Use Duplicate function to create your own space.
4+
2. Use Duplicate function to create your own space. Or use this [direct link](https://huggingface.co/spaces/cin-model/kotaemon_template?duplicate=true).
55
![Duplicate space](https://raw.githubusercontent.com/Cinnamon/kotaemon/main/docs/images/duplicate_space.png)
66
![Change space params](https://raw.githubusercontent.com/Cinnamon/kotaemon/main/docs/images/change_space_params.png)
77
3. Wait for the build to complete and start up (apprx 10 mins).

0 commit comments

Comments
 (0)