Spaces:
Running
Running
Upload 9 files
Browse files- scripts/api.js +2 -2
- scripts/app.js +1 -1
- styles/main.css +43 -23
scripts/api.js
CHANGED
|
@@ -11,7 +11,7 @@ const API = {
|
|
| 11 |
// Call Elysia via OpenRouter
|
| 12 |
async call(messages, options = {}) {
|
| 13 |
const apiKey = options.apiKey || Utils.storage.get("apiKey");
|
| 14 |
-
const model = options.model || Utils.storage.get("model", "
|
| 15 |
|
| 16 |
// Validate API key
|
| 17 |
const validation = Utils.validateApiKey(apiKey);
|
|
@@ -87,7 +87,7 @@ const API = {
|
|
| 87 |
// Stream Chat (for real-time responses)
|
| 88 |
async stream(messages, onChunk, options = {}) {
|
| 89 |
const apiKey = options.apiKey || Utils.storage.get("apiKey");
|
| 90 |
-
const model = options.model || Utils.storage.get("model", "
|
| 91 |
|
| 92 |
const validation = Utils.validateApiKey(apiKey);
|
| 93 |
if (!validation.valid) {
|
|
|
|
| 11 |
// Call Elysia via OpenRouter
|
| 12 |
async call(messages, options = {}) {
|
| 13 |
const apiKey = options.apiKey || Utils.storage.get("apiKey");
|
| 14 |
+
const model = options.model || Utils.storage.get("model", "x-ai/grok-4.1-fast");
|
| 15 |
|
| 16 |
// Validate API key
|
| 17 |
const validation = Utils.validateApiKey(apiKey);
|
|
|
|
| 87 |
// Stream Chat (for real-time responses)
|
| 88 |
async stream(messages, onChunk, options = {}) {
|
| 89 |
const apiKey = options.apiKey || Utils.storage.get("apiKey");
|
| 90 |
+
const model = options.model || Utils.storage.get("model", "x-ai/grok-4.1-fast");
|
| 91 |
|
| 92 |
const validation = Utils.validateApiKey(apiKey);
|
| 93 |
if (!validation.valid) {
|
scripts/app.js
CHANGED
|
@@ -12,7 +12,7 @@ class App {
|
|
| 12 |
constructor() {
|
| 13 |
this.state = {
|
| 14 |
apiKey: null,
|
| 15 |
-
model: "x-ai/grok-
|
| 16 |
maxFiles: 100,
|
| 17 |
autoPreview: true,
|
| 18 |
syntaxHighlighting: true,
|
|
|
|
| 12 |
constructor() {
|
| 13 |
this.state = {
|
| 14 |
apiKey: null,
|
| 15 |
+
model: "x-ai/grok-4.1-fast",
|
| 16 |
maxFiles: 100,
|
| 17 |
autoPreview: true,
|
| 18 |
syntaxHighlighting: true,
|
styles/main.css
CHANGED
|
@@ -390,7 +390,7 @@ a:hover {
|
|
| 390 |
|
| 391 |
.main-container {
|
| 392 |
display: grid;
|
| 393 |
-
grid-template-columns:
|
| 394 |
gap: 0;
|
| 395 |
flex: 1;
|
| 396 |
min-height: 0;
|
|
@@ -404,7 +404,7 @@ a:hover {
|
|
| 404 |
}
|
| 405 |
|
| 406 |
.main-container:has(.sidebar-left.hidden):not(:has(.sidebar-right.hidden)) {
|
| 407 |
-
grid-template-columns: 0 1fr
|
| 408 |
}
|
| 409 |
|
| 410 |
.main-container:not(:has(.sidebar-left.hidden)):has(.sidebar-right.hidden) {
|
|
@@ -437,8 +437,8 @@ a:hover {
|
|
| 437 |
}
|
| 438 |
|
| 439 |
.sidebar-right {
|
| 440 |
-
width:
|
| 441 |
-
min-width:
|
| 442 |
border-right: none;
|
| 443 |
border-left: 1px solid var(--border-color);
|
| 444 |
}
|
|
@@ -802,42 +802,44 @@ a:hover {
|
|
| 802 |
}
|
| 803 |
|
| 804 |
.input-wrapper {
|
|
|
|
| 805 |
display: flex;
|
| 806 |
-
gap: 0.75rem;
|
| 807 |
align-items: flex-end;
|
| 808 |
}
|
| 809 |
|
| 810 |
-
/* Mobile:
|
| 811 |
@media (max-width: 600px) {
|
| 812 |
.input-wrapper {
|
| 813 |
-
|
| 814 |
-
align-items: stretch;
|
| 815 |
-
gap: 0.5rem;
|
| 816 |
}
|
| 817 |
|
| 818 |
.btn-send,
|
| 819 |
.btn-cancel {
|
| 820 |
-
|
| 821 |
-
|
| 822 |
}
|
| 823 |
}
|
| 824 |
|
| 825 |
#chat-input {
|
| 826 |
-
|
| 827 |
background: var(--bg-tertiary);
|
| 828 |
border: 1px solid var(--border-color);
|
| 829 |
-
border-radius:
|
| 830 |
-
padding: 0.
|
|
|
|
| 831 |
color: var(--text-primary);
|
| 832 |
font-family: var(--font-sans);
|
| 833 |
font-size: 0.95rem;
|
| 834 |
resize: none;
|
| 835 |
-
transition:
|
|
|
|
|
|
|
| 836 |
}
|
| 837 |
|
| 838 |
#chat-input:focus {
|
| 839 |
outline: none;
|
| 840 |
border-color: var(--accent-purple);
|
|
|
|
| 841 |
}
|
| 842 |
|
| 843 |
.input-info {
|
|
@@ -976,32 +978,46 @@ button {
|
|
| 976 |
}
|
| 977 |
|
| 978 |
.btn-send {
|
|
|
|
|
|
|
|
|
|
| 979 |
background: var(--gradient-primary);
|
| 980 |
color: white;
|
| 981 |
-
padding: 0.
|
| 982 |
font-weight: 600;
|
|
|
|
| 983 |
display: flex;
|
| 984 |
align-items: center;
|
| 985 |
-
gap: 0.
|
|
|
|
|
|
|
| 986 |
}
|
| 987 |
|
| 988 |
.btn-send:hover:not(:disabled) {
|
| 989 |
-
transform: scale(1.
|
|
|
|
| 990 |
}
|
| 991 |
|
| 992 |
.btn-send:disabled {
|
| 993 |
-
opacity: 0.
|
| 994 |
cursor: not-allowed;
|
|
|
|
| 995 |
}
|
| 996 |
|
| 997 |
.btn-cancel {
|
|
|
|
|
|
|
|
|
|
| 998 |
background: var(--error);
|
| 999 |
color: white;
|
| 1000 |
-
padding: 0.
|
| 1001 |
font-weight: 600;
|
|
|
|
| 1002 |
display: flex;
|
| 1003 |
align-items: center;
|
| 1004 |
-
gap: 0.
|
|
|
|
|
|
|
| 1005 |
}
|
| 1006 |
|
| 1007 |
.btn-cancel:hover {
|
|
@@ -1205,8 +1221,8 @@ button {
|
|
| 1205 |
|
| 1206 |
.preview-header {
|
| 1207 |
display: flex;
|
| 1208 |
-
|
| 1209 |
-
|
| 1210 |
margin-bottom: 1rem;
|
| 1211 |
padding-bottom: 0.75rem;
|
| 1212 |
border-bottom: 1px solid var(--border-color);
|
|
@@ -1216,11 +1232,15 @@ button {
|
|
| 1216 |
font-family: var(--font-mono);
|
| 1217 |
color: var(--accent-purple);
|
| 1218 |
font-weight: 600;
|
|
|
|
|
|
|
|
|
|
| 1219 |
}
|
| 1220 |
|
| 1221 |
.preview-actions {
|
| 1222 |
display: flex;
|
| 1223 |
gap: 0.5rem;
|
|
|
|
| 1224 |
}
|
| 1225 |
|
| 1226 |
/* ========================================
|
|
|
|
| 390 |
|
| 391 |
.main-container {
|
| 392 |
display: grid;
|
| 393 |
+
grid-template-columns: 280px 1fr 450px;
|
| 394 |
gap: 0;
|
| 395 |
flex: 1;
|
| 396 |
min-height: 0;
|
|
|
|
| 404 |
}
|
| 405 |
|
| 406 |
.main-container:has(.sidebar-left.hidden):not(:has(.sidebar-right.hidden)) {
|
| 407 |
+
grid-template-columns: 0 1fr 450px; /* Left hidden: chat expands left */
|
| 408 |
}
|
| 409 |
|
| 410 |
.main-container:not(:has(.sidebar-left.hidden)):has(.sidebar-right.hidden) {
|
|
|
|
| 437 |
}
|
| 438 |
|
| 439 |
.sidebar-right {
|
| 440 |
+
width: 450px;
|
| 441 |
+
min-width: 450px;
|
| 442 |
border-right: none;
|
| 443 |
border-left: 1px solid var(--border-color);
|
| 444 |
}
|
|
|
|
| 802 |
}
|
| 803 |
|
| 804 |
.input-wrapper {
|
| 805 |
+
position: relative;
|
| 806 |
display: flex;
|
|
|
|
| 807 |
align-items: flex-end;
|
| 808 |
}
|
| 809 |
|
| 810 |
+
/* Mobile: adjust for smaller screens */
|
| 811 |
@media (max-width: 600px) {
|
| 812 |
.input-wrapper {
|
| 813 |
+
/* Keep relative positioning on mobile too */
|
|
|
|
|
|
|
| 814 |
}
|
| 815 |
|
| 816 |
.btn-send,
|
| 817 |
.btn-cancel {
|
| 818 |
+
padding: 0.5rem 0.75rem;
|
| 819 |
+
font-size: 0.85rem;
|
| 820 |
}
|
| 821 |
}
|
| 822 |
|
| 823 |
#chat-input {
|
| 824 |
+
width: 100%;
|
| 825 |
background: var(--bg-tertiary);
|
| 826 |
border: 1px solid var(--border-color);
|
| 827 |
+
border-radius: 12px;
|
| 828 |
+
padding: 0.875rem 1rem;
|
| 829 |
+
padding-right: 4.5rem; /* Space for the button inside */
|
| 830 |
color: var(--text-primary);
|
| 831 |
font-family: var(--font-sans);
|
| 832 |
font-size: 0.95rem;
|
| 833 |
resize: none;
|
| 834 |
+
transition:
|
| 835 |
+
border-color 0.2s,
|
| 836 |
+
box-shadow 0.2s;
|
| 837 |
}
|
| 838 |
|
| 839 |
#chat-input:focus {
|
| 840 |
outline: none;
|
| 841 |
border-color: var(--accent-purple);
|
| 842 |
+
box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.15);
|
| 843 |
}
|
| 844 |
|
| 845 |
.input-info {
|
|
|
|
| 978 |
}
|
| 979 |
|
| 980 |
.btn-send {
|
| 981 |
+
position: absolute;
|
| 982 |
+
right: 0.5rem;
|
| 983 |
+
bottom: 0.5rem;
|
| 984 |
background: var(--gradient-primary);
|
| 985 |
color: white;
|
| 986 |
+
padding: 0.5rem 1rem;
|
| 987 |
font-weight: 600;
|
| 988 |
+
font-size: 0.875rem;
|
| 989 |
display: flex;
|
| 990 |
align-items: center;
|
| 991 |
+
gap: 0.35rem;
|
| 992 |
+
border-radius: 8px;
|
| 993 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
| 994 |
}
|
| 995 |
|
| 996 |
.btn-send:hover:not(:disabled) {
|
| 997 |
+
transform: scale(1.05);
|
| 998 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
|
| 999 |
}
|
| 1000 |
|
| 1001 |
.btn-send:disabled {
|
| 1002 |
+
opacity: 0.4;
|
| 1003 |
cursor: not-allowed;
|
| 1004 |
+
transform: none;
|
| 1005 |
}
|
| 1006 |
|
| 1007 |
.btn-cancel {
|
| 1008 |
+
position: absolute;
|
| 1009 |
+
right: 0.5rem;
|
| 1010 |
+
bottom: 0.5rem;
|
| 1011 |
background: var(--error);
|
| 1012 |
color: white;
|
| 1013 |
+
padding: 0.5rem 1rem;
|
| 1014 |
font-weight: 600;
|
| 1015 |
+
font-size: 0.875rem;
|
| 1016 |
display: flex;
|
| 1017 |
align-items: center;
|
| 1018 |
+
gap: 0.35rem;
|
| 1019 |
+
border-radius: 8px;
|
| 1020 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
| 1021 |
}
|
| 1022 |
|
| 1023 |
.btn-cancel:hover {
|
|
|
|
| 1221 |
|
| 1222 |
.preview-header {
|
| 1223 |
display: flex;
|
| 1224 |
+
flex-direction: column;
|
| 1225 |
+
gap: 0.75rem;
|
| 1226 |
margin-bottom: 1rem;
|
| 1227 |
padding-bottom: 0.75rem;
|
| 1228 |
border-bottom: 1px solid var(--border-color);
|
|
|
|
| 1232 |
font-family: var(--font-mono);
|
| 1233 |
color: var(--accent-purple);
|
| 1234 |
font-weight: 600;
|
| 1235 |
+
font-size: 0.9rem;
|
| 1236 |
+
word-break: break-all;
|
| 1237 |
+
line-height: 1.4;
|
| 1238 |
}
|
| 1239 |
|
| 1240 |
.preview-actions {
|
| 1241 |
display: flex;
|
| 1242 |
gap: 0.5rem;
|
| 1243 |
+
flex-wrap: wrap;
|
| 1244 |
}
|
| 1245 |
|
| 1246 |
/* ========================================
|