ai: Refac B/F. #4
Browse files* And address compliance at
https://huggingface.co/spaces/umint/ai/discussions/59#68ef44bf4b957bbf27720780
Signed-off-by: Hadad <hadad@linuxmail.org>
- README.md +0 -97
- components/assistant-ui/markdown-text.tsx +25 -6
- config.ts +2 -2
README.md
CHANGED
|
@@ -11,101 +11,4 @@ app_port: 3000
|
|
| 11 |
pinned: true
|
| 12 |
thumbnail: >-
|
| 13 |
https://cdn-uploads.huggingface.co/production/uploads/686e28b405d4ddcdd96adeb2/i9iufR3L-rgj39mk_B9QW.jpeg
|
| 14 |
-
# Used to promote this Hugging Face Space
|
| 15 |
-
models:
|
| 16 |
-
- hadadrjt/JARVIS
|
| 17 |
-
- agentica-org/DeepCoder-14B-Preview
|
| 18 |
-
- agentica-org/DeepSWE-Preview
|
| 19 |
-
- fka/awesome-chatgpt-prompts
|
| 20 |
-
- black-forest-labs/FLUX.1-Kontext-dev
|
| 21 |
-
- ChatDOC/OCRFlux-3B
|
| 22 |
-
- deepseek-ai/DeepSeek-R1
|
| 23 |
-
- deepseek-ai/DeepSeek-R1-0528
|
| 24 |
-
- deepseek-ai/DeepSeek-R1-Distill-Llama-70B
|
| 25 |
-
- deepseek-ai/DeepSeek-R1-Distill-Qwen-32B
|
| 26 |
-
- deepseek-ai/DeepSeek-R1-0528-Qwen3-8B
|
| 27 |
-
- deepseek-ai/DeepSeek-V3-0324
|
| 28 |
-
- google/gemma-3-1b-it
|
| 29 |
-
- google/gemma-3-27b-it
|
| 30 |
-
- google/gemma-3-4b-it
|
| 31 |
-
- google/gemma-3n-E4B-it
|
| 32 |
-
- google/gemma-3n-E4B-it-litert-preview
|
| 33 |
-
- google/medsiglip-448
|
| 34 |
-
- kyutai/tts-1.6b-en_fr
|
| 35 |
-
- meta-llama/Llama-3.1-8B-Instruct
|
| 36 |
-
- meta-llama/Llama-3.2-3B-Instruct
|
| 37 |
-
- meta-llama/Llama-3.3-70B-Instruct
|
| 38 |
-
- meta-llama/Llama-4-Maverick-17B-128E-Instruct
|
| 39 |
-
- meta-llama/Llama-4-Scout-17B-16E-Instruct
|
| 40 |
-
- microsoft/Phi-4-mini-instruct
|
| 41 |
-
- mistralai/Devstral-Small-2505
|
| 42 |
-
- mistralai/Mistral-Small-3.1-24B-Instruct-2503
|
| 43 |
-
- openai/webgpt_comparisons
|
| 44 |
-
- openai/whisper-large-v3-turbo
|
| 45 |
-
- openai/gpt-oss-120b
|
| 46 |
-
- openai/gpt-oss-20b
|
| 47 |
-
- Qwen/QwQ-32B
|
| 48 |
-
- Qwen/Qwen2.5-VL-32B-Instruct
|
| 49 |
-
- Qwen/Qwen2.5-VL-3B-Instruct
|
| 50 |
-
- Qwen/Qwen2.5-VL-72B-Instruct
|
| 51 |
-
- Qwen/Qwen3-235B-A22B
|
| 52 |
-
- THUDM/GLM-4.1V-9B-Thinking
|
| 53 |
-
- tngtech/DeepSeek-TNG-R1T2-Chimera
|
| 54 |
-
- moonshotai/Kimi-K2-Instruct
|
| 55 |
-
- Qwen/Qwen3-235B-A22B-Instruct-2507
|
| 56 |
-
- Qwen/Qwen3-Coder-480B-A35B-Instruct
|
| 57 |
-
- Qwen/Qwen3-235B-A22B-Thinking-2507
|
| 58 |
-
- zai-org/GLM-4.5
|
| 59 |
-
- zai-org/GLM-4.5-Air
|
| 60 |
-
- zai-org/GLM-4.5V
|
| 61 |
-
- deepseek-ai/DeepSeek-V3.1
|
| 62 |
-
- deepseek-ai/DeepSeek-V3.1-Base
|
| 63 |
-
- microsoft/VibeVoice-1.5B
|
| 64 |
-
- xai-org/grok-2
|
| 65 |
-
- Qwen/Qwen-Image-Edit
|
| 66 |
-
- ByteDance-Seed/Seed-OSS-36B-Instruct
|
| 67 |
-
- google/gemma-3-270m
|
| 68 |
-
- google/gemma-3-270m-it
|
| 69 |
-
- openbmb/MiniCPM-V-4_5
|
| 70 |
-
- tencent/Hunyuan-MT-7B
|
| 71 |
-
- meituan-longcat/LongCat-Flash-Chat
|
| 72 |
-
- Phr00t/WAN2.2-14B-Rapid-AllInOne
|
| 73 |
-
- apple/FastVLM-0.5B
|
| 74 |
-
- stepfun-ai/Step-Audio-2-mini
|
| 75 |
-
- tencent/SRPO
|
| 76 |
-
- baidu/ERNIE-4.5-21B-A3B-Thinking
|
| 77 |
-
- tencent/HunyuanImage-2.1
|
| 78 |
-
- Qwen/Qwen3-Next-80B-A3B-Instruct
|
| 79 |
-
- google/embeddinggemma-300m
|
| 80 |
-
- Qwen/Qwen3-Next-80B-A3B-Thinking
|
| 81 |
-
- LLM360/K2-Think
|
| 82 |
-
- IndexTeam/IndexTTS-2
|
| 83 |
-
- Turn your ideas into an image
|
| 84 |
-
- facebook/MobileLLM-R1-950M
|
| 85 |
-
- Alibaba-NLP/Tongyi-DeepResearch-30B-A3B
|
| 86 |
-
- openbmb/VoxCPM-0.5B
|
| 87 |
-
- Wan-AI/Wan2.2-Animate-14B
|
| 88 |
-
- decart-ai/Lucy-Edit-Dev
|
| 89 |
-
- ibm-granite/granite-docling-258M
|
| 90 |
-
- Qwen/Qwen3-Omni-30B-A3B-Instruct
|
| 91 |
-
- Qwen/Qwen-Image-Edit-2509
|
| 92 |
-
- deepseek-ai/DeepSeek-V3.1-Terminus
|
| 93 |
-
- Qwen/Qwen3-VL-235B-A22B-Thinking
|
| 94 |
-
- Qwen/Qwen3-VL-235B-A22B-Instruct
|
| 95 |
-
- Qwen/Qwen3-Omni-30B-A3B-Thinking
|
| 96 |
-
- deepseek-ai/DeepSeek-V3.2-Exp
|
| 97 |
-
- inclusionAI/Ring-1T-preview
|
| 98 |
-
- zai-org/GLM-4.6
|
| 99 |
-
- neuphonic/neutts-air
|
| 100 |
-
- ibm-granite/granite-4.0-h-small
|
| 101 |
-
- ServiceNow-AI/Apriel-1.5-15b-Thinker
|
| 102 |
-
- Qwen/Qwen3-VL-30B-A3B-Instruct
|
| 103 |
-
- ibm-granite/granite-4.0-micro
|
| 104 |
-
- chetwinlow1/Ovi
|
| 105 |
-
- inclusionAI/Ling-1T
|
| 106 |
-
- microsoft/UserLM-8b
|
| 107 |
-
# Used to promote this Hugging Face Space
|
| 108 |
-
datasets:
|
| 109 |
-
- fka/awesome-chatgpt-prompts
|
| 110 |
-
- openai/gdpval
|
| 111 |
---
|
|
|
|
| 11 |
pinned: true
|
| 12 |
thumbnail: >-
|
| 13 |
https://cdn-uploads.huggingface.co/production/uploads/686e28b405d4ddcdd96adeb2/i9iufR3L-rgj39mk_B9QW.jpeg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
---
|
components/assistant-ui/markdown-text.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
| 15 |
} from "@assistant-ui/react-markdown";
|
| 16 |
import remarkGfm from "remark-gfm";
|
| 17 |
import rehypeRaw from "rehype-raw";
|
| 18 |
-
import { type FC, memo, useState, useCallback } from "react";
|
| 19 |
import { CheckIcon, CopyIcon } from "lucide-react";
|
| 20 |
|
| 21 |
import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
|
|
@@ -92,10 +92,29 @@ TableWrapper.displayName = "TableWrapper";
|
|
| 92 |
|
| 93 |
const MemoizedSyntaxHighlighter = memo(SyntaxHighlighter);
|
| 94 |
|
| 95 |
-
const
|
| 96 |
if (typeof children === 'string') {
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
return children;
|
| 100 |
};
|
| 101 |
|
|
@@ -232,12 +251,12 @@ Table.displayName = "Table";
|
|
| 232 |
const Th = memo(({ className, children, ...props }: React.ThHTMLAttributes<HTMLTableCellElement>) => (
|
| 233 |
<th
|
| 234 |
className={cn(
|
| 235 |
-
"aui-md-th bg-muted px-4 py-2 text-left font-bold
|
| 236 |
className,
|
| 237 |
)}
|
| 238 |
{...props}
|
| 239 |
>
|
| 240 |
-
{
|
| 241 |
</th>
|
| 242 |
));
|
| 243 |
Th.displayName = "Th";
|
|
@@ -250,7 +269,7 @@ const Td = memo(({ className, children, ...props }: React.TdHTMLAttributes<HTMLT
|
|
| 250 |
)}
|
| 251 |
{...props}
|
| 252 |
>
|
| 253 |
-
{
|
| 254 |
</td>
|
| 255 |
));
|
| 256 |
Td.displayName = "Td";
|
|
|
|
| 15 |
} from "@assistant-ui/react-markdown";
|
| 16 |
import remarkGfm from "remark-gfm";
|
| 17 |
import rehypeRaw from "rehype-raw";
|
| 18 |
+
import { type FC, memo, useState, useCallback, Fragment } from "react";
|
| 19 |
import { CheckIcon, CopyIcon } from "lucide-react";
|
| 20 |
|
| 21 |
import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
|
|
|
|
| 92 |
|
| 93 |
const MemoizedSyntaxHighlighter = memo(SyntaxHighlighter);
|
| 94 |
|
| 95 |
+
const processTableContent = (children: React.ReactNode): React.ReactNode => {
|
| 96 |
if (typeof children === 'string') {
|
| 97 |
+
const parts = children
|
| 98 |
+
.split(/(?:<br\s*\/?>|\n)+/i)
|
| 99 |
+
.map(part => part.trim())
|
| 100 |
+
.filter(part => part.length > 0);
|
| 101 |
+
|
| 102 |
+
if (parts.length === 0) return '';
|
| 103 |
+
if (parts.length === 1) return parts[0];
|
| 104 |
+
|
| 105 |
+
return parts.reduce<React.ReactNode[]>((acc, part, index) => {
|
| 106 |
+
if (index > 0) acc.push(<br key={`br-${index}`} />);
|
| 107 |
+
acc.push(part);
|
| 108 |
+
return acc;
|
| 109 |
+
}, []);
|
| 110 |
}
|
| 111 |
+
|
| 112 |
+
if (Array.isArray(children)) {
|
| 113 |
+
return children.map((child, index) => (
|
| 114 |
+
<Fragment key={index}>{processTableContent(child)}</Fragment>
|
| 115 |
+
));
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
return children;
|
| 119 |
};
|
| 120 |
|
|
|
|
| 251 |
const Th = memo(({ className, children, ...props }: React.ThHTMLAttributes<HTMLTableCellElement>) => (
|
| 252 |
<th
|
| 253 |
className={cn(
|
| 254 |
+
"aui-md-th bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [&[align=center]]:text-center [&[align=right]]:text-right",
|
| 255 |
className,
|
| 256 |
)}
|
| 257 |
{...props}
|
| 258 |
>
|
| 259 |
+
{processTableContent(children)}
|
| 260 |
</th>
|
| 261 |
));
|
| 262 |
Th.displayName = "Th";
|
|
|
|
| 269 |
)}
|
| 270 |
{...props}
|
| 271 |
>
|
| 272 |
+
{processTableContent(children)}
|
| 273 |
</td>
|
| 274 |
));
|
| 275 |
Td.displayName = "Td";
|
config.ts
CHANGED
|
@@ -8,7 +8,7 @@ export default {
|
|
| 8 |
baseUrl: process.env.OPENAI_API_BASE_URL, // /v1
|
| 9 |
key: process.env.OPENAI_API_KEY,
|
| 10 |
model: "limited/gpt-5-chat-latest",
|
| 11 |
-
maxRetries:
|
| 12 |
-
timeout:
|
| 13 |
}
|
| 14 |
};
|
|
|
|
| 8 |
baseUrl: process.env.OPENAI_API_BASE_URL, // /v1
|
| 9 |
key: process.env.OPENAI_API_KEY,
|
| 10 |
model: "limited/gpt-5-chat-latest",
|
| 11 |
+
maxRetries: 3,
|
| 12 |
+
timeout: 40000 // 40 seconds
|
| 13 |
}
|
| 14 |
};
|