Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🔨 chore: improve code (#9626)

Arvin Xu143784b47445
diff --git a/package.json b/package.json
index a4c042240b5..076d6d9dc99 100644
--- a/package.json
+++ b/package.json
@@ -140,7 +140,7 @@
"@formkit/auto-animate": "^0.9.0",
"@google/genai": "^1.19.0",
"@huggingface/inference": "^2.8.1",
- "@icons-pack/react-simple-icons": "9.6.0",
+ "@icons-pack/react-simple-icons": "^13.8.0",
"@khmyznikov/pwa-install": "0.3.9",
"@langchain/community": "^0.3.55",
"@lobechat/agent-runtime": "workspace:*",
diff --git a/packages/model-bank/src/aiModels/aihubmix.ts b/packages/model-bank/src/aiModels/aihubmix.ts
index 8044bfee4b8..f28fc6a0c3c 100644
--- a/packages/model-bank/src/aiModels/aihubmix.ts
+++ b/packages/model-bank/src/aiModels/aihubmix.ts
@@ -34,8 +34,7 @@ const aihubmixModels: AIChatModelCard[] = [
vision: true,
},
contextWindowTokens: 400_000,
- description:
- 'GPT-5 Codex 是一个针对 Codex 或类似环境中的代理编码任务优化的 GPT-5 版本。',
+ description: 'GPT-5 Codex 是一个针对 Codex 或类似环境中的代理编码任务优化的 GPT-5 版本。',
displayName: 'GPT-5 Codex',
id: 'gpt-5-codex',
maxOutput: 128_000,
@@ -58,6 +57,7 @@ const aihubmixModels: AIChatModelCard[] = [
functionCall: true,
reasoning: true,
search: true,
+ structuredOutput: true,
vision: true,
},
contextWindowTokens: 400_000,
@@ -86,6 +86,7 @@ const aihubmixModels: AIChatModelCard[] = [
functionCall: true,
reasoning: true,
search: true,
+ structuredOutput: true,
vision: true,
},
contextWindowTokens: 400_000,
@@ -136,6 +137,7 @@ const aihubmixModels: AIChatModelCard[] = [
{
abilities: {
reasoning: true,
+ structuredOutput: false,
vision: true,
},
contextWindowTokens: 400_000,
@@ -382,8 +384,7 @@ const aihubmixModels: AIChatModelCard[] = [
vision: true,
},
contextWindowTokens: 2_000_000,
- description:
- '我们很高兴发布 Grok 4 Fast,这是我们在成本效益推理模型方面的最新进展。',
+ description: '我们很高兴发布 Grok 4 Fast,这是我们在成本效益推理模型方面的最新进展。',
displayName: 'Grok 4 Fast (Non-Reasoning)',
id: 'grok-4-fast-non-reasoning',
pricing: {
@@ -406,8 +407,7 @@ const aihubmixModels: AIChatModelCard[] = [
vision: true,
},
contextWindowTokens: 2_000_000,
- description:
- '我们很高兴发布 Grok 4 Fast,这是我们在成本效益推理模型方面的最新进展。',
+ description: '我们很高兴发布 Grok 4 Fast,这是我们在成本效益推理模型方面的最新进展。',
displayName: 'Grok 4 Fast',
id: 'grok-4-fast-reasoning',
pricing: {
@@ -489,6 +489,7 @@ const aihubmixModels: AIChatModelCard[] = [
functionCall: true,
reasoning: true,
search: true,
+ structuredOutput: true,
vision: true,
},
contextWindowTokens: 200_000,
@@ -523,6 +524,7 @@ const aihubmixModels: AIChatModelCard[] = [
functionCall: true,
reasoning: true,
search: true,
+ structuredOutput: true,
vision: true,
},
contextWindowTokens: 200_000,
@@ -556,6 +558,7 @@ const aihubmixModels: AIChatModelCard[] = [
functionCall: true,
reasoning: true,
search: true,
+ structuredOutput: true,
vision: true,
},
contextWindowTokens: 200_000,
@@ -848,6 +851,7 @@ const aihubmixModels: AIChatModelCard[] = [
functionCall: true,
reasoning: true,
search: true,
+ structuredOutput: true,
vision: true,
},
contextWindowTokens: 1_048_576 + 65_536,
@@ -876,6 +880,7 @@ const aihubmixModels: AIChatModelCard[] = [
functionCall: true,
reasoning: true,
search: true,
+ structuredOutput: true,
vision: true,
},
contextWindowTokens: 1_048_576 + 65_536,
diff --git a/packages/model-bank/src/aiModels/anthropic.ts b/packages/model-bank/src/aiModels/anthropic.ts
index 208d340d4aa..3965e2bdf21 100644
--- a/packages/model-bank/src/aiModels/anthropic.ts
+++ b/packages/model-bank/src/aiModels/anthropic.ts
@@ -6,6 +6,7 @@ const anthropicChatModels: AIChatModelCard[] = [
functionCall: true,
reasoning: true,
search: true,
+ structuredOutput: true,
vision: true,
},
contextWindowTokens: 200_000,
diff --git a/packages/model-bank/src/aiModels/azure.ts b/packages/model-bank/src/aiModels/azure.ts
index 8e4eca465c0..0bf3cd76712 100644
--- a/packages/model-bank/src/aiModels/azure.ts
+++ b/packages/model-bank/src/aiModels/azure.ts
@@ -56,6 +56,7 @@ const azureChatModels: AIChatModelCard[] = [
{
abilities: {
functionCall: true,
+ structuredOutput: true,
vision: true,
},
config: {
diff --git a/packages/model-bank/src/aiModels/bedrock.ts b/packages/model-bank/src/aiModels/bedrock.ts
index e1b9ec18365..7cffcf24622 100644
--- a/packages/model-bank/src/aiModels/bedrock.ts
+++ b/packages/model-bank/src/aiModels/bedrock.ts
@@ -26,6 +26,7 @@ const bedrockChatModels: AIChatModelCard[] = [
abilities: {
functionCall: true,
reasoning: true,
+ structuredOutput: true,
vision: true,
},
contextWindowTokens: 200_000,
diff --git a/packages/model-bank/src/aiModels/deepseek.ts b/packages/model-bank/src/aiModels/deepseek.ts
index aa3af269826..3aefedab550 100644
--- a/packages/model-bank/src/aiModels/deepseek.ts
+++ b/packages/model-bank/src/aiModels/deepseek.ts
@@ -5,6 +5,7 @@ const deepseekChatModels: AIChatModelCard[] = [
{
abilities: {
functionCall: true,
+ structuredOutput: true,
},
contextWindowTokens: 131_072,
description:
diff --git a/packages/model-bank/src/aiModels/google.ts b/packages/model-bank/src/aiModels/google.ts
index 10953530305..a6307e11a39 100644
--- a/packages/model-bank/src/aiModels/google.ts
+++ b/packages/model-bank/src/aiModels/google.ts
@@ -12,6 +12,7 @@ const googleChatModels: AIChatModelCard[] = [
functionCall: true,
reasoning: true,
search: true,
+ structuredOutput: true,
video: true,
vision: true,
},
diff --git a/packages/model-bank/src/aiModels/moonshot.ts b/packages/model-bank/src/aiModels/moonshot.ts
index e9e973c89ff..1a8d6b98c16 100644
--- a/packages/model-bank/src/aiModels/moonshot.ts
+++ b/packages/model-bank/src/aiModels/moonshot.ts
@@ -5,6 +5,7 @@ const moonshotChatModels: AIChatModelCard[] = [
{
abilities: {
functionCall: true,
+ structuredOutput: true,
},
contextWindowTokens: 262_144,
description:
diff --git a/packages/model-bank/src/aiModels/openai.ts b/packages/model-bank/src/aiModels/openai.ts
index 854e2275048..4ae5798a533 100644
--- a/packages/model-bank/src/aiModels/openai.ts
+++ b/packages/model-bank/src/aiModels/openai.ts
@@ -74,6 +74,7 @@ export const openaiChatModels: AIChatModelCard[] = [
functionCall: true,
reasoning: true,
search: true,
+ structuredOutput: true,
vision: true,
},
contextWindowTokens: 400_000,
@@ -102,6 +103,7 @@ export const openaiChatModels: AIChatModelCard[] = [
functionCall: true,
reasoning: true,
search: true,
+ structuredOutput: true,
vision: true,
},
contextWindowTokens: 400_000,
@@ -1074,15 +1076,15 @@ export const openaiImageModels: AIImageModelCard[] = [
{
lookup: {
prices: {
- 'low_1024x1024': 0.011,
- 'low_1024x1536': 0.016,
- 'low_1536x1024': 0.016,
- 'medium_1024x1024': 0.042,
- 'medium_1024x1536': 0.063,
- 'medium_1536x1024': 0.063,
- 'high_1024x1024': 0.167,
- 'high_1024x1536': 0.25,
- 'high_1536x1024': 0.25,
+ high_1024x1024: 0.167,
+ high_1024x1536: 0.25,
+ high_1536x1024: 0.25,
+ low_1024x1024: 0.011,
+ low_1024x1536: 0.016,
+ low_1536x1024: 0.016,
+ medium_1024x1024: 0.042,
+ medium_1024x1536: 0.063,
+ medium_1536x1024: 0.063,
},
pricingParams: ['quality', 'size'],
},
@@ -1111,12 +1113,12 @@ export const openaiImageModels: AIImageModelCard[] = [
{
lookup: {
prices: {
- 'low_1024x1024': 0.005,
- 'low_1024x1536': 0.006,
- 'low_1536x1024': 0.006,
- 'medium_1024x1024': 0.011,
- 'medium_1024x1536': 0.015,
- 'medium_1536x1024': 0.015,
+ low_1024x1024: 0.005,
+ low_1024x1536: 0.006,
+ low_1536x1024: 0.006,
+ medium_1024x1024: 0.011,
+ medium_1024x1536: 0.015,
+ medium_1536x1024: 0.015,
},
pricingParams: ['quality', 'size'],
},
@@ -1126,8 +1128,8 @@ export const openaiImageModels: AIImageModelCard[] = [
},
],
},
- resolutions: ['1024x1024', '1024x1536', '1536x1024'],
releasedAt: '2025-10-06',
+ resolutions: ['1024x1024', '1024x1536', '1536x1024'],
type: 'image',
},
{
diff --git a/packages/model-bank/src/types/aiModel.ts b/packages/model-bank/src/types/aiModel.ts
index 0dfdb432473..f5af4e899f6 100644
--- a/packages/model-bank/src/types/aiModel.ts
+++ b/packages/model-bank/src/types/aiModel.ts
@@ -46,6 +46,10 @@ export interface ModelAbilities {
* whether model supports search web
*/
search?: boolean;
+ /**
+ * whether model supports structured output
+ */
+ structuredOutput?: boolean;
/**
* whether model supports video
*/
diff --git a/packages/model-runtime/src/types/chat.ts b/packages/model-runtime/src/types/chat.ts
index 012a70df97c..e13883eb9ef 100644
--- a/packages/model-runtime/src/types/chat.ts
+++ b/packages/model-runtime/src/types/chat.ts
@@ -4,6 +4,17 @@ import { MessageToolCall, MessageToolCallChunk } from './toolsCalling';
export type LLMRoleType = 'user' | 'system' | 'assistant' | 'function' | 'tool';
+export type ChatResponseFormat =
+ | { type: 'json_object' }
+ | {
+ json_schema: {
+ name: string;
+ schema: Record<string, any>;
+ strict?: boolean;
+ };
+ type: 'json_schema';
+ };
+
interface UserMessageContentPartThinking {
signature: string;
thinking: string;
@@ -87,6 +98,7 @@ export interface ChatStreamPayload {
};
reasoning_effort?: 'minimal' | 'low' | 'medium' | 'high';
responseMode?: 'stream' | 'json';
+ response_format?: ChatResponseFormat;
/**
* @title 是否开启流式请求
* @default true
diff --git a/packages/web-crawler/src/crawImpl/__tests__/naive.test.ts b/packages/web-crawler/src/crawImpl/__tests__/naive.test.ts
index 3a697e06b25..2f8776e3338 100644
--- a/packages/web-crawler/src/crawImpl/__tests__/naive.test.ts
+++ b/packages/web-crawler/src/crawImpl/__tests__/naive.test.ts
@@ -13,9 +13,9 @@ vi.mock('../../utils/withTimeout', () => ({
withTimeout: vi.fn(),
}));
-// Mock fetch globally
-const mockFetch = vi.fn();
-global.fetch = mockFetch;
+vi.mock('ssrf-safe-fetch', () => ({
+ ssrfSafeFetch: vi.fn(),
+}));
describe('naive crawler', () => {
beforeEach(() => {
diff --git a/packages/web-crawler/src/crawImpl/naive.ts b/packages/web-crawler/src/crawImpl/naive.ts
index 5a20ef8135a..6b7063cfcca 100755
--- a/packages/web-crawler/src/crawImpl/naive.ts
+++ b/packages/web-crawler/src/crawImpl/naive.ts
@@ -1,5 +1,6 @@
-import { CrawlImpl, CrawlSuccessResult } from '../type';
import { ssrfSafeFetch } from 'ssrf-safe-fetch';
+
+import { CrawlImpl, CrawlSuccessResult } from '../type';
import { NetworkConnectionError, PageNotFoundError, TimeoutError } from '../utils/errorType';
import { htmlToMarkdown } from '../utils/htmlToMarkdown';
import { DEFAULT_TIMEOUT, withTimeout } from '../utils/withTimeout';
diff --git a/src/app/[variants]/(main)/discover/(detail)/features/ShareButton.tsx b/src/app/[variants]/(main)/discover/(detail)/features/ShareButton.tsx
index 3959f5c869c..5d453ac5411 100644
--- a/src/app/[variants]/(main)/discover/(detail)/features/ShareButton.tsx
+++ b/src/app/[variants]/(main)/discover/(detail)/features/ShareButton.tsx
@@ -70,7 +70,7 @@ interface ShareButtonProps extends ButtonProps {
}
const ShareButton = memo<ShareButtonProps>(({ meta, ...rest }) => {
- const { x, reddit, telegram, whatsapp, mastodon, linkedin, weibo } = useShare({
+ const { x, reddit, telegram, whatsapp, mastodon, weibo } = useShare({
avatar: '',
desc: '',
hashtags: [],
@@ -118,16 +118,19 @@ const ShareButton = memo<ShareButtonProps>(({ meta, ...rest }) => {
</Center>
</Flexbox>
<Flexbox align={'center'} gap={8} horizontal justify={'center'} wrap={'wrap'}>
- {[x, reddit, telegram, whatsapp, mastodon, linkedin, weibo].map((item) => (
- <Link href={item.link} key={item.title} target={'_blank'}>
- <ActionIcon
- className={styles.icon}
- icon={item.icon as any}
- size={{ blockSize: 36, borderRadius: 18, size: 16 }}
- title={item.title}
- />
- </Link>
- ))}
+ {[x, reddit, telegram, whatsapp, mastodon, weibo].map(
+ (item) =>
+ item.icon && (
+ <Link href={item.link} key={item.title} target={'_blank'}>
+ <ActionIcon
+ className={styles.icon}
+ icon={item.icon}
+ size={{ blockSize: 36, borderRadius: 18, size: 16 }}
+ title={item.title}
+ />
+ </Link>
+ ),
+ )}
</Flexbox>
<Flexbox align={'center'} gap={8} horizontal width={'100%'}>
<Input value={meta.url} variant={'filled'} />
diff --git a/src/components/BrowserIcon/index.tsx b/src/components/BrowserIcon/index.tsx
index c5eef7db34a..32abcff1057 100644
--- a/src/components/BrowserIcon/index.tsx
+++ b/src/components/BrowserIcon/index.tsx
@@ -2,7 +2,6 @@ import {
SiBrave,
SiFirefox,
SiGooglechrome,
- SiMicrosoftedge,
SiOpera,
SiSafari,
SiSamsung,
@@ -13,7 +12,6 @@ const lastVersion = {
'Brave': SiBrave,
'Chrome': SiGooglechrome,
'Chromium': SiGooglechrome,
- 'Edge': SiMicrosoftedge,
'Firefox': SiFirefox,
'Mobile Safari': SiSafari,
'Opera': SiOpera,
diff --git a/src/hooks/useShare.tsx b/src/hooks/useShare.tsx
index d4f011175a0..127179db725 100644
--- a/src/hooks/useShare.tsx
+++ b/src/hooks/useShare.tsx
@@ -1,5 +1,4 @@
import {
- SiLinkedin,
SiMastodon,
SiReddit,
SiSinaweibo,
@@ -154,7 +153,6 @@ export const useShare = ({
return {
linkedin: {
- icon: SiLinkedin,
link: genLinkdinLink(),
title: 'Linkedin',
},