Skip to content

Commit

Permalink
fix docker entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
vemonet committed Jan 10, 2024
1 parent 747ee97 commit 5702b0d
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 23 deletions.
21 changes: 20 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
shm_size: '16g'
# ports:
# - 8000:8000
# entrypoint: uvicorn scripts.main:app --reload
entrypoint: uvicorn scripts.main:app
deploy: # Enable GPU in the container
resources:
reservations:
Expand All @@ -40,6 +40,25 @@ services:
networks:
- nginx


# qdrant:
# # https://hub.docker.com/r/qdrant/qdrant/tags
# image: qdrant/qdrant:v1.5.1
# restart: unless-stopped
# volumes:
# - ./data/vectorstore/qdrant:/qdrant/storage
# - ./scripts/qdrant_config.yml:/qdrant/config/production.yaml
# environment:
# - QDRANT_ALLOW_RECOVERY_MODE=true
# - VIRTUAL_HOST=qdrant.137.120.31.148.nip.io
# - LETSENCRYPT_HOST=qdrant.137.120.31.148.nip.io
# - VIRTUAL_PORT=6333
# # ports:
# # - 6333:6333
# # command:
# # - ./qdrant --config-path /qdrant/qdrant_config.yml


# Also required to deploy containers publicly
networks:
nginx:
Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@nanostores/solid": "^0.4.2",
"astro": "^4.1.1",
"daisyui": "^4.5.0",
"dompurify": "^3.0.8",
"marked": "^11.1.1",
"nanostores": "^0.9.5",
"solid-js": "^1.8.9",
Expand Down
7 changes: 7 additions & 0 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions frontend/public/favicon.svg

This file was deleted.

Binary file added frontend/public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 11 additions & 12 deletions frontend/src/components/chat.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/* eslint-disable solid/no-innerhtml */
import { createSignal, For } from 'solid-js';
import {marked} from 'marked';
import {useStore} from '@nanostores/solid'
import {$chatConfig, apiUrl} from '../components/nanostores'
import {marked} from 'marked';
import DOMPurify from 'dompurify';

export default function Chat() {
const chatConfig = useStore($chatConfig)
Expand Down Expand Up @@ -40,7 +42,6 @@ export default function Chat() {

// Send the user input to the chat API
function submitInput() {
console.log("submitInput")
if (loading()) {
setWarningMsg("⏳ Thinking...");
return
Expand Down Expand Up @@ -131,8 +132,7 @@ export default function Chat() {

{/* Website description */}
<div class="container mx-auto px-2 max-w-5xl">
<div class="py-4 text-center font-thin" innerHTML={marked.parse(chatConfig().info.description).toString()}>
</div>
<div class="py-4 text-center font-thin" innerHTML={DOMPurify.sanitize(marked.parse(chatConfig().info.description))} />
</div>

{/* Chat messages */}
Expand All @@ -143,8 +143,7 @@ export default function Chat() {
<div class="px-2 py-8 mx-auto max-w-5xl">
<div class="container flex items-center">
<div>
<article class="prose max-w-full" innerHTML={marked.parse(msg.message).toString()}>
</article>
<article class="prose max-w-full" innerHTML={DOMPurify.sanitize(marked.parse(msg.message).toString())} />
{/* Add sources when RAG */}
{ msg.sources.length > 0 &&
<>
Expand Down Expand Up @@ -184,33 +183,33 @@ export default function Chat() {
{/* Warning message */}
{ warningMsg().length > 0 &&
<div class="text-center">
<div id="warning-card" class="bg-orange-300 p-2 text-orange-900 text-sm rounded-lg font-semibold mb-2 hidden inline-block"></div>
<div id="warning-card" class="bg-orange-300 p-2 text-orange-900 text-sm rounded-lg font-semibold mb-2 hidden inline-block" />
</div>
}

{/* List of examples */}
<div class="py-2 px-4 justify-center items-center text-xs flex space-x-2" id="example-buttons">
<For each={chatConfig().info.examples}>{(example, _i) =>
<For each={chatConfig().info.examples}>{(example) =>
<button onClick={() => {setPrompt(example) ; submitInput()}} class="px-4 py-1 bg-neutral-content text-slate-600 rounded-lg hover:bg-slate-400">
{example}
</button>
}</For>
</div>

{/* User input border-t border-slate-500 dark:border-slate-500 */}
{/* User input */}
<form class="p-2 flex" id="chat-form" onSubmit={(e) => handleSubmit(e)}>
<div class="container flex mx-auto max-w-5xl">
<div id="user-input" contenteditable={true} style="height: max-content;"
class="flex-grow px-4 py-2 border border-slate-500 rounded-lg focus:outline-none focus:ring focus:ring-blue-300"
// placeholder="Send a message..."
onInput={(e) => handleInput(e)}
onKeyDown={(e) => handleKeyPress(e)}
></div>
/>
<button type="submit" id="submit-btn" class="ml-2 px-4 py-2 rounded-lg text-slate-400 bg-slate-600 hover:bg-slate-700">
{ loading() ? (
<i id="loading-spinner" class="fas fa-spinner fa-spin"></i>
<i id="loading-spinner" class="fas fa-spinner fa-spin"/>
) : (
<i id="send-icon" class="fas fa-paper-plane"></i>
<i id="send-icon" class="fas fa-paper-plane"/>
)}
</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { title } = Astro.props;
<meta charset="UTF-8" />
<meta name="description" content="Open source chatbot" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="icon" type="image/svg+xml" href="/logo.png" />
<meta name="generator" content={Astro.generator} />
<title>{title}</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
Expand Down
12 changes: 12 additions & 0 deletions scripts/qdrant_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Default: https://github.com/qdrant/qdrant/blob/master/config/config.yaml
log_level: INFO
telemetry_disabled: true

service:
api_key: TOCHANGE

storage:
# Where to store all the data
storage_path: ./storage
# Where to store snapshots
snapshots_path: ./snapshots

0 comments on commit 5702b0d

Please sign in to comment.