Spaces:
Running
Running
image upload and new model
Browse files
frontend/src/app/page.tsx
CHANGED
|
@@ -67,7 +67,11 @@ export default function Home() {
|
|
| 67 |
};
|
| 68 |
|
| 69 |
// Check if current model supports images
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
// Debug log for image support
|
| 73 |
useEffect(() => {
|
|
|
|
| 67 |
};
|
| 68 |
|
| 69 |
// Check if current model supports images
|
| 70 |
+
// Show immediately for GLM-4.6V even before models load
|
| 71 |
+
const currentModelSupportsImages =
|
| 72 |
+
selectedModel === 'zai-org/GLM-4.6V:zai-org' ||
|
| 73 |
+
models.find(m => m.id === selectedModel)?.supports_images ||
|
| 74 |
+
false;
|
| 75 |
|
| 76 |
// Debug log for image support
|
| 77 |
useEffect(() => {
|
frontend/src/components/ControlPanel.tsx
CHANGED
|
@@ -196,7 +196,14 @@ export default function ControlPanel({
|
|
| 196 |
: 'hover:bg-[#2d2d2f]'
|
| 197 |
}`}
|
| 198 |
>
|
| 199 |
-
<div className="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
{model.description && (
|
| 201 |
<div className="text-[10px] text-[#86868b] mt-0.5 leading-relaxed">
|
| 202 |
{model.description}
|
|
|
|
| 196 |
: 'hover:bg-[#2d2d2f]'
|
| 197 |
}`}
|
| 198 |
>
|
| 199 |
+
<div className="flex items-center justify-between gap-2">
|
| 200 |
+
<span className="text-sm text-[#f5f5f7]">{model.name}</span>
|
| 201 |
+
{model.id === 'zai-org/GLM-4.6V:zai-org' && (
|
| 202 |
+
<span className="px-1.5 py-0.5 bg-gradient-to-r from-purple-500 to-pink-500 text-white text-[9px] font-bold rounded uppercase flex-shrink-0">
|
| 203 |
+
NEW
|
| 204 |
+
</span>
|
| 205 |
+
)}
|
| 206 |
+
</div>
|
| 207 |
{model.description && (
|
| 208 |
<div className="text-[10px] text-[#86868b] mt-0.5 leading-relaxed">
|
| 209 |
{model.description}
|
frontend/src/components/LandingPage.tsx
CHANGED
|
@@ -218,7 +218,18 @@ export default function LandingPage({
|
|
| 218 |
};
|
| 219 |
|
| 220 |
// Check if current model supports images
|
| 221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
|
| 223 |
const loadTrendingApps = async () => {
|
| 224 |
try {
|
|
@@ -819,7 +830,14 @@ Note: After generating the redesign, I will create a Pull Request on the origina
|
|
| 819 |
: 'hover:bg-[#2d2d2f]'
|
| 820 |
}`}
|
| 821 |
>
|
| 822 |
-
<div className="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 823 |
</button>
|
| 824 |
))}
|
| 825 |
</div>
|
|
@@ -1064,42 +1082,45 @@ Note: After generating the redesign, I will create a Pull Request on the origina
|
|
| 1064 |
</div>
|
| 1065 |
</div>
|
| 1066 |
|
| 1067 |
-
{/*
|
| 1068 |
-
|
| 1069 |
-
|
| 1070 |
-
|
| 1071 |
-
|
| 1072 |
-
|
| 1073 |
-
|
| 1074 |
-
|
| 1075 |
-
|
| 1076 |
-
|
| 1077 |
-
|
| 1078 |
-
|
| 1079 |
-
|
| 1080 |
-
|
| 1081 |
-
|
| 1082 |
-
|
| 1083 |
-
|
| 1084 |
-
|
| 1085 |
-
|
| 1086 |
-
|
| 1087 |
-
|
| 1088 |
-
|
| 1089 |
-
|
| 1090 |
-
|
| 1091 |
-
|
| 1092 |
-
|
| 1093 |
-
|
| 1094 |
-
|
| 1095 |
-
|
| 1096 |
-
|
| 1097 |
-
|
| 1098 |
-
|
| 1099 |
-
|
| 1100 |
-
|
| 1101 |
-
|
| 1102 |
-
|
|
|
|
|
|
|
|
|
|
| 1103 |
</div>
|
| 1104 |
</div>
|
| 1105 |
|
|
|
|
| 218 |
};
|
| 219 |
|
| 220 |
// Check if current model supports images
|
| 221 |
+
// Show immediately for GLM-4.6V even before models load
|
| 222 |
+
const currentModelSupportsImages =
|
| 223 |
+
selectedModel === 'zai-org/GLM-4.6V:zai-org' ||
|
| 224 |
+
models.find(m => m.id === selectedModel)?.supports_images ||
|
| 225 |
+
false;
|
| 226 |
+
|
| 227 |
+
// Debug logging
|
| 228 |
+
useEffect(() => {
|
| 229 |
+
console.log('[LandingPage] Selected model:', selectedModel);
|
| 230 |
+
console.log('[LandingPage] Models loaded:', models.length);
|
| 231 |
+
console.log('[LandingPage] Supports images:', currentModelSupportsImages);
|
| 232 |
+
}, [selectedModel, models, currentModelSupportsImages]);
|
| 233 |
|
| 234 |
const loadTrendingApps = async () => {
|
| 235 |
try {
|
|
|
|
| 830 |
: 'hover:bg-[#2d2d2f]'
|
| 831 |
}`}
|
| 832 |
>
|
| 833 |
+
<div className="flex items-center justify-between gap-2">
|
| 834 |
+
<span className="text-xs font-medium text-[#f5f5f7]">{model.name}</span>
|
| 835 |
+
{model.id === 'zai-org/GLM-4.6V:zai-org' && (
|
| 836 |
+
<span className="px-1.5 py-0.5 bg-gradient-to-r from-purple-500 to-pink-500 text-white text-[9px] font-bold rounded uppercase">
|
| 837 |
+
NEW
|
| 838 |
+
</span>
|
| 839 |
+
)}
|
| 840 |
+
</div>
|
| 841 |
</button>
|
| 842 |
))}
|
| 843 |
</div>
|
|
|
|
| 1082 |
</div>
|
| 1083 |
</div>
|
| 1084 |
|
| 1085 |
+
{/* Right side - Image upload + Send button group */}
|
| 1086 |
+
<div className="flex items-center gap-2">
|
| 1087 |
+
{/* Image Upload Button (only if model supports images) */}
|
| 1088 |
+
{currentModelSupportsImages && (
|
| 1089 |
+
<>
|
| 1090 |
+
<input
|
| 1091 |
+
ref={fileInputRef}
|
| 1092 |
+
type="file"
|
| 1093 |
+
accept="image/*"
|
| 1094 |
+
onChange={handleImageUpload}
|
| 1095 |
+
className="hidden"
|
| 1096 |
+
disabled={!isAuthenticated}
|
| 1097 |
+
/>
|
| 1098 |
+
<button
|
| 1099 |
+
type="button"
|
| 1100 |
+
onClick={() => fileInputRef.current?.click()}
|
| 1101 |
+
disabled={!isAuthenticated}
|
| 1102 |
+
className="p-2 bg-[#1d1d1f] text-[#f5f5f7] rounded-full hover:bg-[#424245] disabled:opacity-30 disabled:cursor-not-allowed transition-all active:scale-95"
|
| 1103 |
+
title="Upload image"
|
| 1104 |
+
>
|
| 1105 |
+
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2.5}>
|
| 1106 |
+
<path strokeLinecap="round" strokeLinejoin="round" d="M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z" />
|
| 1107 |
+
</svg>
|
| 1108 |
+
</button>
|
| 1109 |
+
</>
|
| 1110 |
+
)}
|
| 1111 |
+
|
| 1112 |
+
{/* Send button - Apple style */}
|
| 1113 |
+
<button
|
| 1114 |
+
type="submit"
|
| 1115 |
+
disabled={!prompt.trim() || !isAuthenticated}
|
| 1116 |
+
className="p-2 bg-white text-[#1d1d1f] rounded-full hover:bg-[#f5f5f7] disabled:opacity-30 disabled:cursor-not-allowed transition-all active:scale-95 shadow-lg"
|
| 1117 |
+
title="Send"
|
| 1118 |
+
>
|
| 1119 |
+
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2.5}>
|
| 1120 |
+
<path strokeLinecap="round" strokeLinejoin="round" d="M5 12h14M12 5l7 7-7 7" />
|
| 1121 |
+
</svg>
|
| 1122 |
+
</button>
|
| 1123 |
+
</div>
|
| 1124 |
</div>
|
| 1125 |
</div>
|
| 1126 |
|