Spaces:
Running
Running
Upload 13 files
Browse files- README.md +24 -44
- package.json +33 -18
- pnpm-lock.yaml +0 -0
- src/app.d.ts +13 -0
- src/app.html +11 -0
- src/lib/assets/favicon.svg +1 -0
- src/lib/index.ts +1 -0
- src/routes/+layout.svelte +11 -0
- src/routes/+page.svelte +340 -0
- static/robots.txt +3 -0
- svelte.config.js +17 -6
- tsconfig.json +17 -5
- vite.config.ts +4 -5
README.md
CHANGED
@@ -1,58 +1,38 @@
|
|
1 |
-
|
2 |
-
title: Df
|
3 |
-
emoji: 🔥
|
4 |
-
colorFrom: pink
|
5 |
-
colorTo: gray
|
6 |
-
sdk: static
|
7 |
-
pinned: false
|
8 |
-
app_build_command: npm run build
|
9 |
-
app_file: dist/index.html
|
10 |
-
---
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
15 |
|
16 |
-
|
17 |
|
18 |
-
|
|
|
|
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
## Technical considerations
|
25 |
-
|
26 |
-
**Why use this over SvelteKit?**
|
27 |
-
|
28 |
-
- It brings its own routing solution which might not be preferable for some users.
|
29 |
-
- It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app.
|
30 |
-
|
31 |
-
This template contains as little as possible to get started with Vite + TypeScript + Svelte, while taking into account the developer experience with regards to HMR and intellisense. It demonstrates capabilities on par with the other `create-vite` templates and is a good starting point for beginners dipping their toes into a Vite + Svelte project.
|
32 |
-
|
33 |
-
Should you later need the extended capabilities and extensibility provided by SvelteKit, the template has been structured similarly to SvelteKit so that it is easy to migrate.
|
34 |
-
|
35 |
-
**Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or `tsconfig.json`?**
|
36 |
|
37 |
-
|
38 |
|
39 |
-
|
40 |
|
41 |
-
|
|
|
42 |
|
43 |
-
|
|
|
|
|
44 |
|
45 |
-
|
46 |
|
47 |
-
|
48 |
|
49 |
-
|
|
|
|
|
50 |
|
51 |
-
|
52 |
|
53 |
-
|
54 |
-
// store.ts
|
55 |
-
// An extremely simple external store
|
56 |
-
import { writable } from "svelte/store";
|
57 |
-
export default writable(0);
|
58 |
-
```
|
|
|
1 |
+
# sv
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
|
4 |
|
5 |
+
## Creating a project
|
6 |
|
7 |
+
If you're seeing this, you've probably already done this step. Congrats!
|
8 |
|
9 |
+
```sh
|
10 |
+
# create a new project in the current directory
|
11 |
+
npx sv create
|
12 |
|
13 |
+
# create a new project in my-app
|
14 |
+
npx sv create my-app
|
15 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
## Developing
|
18 |
|
19 |
+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
20 |
|
21 |
+
```sh
|
22 |
+
npm run dev
|
23 |
|
24 |
+
# or start the server and open the app in a new browser tab
|
25 |
+
npm run dev -- --open
|
26 |
+
```
|
27 |
|
28 |
+
## Building
|
29 |
|
30 |
+
To create a production version of your app:
|
31 |
|
32 |
+
```sh
|
33 |
+
npm run build
|
34 |
+
```
|
35 |
|
36 |
+
You can preview the production build with `npm run preview`.
|
37 |
|
38 |
+
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
|
|
|
|
|
|
|
|
|
package.json
CHANGED
@@ -1,20 +1,35 @@
|
|
1 |
{
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
|
|
1 |
{
|
2 |
+
"name": "test-df",
|
3 |
+
"private": true,
|
4 |
+
"version": "0.0.1",
|
5 |
+
"type": "module",
|
6 |
+
"scripts": {
|
7 |
+
"dev": "vite dev",
|
8 |
+
"build": "vite build",
|
9 |
+
"preview": "vite preview",
|
10 |
+
"prepare": "svelte-kit sync || echo ''",
|
11 |
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
12 |
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
13 |
+
"format": "prettier --write .",
|
14 |
+
"lint": "prettier --check ."
|
15 |
+
},
|
16 |
+
"devDependencies": {
|
17 |
+
"@sveltejs/adapter-auto": "^6.0.0",
|
18 |
+
"@sveltejs/kit": "^2.22.0",
|
19 |
+
"@sveltejs/vite-plugin-svelte": "^6.0.0",
|
20 |
+
"prettier": "^3.4.2",
|
21 |
+
"prettier-plugin-svelte": "^3.3.3",
|
22 |
+
"svelte": "^5.0.0",
|
23 |
+
"svelte-check": "^4.0.0",
|
24 |
+
"typescript": "^5.0.0",
|
25 |
+
"vite": "^7.0.4"
|
26 |
+
},
|
27 |
+
"pnpm": {
|
28 |
+
"onlyBuiltDependencies": [
|
29 |
+
"esbuild"
|
30 |
+
]
|
31 |
+
},
|
32 |
+
"dependencies": {
|
33 |
+
"@gradio/dataframe": "https://pkg.pr.new/gradio-app/gradio/@gradio/dataframe@35c0b7c"
|
34 |
+
}
|
35 |
}
|
pnpm-lock.yaml
ADDED
The diff for this file is too large to render.
See raw diff
|
|
src/app.d.ts
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// See https://svelte.dev/docs/kit/types#app.d.ts
|
2 |
+
// for information about these interfaces
|
3 |
+
declare global {
|
4 |
+
namespace App {
|
5 |
+
// interface Error {}
|
6 |
+
// interface Locals {}
|
7 |
+
// interface PageData {}
|
8 |
+
// interface PageState {}
|
9 |
+
// interface Platform {}
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
export {};
|
src/app.html
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!doctype html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="utf-8" />
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
6 |
+
%sveltekit.head%
|
7 |
+
</head>
|
8 |
+
<body data-sveltekit-preload-data="hover">
|
9 |
+
<div style="display: contents">%sveltekit.body%</div>
|
10 |
+
</body>
|
11 |
+
</html>
|
src/lib/assets/favicon.svg
ADDED
|
src/lib/index.ts
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
// place files you want to import through the `$lib` alias in this folder.
|
src/routes/+layout.svelte
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script lang="ts">
|
2 |
+
import favicon from '$lib/assets/favicon.svg';
|
3 |
+
|
4 |
+
let { children } = $props();
|
5 |
+
</script>
|
6 |
+
|
7 |
+
<svelte:head>
|
8 |
+
<link rel="icon" href={favicon} />
|
9 |
+
</svelte:head>
|
10 |
+
|
11 |
+
{@render children?.()}
|
src/routes/+page.svelte
ADDED
@@ -0,0 +1,340 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script lang="ts">
|
2 |
+
import Dataframe from "@gradio/dataframe";
|
3 |
+
import { onMount } from 'svelte';
|
4 |
+
|
5 |
+
interface Message {
|
6 |
+
text: string;
|
7 |
+
sender: "user" | "bot";
|
8 |
+
}
|
9 |
+
|
10 |
+
let value = {
|
11 |
+
data: [
|
12 |
+
["Alice", 25, "Yes", "2024-01-15", "Engineer", "San Francisco", 85000, "Active"],
|
13 |
+
["Bob", 30, "No", "2024-02-20", "Designer", "New York", 75000, "Inactive"],
|
14 |
+
["Charlie", 35, "Yes", "2024-03-10", "Manager", "Chicago", 95000, "Active"],
|
15 |
+
["Diana", 28, "No", "2024-04-05", "Developer", "Austin", 80000, "Inactive"],
|
16 |
+
["Eve", 32, "Yes", "2024-05-12", "Analyst", "Seattle", 70000, "Active"],
|
17 |
+
["Frank", 29, "Yes", "2024-06-18", "Engineer", "Boston", 82000, "Active"],
|
18 |
+
["Grace", 27, "No", "2024-07-22", "Designer", "Portland", 68000, "Inactive"],
|
19 |
+
["Henry", 33, "Yes", "2024-08-30", "Manager", "Denver", 88000, "Active"],
|
20 |
+
["Ivy", 26, "Yes", "2024-09-14", "Developer", "Miami", 72000, "Active"],
|
21 |
+
["Jack", 31, "No", "2024-10-08", "Analyst", "Atlanta", 65000, "Inactive"],
|
22 |
+
["Kate", 34, "Yes", "2024-11-25", "Engineer", "Phoenix", 90000, "Active"],
|
23 |
+
["Liam", 28, "Yes", "2024-12-01", "Designer", "Dallas", 78000, "Active"],
|
24 |
+
["Maya", 29, "No", "2025-01-15", "Manager", "Houston", 92000, "Inactive"],
|
25 |
+
["Noah", 36, "Yes", "2025-02-20", "Developer", "Philadelphia", 85000, "Active"],
|
26 |
+
["Olivia", 27, "Yes", "2025-03-10", "Analyst", "Detroit", 70000, "Active"]
|
27 |
+
],
|
28 |
+
headers: ["Name", "Age", "Active", "Join Date", "Role", "Location", "Salary", "Status"],
|
29 |
+
metadata: null
|
30 |
+
};
|
31 |
+
|
32 |
+
let datatype = ["str", "number", "str", "date", "str", "str", "number", "str"];
|
33 |
+
|
34 |
+
let messages: Message[] = [];
|
35 |
+
let newMessage = "What is Alice's salary?";
|
36 |
+
let isGenerating = false;
|
37 |
+
let generator: any = null;
|
38 |
+
let isModelReady = false;
|
39 |
+
|
40 |
+
onMount(async () => {
|
41 |
+
messages = [...messages, { text: "🤖 Model initializing...", sender: "bot" }];
|
42 |
+
await initializeModel();
|
43 |
+
});
|
44 |
+
|
45 |
+
async function initializeModel() {
|
46 |
+
try {
|
47 |
+
console.log('Initializing Gemma model...');
|
48 |
+
|
49 |
+
// Load the library in chunks to prevent blocking
|
50 |
+
const transformersModule = await import('https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.7.1');
|
51 |
+
|
52 |
+
// Update loading message
|
53 |
+
messages = [...messages, { text: "📦 Loading model components...", sender: "bot" }];
|
54 |
+
|
55 |
+
// Small delay to allow UI update
|
56 |
+
await new Promise(resolve => setTimeout(resolve, 100));
|
57 |
+
|
58 |
+
const { pipeline } = transformersModule;
|
59 |
+
|
60 |
+
// Update loading message
|
61 |
+
messages = [...messages, { text: "🚀 Starting model...", sender: "bot" }];
|
62 |
+
|
63 |
+
// Small delay to allow UI update
|
64 |
+
await new Promise(resolve => setTimeout(resolve, 100));
|
65 |
+
|
66 |
+
generator = await pipeline(
|
67 |
+
'text-generation',
|
68 |
+
'onnx-community/gemma-3-270m-it-ONNX',
|
69 |
+
{ dtype: 'fp32' }
|
70 |
+
);
|
71 |
+
|
72 |
+
console.log('Model loaded successfully');
|
73 |
+
isModelReady = true;
|
74 |
+
messages = [...messages, { text: "✅ Model ready! Ask me anything about the employee data.", sender: "bot" }];
|
75 |
+
} catch (error) {
|
76 |
+
console.error('Failed to initialize model:', error);
|
77 |
+
messages = [...messages, { text: "⚠️ Failed to load AI model. Please refresh the page to try again.", sender: "bot" }];
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
async function sendMessage() {
|
82 |
+
if (newMessage.trim() && !isGenerating) {
|
83 |
+
const userMessage = newMessage.trim();
|
84 |
+
messages = [...messages, { text: userMessage, sender: "user" }];
|
85 |
+
|
86 |
+
if (!isModelReady) {
|
87 |
+
messages = [...messages, { text: "⏳ Model is still initializing. Please wait...", sender: "bot" }];
|
88 |
+
newMessage = "";
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
|
92 |
+
isGenerating = true;
|
93 |
+
newMessage = "";
|
94 |
+
|
95 |
+
// Add a placeholder response that will be updated
|
96 |
+
const placeholderIndex = messages.length;
|
97 |
+
messages = [...messages, { text: "🤔 Thinking...", sender: "bot" }];
|
98 |
+
|
99 |
+
// Use requestAnimationFrame to ensure UI updates before heavy processing
|
100 |
+
requestAnimationFrame(async () => {
|
101 |
+
try {
|
102 |
+
const systemPrompt = `You are a helpful AI assistant that answers questions about employee data. Here's the current data:
|
103 |
+
|
104 |
+
${value.headers.join(' | ')}
|
105 |
+
${value.data.map(row => row.join(' | ')).join('\n')}
|
106 |
+
|
107 |
+
Keep your responses concise and helpful. Answer questions about the data above.`;
|
108 |
+
|
109 |
+
// Break the processing into smaller chunks to prevent blocking
|
110 |
+
const processInChunks = async () => {
|
111 |
+
const response = await generator([
|
112 |
+
{ role: "system", content: systemPrompt },
|
113 |
+
{ role: "user", content: userMessage }
|
114 |
+
], {
|
115 |
+
max_new_tokens: 256,
|
116 |
+
do_sample: true,
|
117 |
+
temperature: 0.7,
|
118 |
+
top_p: 0.9
|
119 |
+
});
|
120 |
+
|
121 |
+
const generatedContent = response[0].generated_text.at(-1).content;
|
122 |
+
|
123 |
+
// Update the placeholder message
|
124 |
+
messages = messages.map((msg, index) =>
|
125 |
+
index === placeholderIndex ? { text: generatedContent, sender: "bot" } : msg
|
126 |
+
);
|
127 |
+
};
|
128 |
+
|
129 |
+
// Use a small delay to allow UI to update
|
130 |
+
await new Promise(resolve => setTimeout(resolve, 50));
|
131 |
+
await processInChunks();
|
132 |
+
|
133 |
+
} catch (error) {
|
134 |
+
console.error('Generation error:', error);
|
135 |
+
|
136 |
+
// Update the placeholder message with error
|
137 |
+
messages = messages.map((msg, index) =>
|
138 |
+
index === placeholderIndex ? { text: 'Sorry, I encountered an error. Please try again.', sender: "bot" } : msg
|
139 |
+
);
|
140 |
+
} finally {
|
141 |
+
isGenerating = false;
|
142 |
+
}
|
143 |
+
});
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
function handleKeyPress(event: KeyboardEvent) {
|
148 |
+
if (event.key === "Enter") {
|
149 |
+
sendMessage();
|
150 |
+
}
|
151 |
+
}
|
152 |
+
</script>
|
153 |
+
|
154 |
+
<div class="container">
|
155 |
+
<div class="dataframe-section">
|
156 |
+
<Dataframe
|
157 |
+
bind:value
|
158 |
+
{datatype}
|
159 |
+
show_search="none"
|
160 |
+
show_row_numbers={false}
|
161 |
+
show_copy_button={false}
|
162 |
+
show_fullscreen_button={false}
|
163 |
+
editable={true}
|
164 |
+
show_label={false}
|
165 |
+
/>
|
166 |
+
<div class="credits">
|
167 |
+
❤︎ Built with Gemma 3 270M Onnx & Gradio's Dataframe.js
|
168 |
+
</div>
|
169 |
+
</div>
|
170 |
+
|
171 |
+
<div class="chatbot-section">
|
172 |
+
<h2>Chatbot</h2>
|
173 |
+
<div class="chat-messages">
|
174 |
+
{#each messages as message}
|
175 |
+
<div class="message {message.sender}">
|
176 |
+
<div class="message-content">{message.text}</div>
|
177 |
+
</div>
|
178 |
+
{/each}
|
179 |
+
</div>
|
180 |
+
</div>
|
181 |
+
</div>
|
182 |
+
|
183 |
+
<div class="chat-input-container">
|
184 |
+
<div class="chat-input">
|
185 |
+
<input
|
186 |
+
type="text"
|
187 |
+
bind:value={newMessage}
|
188 |
+
placeholder="What is Alice's salary?"
|
189 |
+
on:keypress={handleKeyPress}
|
190 |
+
autofocus
|
191 |
+
/>
|
192 |
+
<button on:click={sendMessage}>Send</button>
|
193 |
+
</div>
|
194 |
+
</div>
|
195 |
+
|
196 |
+
<style>
|
197 |
+
.container {
|
198 |
+
display: flex;
|
199 |
+
height: 100vh;
|
200 |
+
width: 100vw;
|
201 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
202 |
+
}
|
203 |
+
|
204 |
+
.dataframe-section {
|
205 |
+
width: 80%;
|
206 |
+
padding: 20px;
|
207 |
+
border-right: 2px solid #e0e0e0;
|
208 |
+
overflow: hidden;
|
209 |
+
padding-bottom: 100px;
|
210 |
+
}
|
211 |
+
|
212 |
+
.credits {
|
213 |
+
text-align: center;
|
214 |
+
margin-top: 20px;
|
215 |
+
padding: 10px;
|
216 |
+
color: #666;
|
217 |
+
font-size: 12px;
|
218 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
219 |
+
border-top: 1px solid #e0e0e0;
|
220 |
+
background-color: #f8f9fa;
|
221 |
+
border-radius: 0 0 8px 8px;
|
222 |
+
}
|
223 |
+
|
224 |
+
.chatbot-section {
|
225 |
+
width: 20%;
|
226 |
+
padding: 20px;
|
227 |
+
display: flex;
|
228 |
+
flex-direction: column;
|
229 |
+
background-color: #f8f9fa;
|
230 |
+
}
|
231 |
+
|
232 |
+
h2 {
|
233 |
+
margin: 0 0 20px 0;
|
234 |
+
color: #333;
|
235 |
+
font-size: 20px;
|
236 |
+
font-weight: 600;
|
237 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
238 |
+
}
|
239 |
+
|
240 |
+
.chat-messages {
|
241 |
+
flex: 1;
|
242 |
+
overflow-y: auto;
|
243 |
+
margin-bottom: 20px;
|
244 |
+
padding: 15px;
|
245 |
+
background: white;
|
246 |
+
border-radius: 12px;
|
247 |
+
border: 1px solid #e1e5e9;
|
248 |
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
249 |
+
}
|
250 |
+
|
251 |
+
.message {
|
252 |
+
margin-bottom: 12px;
|
253 |
+
}
|
254 |
+
|
255 |
+
.message.user {
|
256 |
+
text-align: right;
|
257 |
+
}
|
258 |
+
|
259 |
+
.message.bot {
|
260 |
+
text-align: left;
|
261 |
+
}
|
262 |
+
|
263 |
+
.message-content {
|
264 |
+
display: inline-block;
|
265 |
+
padding: 10px 16px;
|
266 |
+
border-radius: 20px;
|
267 |
+
max-width: 85%;
|
268 |
+
word-wrap: break-word;
|
269 |
+
font-size: 14px;
|
270 |
+
line-height: 1.4;
|
271 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
272 |
+
}
|
273 |
+
|
274 |
+
.message.user .message-content {
|
275 |
+
background-color: #007acc;
|
276 |
+
color: white;
|
277 |
+
font-weight: 500;
|
278 |
+
}
|
279 |
+
|
280 |
+
.message.bot .message-content {
|
281 |
+
background-color: #f1f3f4;
|
282 |
+
color: #202124;
|
283 |
+
font-weight: 400;
|
284 |
+
}
|
285 |
+
|
286 |
+
.chat-input {
|
287 |
+
display: flex;
|
288 |
+
gap: 10px;
|
289 |
+
}
|
290 |
+
|
291 |
+
.chat-input input {
|
292 |
+
flex: 1;
|
293 |
+
padding: 12px 16px;
|
294 |
+
border: 2px solid #e1e5e9;
|
295 |
+
border-radius: 8px;
|
296 |
+
font-size: 14px;
|
297 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
298 |
+
transition: border-color 0.2s ease;
|
299 |
+
}
|
300 |
+
|
301 |
+
.chat-input input:focus {
|
302 |
+
outline: none;
|
303 |
+
border-color: #007acc;
|
304 |
+
}
|
305 |
+
|
306 |
+
.chat-input button {
|
307 |
+
padding: 12px 20px;
|
308 |
+
background-color: #007acc;
|
309 |
+
color: white;
|
310 |
+
border: none;
|
311 |
+
border-radius: 8px;
|
312 |
+
cursor: pointer;
|
313 |
+
font-size: 14px;
|
314 |
+
font-weight: 500;
|
315 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
316 |
+
transition: background-color 0.2s ease;
|
317 |
+
}
|
318 |
+
|
319 |
+
.chat-input button:hover {
|
320 |
+
background-color: #005a9e;
|
321 |
+
}
|
322 |
+
|
323 |
+
.chat-input-container {
|
324 |
+
position: fixed;
|
325 |
+
bottom: 0;
|
326 |
+
left: 0;
|
327 |
+
right: 0;
|
328 |
+
background: white;
|
329 |
+
border-top: 1px solid #e1e5e9;
|
330 |
+
padding: 20px;
|
331 |
+
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
|
332 |
+
}
|
333 |
+
|
334 |
+
.chat-input {
|
335 |
+
max-width: 1200px;
|
336 |
+
margin: 0 auto;
|
337 |
+
display: flex;
|
338 |
+
gap: 10px;
|
339 |
+
}
|
340 |
+
</style>
|
static/robots.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
# allow crawling everything by default
|
2 |
+
User-agent: *
|
3 |
+
Disallow:
|
svelte.config.js
CHANGED
@@ -1,7 +1,18 @@
|
|
1 |
-
import
|
|
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import adapter from '@sveltejs/adapter-auto';
|
2 |
+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
3 |
|
4 |
+
/** @type {import('@sveltejs/kit').Config} */
|
5 |
+
const config = {
|
6 |
+
// Consult https://svelte.dev/docs/kit/integrations
|
7 |
+
// for more information about preprocessors
|
8 |
+
preprocess: vitePreprocess(),
|
9 |
+
|
10 |
+
kit: {
|
11 |
+
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
|
12 |
+
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
13 |
+
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
|
14 |
+
adapter: adapter()
|
15 |
+
}
|
16 |
+
};
|
17 |
+
|
18 |
+
export default config;
|
tsconfig.json
CHANGED
@@ -1,7 +1,19 @@
|
|
1 |
{
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
}
|
|
|
1 |
{
|
2 |
+
"extends": "./.svelte-kit/tsconfig.json",
|
3 |
+
"compilerOptions": {
|
4 |
+
"allowJs": true,
|
5 |
+
"checkJs": true,
|
6 |
+
"esModuleInterop": true,
|
7 |
+
"forceConsistentCasingInFileNames": true,
|
8 |
+
"resolveJsonModule": true,
|
9 |
+
"skipLibCheck": true,
|
10 |
+
"sourceMap": true,
|
11 |
+
"strict": true,
|
12 |
+
"moduleResolution": "bundler"
|
13 |
+
}
|
14 |
+
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
|
15 |
+
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
|
16 |
+
//
|
17 |
+
// To make changes to top-level options such as include and exclude, we recommend extending
|
18 |
+
// the generated config; see https://svelte.dev/docs/kit/configuration#typescript
|
19 |
}
|
vite.config.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
-
import {
|
2 |
-
import {
|
3 |
|
4 |
-
// https://vite.dev/config/
|
5 |
export default defineConfig({
|
6 |
-
|
7 |
-
})
|
|
|
1 |
+
import { sveltekit } from '@sveltejs/kit/vite';
|
2 |
+
import { defineConfig } from 'vite';
|
3 |
|
|
|
4 |
export default defineConfig({
|
5 |
+
plugins: [sveltekit()]
|
6 |
+
});
|