mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-31 14:09:42 +07:00
💄 style: Fully support Gemini 3.0 model (#10292)
* feat: 添加 Gemini 3 Pro 模型并移除 Gemini 2.0 Flash 预览模型 * feat: 添加思考水平功能,更新相关模型和配置 * feat: 添加 Gemini 3 Pro 模型并移除旧版 Gemini 2.5 Flash 和 Flash-Lite 模型 * feat: 添加 Gemini 3 Pro 预览模型及其相关配置 * fix: 调整 ThinkingLevelSlider 组件的最小宽度为 130 * fix: 修正对 3.0 模型的思考级别判断条件
This commit is contained in:
@@ -986,6 +986,66 @@ const aihubmixModels: AIChatModelCard[] = [
|
||||
},
|
||||
type: 'chat',
|
||||
},
|
||||
{
|
||||
abilities: {
|
||||
functionCall: true,
|
||||
reasoning: true,
|
||||
search: true,
|
||||
video: true,
|
||||
vision: true,
|
||||
},
|
||||
contextWindowTokens: 1_048_576 + 65_536,
|
||||
description:
|
||||
'Gemini 3 Pro 是 Google 最智能的模型,具有 SOTA 推理和多模式理解,以及强大的代理和氛围编码功能。',
|
||||
displayName: 'Gemini 3 Pro Preview',
|
||||
enabled: true,
|
||||
id: 'gemini-3-pro-preview',
|
||||
maxOutput: 65_536,
|
||||
pricing: {
|
||||
units: [
|
||||
{
|
||||
name: 'textInput_cacheRead',
|
||||
strategy: 'tiered',
|
||||
tiers: [
|
||||
{ rate: 0.2, upTo: 200_000 },
|
||||
{ rate: 0.4, upTo: 'infinity' },
|
||||
],
|
||||
unit: 'millionTokens',
|
||||
},
|
||||
{
|
||||
name: 'textInput',
|
||||
strategy: 'tiered',
|
||||
tiers: [
|
||||
{ rate: 2, upTo: 200_000 },
|
||||
{ rate: 4, upTo: 'infinity' },
|
||||
],
|
||||
unit: 'millionTokens',
|
||||
},
|
||||
{
|
||||
name: 'textOutput',
|
||||
strategy: 'tiered',
|
||||
tiers: [
|
||||
{ rate: 12, upTo: 200_000 },
|
||||
{ rate: 18, upTo: 'infinity' },
|
||||
],
|
||||
unit: 'millionTokens',
|
||||
},
|
||||
{
|
||||
lookup: { prices: { '1h': 4.5 }, pricingParams: ['ttl'] },
|
||||
name: 'textInput_cacheWrite',
|
||||
strategy: 'lookup',
|
||||
unit: 'millionTokens',
|
||||
},
|
||||
],
|
||||
},
|
||||
releasedAt: '2025-11-18',
|
||||
settings: {
|
||||
extendParams: ['thinkingLevel', 'urlContext'],
|
||||
searchImpl: 'params',
|
||||
searchProvider: 'google',
|
||||
},
|
||||
type: 'chat',
|
||||
},
|
||||
{
|
||||
abilities: {
|
||||
functionCall: true,
|
||||
@@ -998,7 +1058,6 @@ const aihubmixModels: AIChatModelCard[] = [
|
||||
description:
|
||||
'Gemini 2.5 Pro 是 Google 最先进的思维模型,能够对代码、数学和STEM领域的复杂问题进行推理,以及使用长上下文分析大型数据集、代码库和文档。',
|
||||
displayName: 'Gemini 2.5 Pro',
|
||||
enabled: true,
|
||||
id: 'gemini-2.5-pro',
|
||||
maxOutput: 65_536,
|
||||
pricing: {
|
||||
|
||||
@@ -123,8 +123,8 @@ const googleChatModels: AIChatModelCard[] = [
|
||||
},
|
||||
contextWindowTokens: 1_048_576 + 65_536,
|
||||
description:
|
||||
'Gemini 3.0 Pro Preview 是 Google 最先进的思维模型,能够对代码、数学和STEM领域的复杂问题进行推理,以及使用长上下文分析大型数据集、代码库和文档。',
|
||||
displayName: 'Gemini 3.0 Pro Preview',
|
||||
'Gemini 3 Pro 是 全球最佳的多模态理解模型,也是 Google 迄今为止最强大的智能体和氛围编程模型,提供更丰富的视觉效果和更深层次的交互性,所有这些都建立在最先进的推理能力基础之上。',
|
||||
displayName: 'Gemini 3 Pro Preview',
|
||||
enabled: true,
|
||||
id: 'gemini-3-pro-preview',
|
||||
maxOutput: 65_536,
|
||||
@@ -134,8 +134,8 @@ const googleChatModels: AIChatModelCard[] = [
|
||||
name: 'textInput_cacheRead',
|
||||
strategy: 'tiered',
|
||||
tiers: [
|
||||
{ rate: 0.20, upTo: 200_000 },
|
||||
{ rate: 0.40, upTo: 'infinity' },
|
||||
{ rate: 0.2, upTo: 200_000 },
|
||||
{ rate: 0.4, upTo: 'infinity' },
|
||||
],
|
||||
unit: 'millionTokens',
|
||||
},
|
||||
@@ -143,8 +143,8 @@ const googleChatModels: AIChatModelCard[] = [
|
||||
name: 'textInput',
|
||||
strategy: 'tiered',
|
||||
tiers: [
|
||||
{ rate: 2.0, upTo: 200_000 },
|
||||
{ rate: 4.0, upTo: 'infinity' },
|
||||
{ rate: 2, upTo: 200_000 },
|
||||
{ rate: 4, upTo: 'infinity' },
|
||||
],
|
||||
unit: 'millionTokens',
|
||||
},
|
||||
@@ -152,16 +152,22 @@ const googleChatModels: AIChatModelCard[] = [
|
||||
name: 'textOutput',
|
||||
strategy: 'tiered',
|
||||
tiers: [
|
||||
{ rate: 12.0, upTo: 200_000 },
|
||||
{ rate: 18.0, upTo: 'infinity' },
|
||||
{ rate: 12, upTo: 200_000 },
|
||||
{ rate: 18, upTo: 'infinity' },
|
||||
],
|
||||
unit: 'millionTokens',
|
||||
},
|
||||
{
|
||||
lookup: { prices: { '1h': 4.5 }, pricingParams: ['ttl'] },
|
||||
name: 'textInput_cacheWrite',
|
||||
strategy: 'lookup',
|
||||
unit: 'millionTokens',
|
||||
},
|
||||
],
|
||||
},
|
||||
releasedAt: '2025-11-18',
|
||||
settings: {
|
||||
extendParams: ['thinkingBudget', 'urlContext'],
|
||||
extendParams: ['thinkingLevel', 'urlContext'],
|
||||
searchImpl: 'params',
|
||||
searchProvider: 'google',
|
||||
},
|
||||
@@ -211,6 +217,12 @@ const googleChatModels: AIChatModelCard[] = [
|
||||
],
|
||||
unit: 'millionTokens',
|
||||
},
|
||||
{
|
||||
lookup: { prices: { '1h': 4.5 }, pricingParams: ['ttl'] },
|
||||
name: 'textInput_cacheWrite',
|
||||
strategy: 'lookup',
|
||||
unit: 'millionTokens',
|
||||
},
|
||||
],
|
||||
},
|
||||
releasedAt: '2025-06-17',
|
||||
@@ -383,34 +395,6 @@ const googleChatModels: AIChatModelCard[] = [
|
||||
},
|
||||
type: 'chat',
|
||||
},
|
||||
{
|
||||
abilities: {
|
||||
functionCall: true,
|
||||
reasoning: true,
|
||||
search: true,
|
||||
video: true,
|
||||
vision: true,
|
||||
},
|
||||
contextWindowTokens: 1_048_576 + 65_536,
|
||||
description: 'Gemini 2.5 Flash Preview 是 Google 性价比最高的模型,提供全面的功能。',
|
||||
displayName: 'Gemini 2.5 Flash Preview 05-20',
|
||||
id: 'gemini-2.5-flash-preview-05-20',
|
||||
maxOutput: 65_536,
|
||||
pricing: {
|
||||
units: [
|
||||
{ name: 'textInput_cacheRead', rate: 0.0375, strategy: 'fixed', unit: 'millionTokens' },
|
||||
{ name: 'textInput', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
|
||||
{ name: 'textOutput', rate: 3.5, strategy: 'fixed', unit: 'millionTokens' },
|
||||
],
|
||||
},
|
||||
releasedAt: '2025-05-20',
|
||||
settings: {
|
||||
extendParams: ['thinkingBudget', 'urlContext'],
|
||||
searchImpl: 'params',
|
||||
searchProvider: 'google',
|
||||
},
|
||||
type: 'chat',
|
||||
},
|
||||
{
|
||||
abilities: {
|
||||
imageOutput: true,
|
||||
@@ -514,35 +498,6 @@ const googleChatModels: AIChatModelCard[] = [
|
||||
},
|
||||
type: 'chat',
|
||||
},
|
||||
{
|
||||
abilities: {
|
||||
functionCall: true,
|
||||
reasoning: true,
|
||||
search: true,
|
||||
video: true,
|
||||
vision: true,
|
||||
},
|
||||
contextWindowTokens: 1_048_576 + 65_536,
|
||||
description:
|
||||
'Gemini 2.5 Flash-Lite Preview 是 Google 最小、性价比最高的模型,专为大规模使用而设计。',
|
||||
displayName: 'Gemini 2.5 Flash-Lite Preview 06-17',
|
||||
id: 'gemini-2.5-flash-lite-preview-06-17',
|
||||
maxOutput: 65_536,
|
||||
pricing: {
|
||||
units: [
|
||||
{ name: 'textInput_cacheRead', rate: 0.025, strategy: 'fixed', unit: 'millionTokens' },
|
||||
{ name: 'textInput', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
|
||||
{ name: 'textOutput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
|
||||
],
|
||||
},
|
||||
releasedAt: '2025-06-11',
|
||||
settings: {
|
||||
extendParams: ['thinkingBudget', 'urlContext'],
|
||||
searchImpl: 'params',
|
||||
searchProvider: 'google',
|
||||
},
|
||||
type: 'chat',
|
||||
},
|
||||
{
|
||||
abilities: {
|
||||
functionCall: true,
|
||||
@@ -597,26 +552,6 @@ const googleChatModels: AIChatModelCard[] = [
|
||||
},
|
||||
type: 'chat',
|
||||
},
|
||||
{
|
||||
abilities: {
|
||||
imageOutput: true,
|
||||
vision: true,
|
||||
},
|
||||
contextWindowTokens: 32_768 + 8192,
|
||||
description: 'Gemini 2.0 Flash 预览模型,支持图像生成',
|
||||
displayName: 'Gemini 2.0 Flash Preview Image Generation',
|
||||
id: 'gemini-2.0-flash-preview-image-generation',
|
||||
maxOutput: 8192,
|
||||
pricing: {
|
||||
units: [
|
||||
{ name: 'textInput', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
|
||||
{ name: 'textOutput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
|
||||
{ name: 'imageGeneration', rate: 0.039, strategy: 'fixed', unit: 'image' },
|
||||
],
|
||||
},
|
||||
releasedAt: '2025-05-07',
|
||||
type: 'chat',
|
||||
},
|
||||
{
|
||||
abilities: {
|
||||
imageOutput: true,
|
||||
|
||||
@@ -5,12 +5,14 @@ const ollamaCloudModels: AIChatModelCard[] = [
|
||||
abilities: {
|
||||
functionCall: true,
|
||||
reasoning: true,
|
||||
vision: true,
|
||||
},
|
||||
contextWindowTokens: 200_000,
|
||||
description: 'MiniMax M2 是专为编码和代理工作流程构建的高效大型语言模型。',
|
||||
displayName: 'MiniMax M2',
|
||||
contextWindowTokens: 1_048_576,
|
||||
description:
|
||||
'Gemini 3 Pro 是 Google 最智能的模型,具有 SOTA 推理和多模式理解,以及强大的代理和氛围编码功能。',
|
||||
displayName: 'Gemini 3 Pro Preview',
|
||||
enabled: true,
|
||||
id: 'minimax-m2',
|
||||
id: 'gemini-3-pro-preview',
|
||||
type: 'chat',
|
||||
},
|
||||
{
|
||||
@@ -19,8 +21,7 @@ const ollamaCloudModels: AIChatModelCard[] = [
|
||||
reasoning: true,
|
||||
},
|
||||
contextWindowTokens: 200_000,
|
||||
description:
|
||||
'MiniMax M2 是专为编码和代理工作流程构建的高效大型语言模型。',
|
||||
description: 'MiniMax M2 是专为编码和代理工作流程构建的高效大型语言模型。',
|
||||
displayName: 'MiniMax M2',
|
||||
enabled: true,
|
||||
id: 'minimax-m2',
|
||||
|
||||
@@ -242,6 +242,7 @@ export type ExtendParamsType =
|
||||
| 'textVerbosity'
|
||||
| 'thinking'
|
||||
| 'thinkingBudget'
|
||||
| 'thinkingLevel'
|
||||
| 'urlContext';
|
||||
|
||||
export interface AiModelSettings {
|
||||
|
||||
@@ -194,7 +194,7 @@ export class LobeGoogleAI implements LobeRuntimeAI {
|
||||
async chat(rawPayload: ChatStreamPayload, options?: ChatMethodOptions) {
|
||||
try {
|
||||
const payload = this.buildPayload(rawPayload);
|
||||
const { model, thinkingBudget } = payload;
|
||||
const { model, thinkingBudget, thinkingLevel } = payload;
|
||||
|
||||
// https://ai.google.dev/gemini-api/docs/thinking#set-budget
|
||||
const resolvedThinkingBudget = resolveModelThinkingBudget(model, thinkingBudget);
|
||||
@@ -209,6 +209,11 @@ export class LobeGoogleAI implements LobeRuntimeAI {
|
||||
thinkingBudget: resolvedThinkingBudget,
|
||||
};
|
||||
|
||||
// Add thinkingLevel for 3.0 models
|
||||
if (model?.toLowerCase().includes('-3-') && thinkingLevel) {
|
||||
(thinkingConfig as any).thinkingLevel = thinkingLevel;
|
||||
}
|
||||
|
||||
const contents = await buildGoogleMessages(payload.messages);
|
||||
|
||||
const controller = new AbortController();
|
||||
|
||||
@@ -124,6 +124,10 @@ export interface ChatStreamPayload {
|
||||
type: 'enabled' | 'disabled';
|
||||
};
|
||||
thinkingBudget?: number;
|
||||
/**
|
||||
* Thinking level for Gemini models (e.g., gemini-3.0-pro)
|
||||
*/
|
||||
thinkingLevel?: 'low' | 'high';
|
||||
tool_choice?: string;
|
||||
tools?: ChatCompletionTool[];
|
||||
/**
|
||||
|
||||
@@ -38,6 +38,7 @@ export interface LobeAgentChatConfig {
|
||||
*/
|
||||
textVerbosity?: 'low' | 'medium' | 'high';
|
||||
thinking?: 'disabled' | 'auto' | 'enabled';
|
||||
thinkingLevel?: 'low' | 'high';
|
||||
thinkingBudget?: number;
|
||||
/**
|
||||
* Disable context caching
|
||||
@@ -91,6 +92,7 @@ export const AgentChatConfigSchema = z.object({
|
||||
textVerbosity: z.enum(['low', 'medium', 'high']).optional(),
|
||||
thinking: z.enum(['disabled', 'auto', 'enabled']).optional(),
|
||||
thinkingBudget: z.number().optional(),
|
||||
thinkingLevel: z.enum(['low', 'high']).optional(),
|
||||
urlContext: z.boolean().optional(),
|
||||
useModelBuiltinSearch: z.boolean().optional(),
|
||||
});
|
||||
|
||||
@@ -17,6 +17,7 @@ import ReasoningEffortSlider from './ReasoningEffortSlider';
|
||||
import ReasoningTokenSlider from './ReasoningTokenSlider';
|
||||
import TextVerbositySlider from './TextVerbositySlider';
|
||||
import ThinkingBudgetSlider from './ThinkingBudgetSlider';
|
||||
import ThinkingLevelSlider from './ThinkingLevelSlider';
|
||||
import ThinkingSlider from './ThinkingSlider';
|
||||
|
||||
const ControlsForm = memo(() => {
|
||||
@@ -177,6 +178,16 @@ const ControlsForm = memo(() => {
|
||||
paddingBottom: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
children: <ThinkingLevelSlider />,
|
||||
label: t('extendParams.thinkingLevel.title'),
|
||||
layout: 'horizontal',
|
||||
minWidth: undefined,
|
||||
name: 'thinkingLevel',
|
||||
style: {
|
||||
paddingBottom: 0,
|
||||
},
|
||||
},
|
||||
].filter(Boolean) as FormItemProps[];
|
||||
|
||||
return (
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
import { Slider } from 'antd';
|
||||
import { memo, useCallback } from 'react';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import { useAgentStore } from '@/store/agent';
|
||||
import { agentChatConfigSelectors } from '@/store/agent/selectors';
|
||||
|
||||
const ThinkingLevelSlider = memo(() => {
|
||||
const [config, updateAgentChatConfig] = useAgentStore((s) => [
|
||||
agentChatConfigSelectors.currentChatConfig(s),
|
||||
s.updateAgentChatConfig,
|
||||
]);
|
||||
|
||||
const thinkingLevel = config.thinkingLevel || 'high'; // Default to 'high' if not set
|
||||
|
||||
const marks = {
|
||||
0: 'low',
|
||||
1: 'high',
|
||||
};
|
||||
|
||||
const levelValues = ['low', 'high'];
|
||||
const indexValue = levelValues.indexOf(thinkingLevel);
|
||||
const currentValue = indexValue === -1 ? 1 : indexValue;
|
||||
|
||||
const updateThinkingLevel = useCallback(
|
||||
(value: number) => {
|
||||
const level = levelValues[value] as 'low' | 'high';
|
||||
updateAgentChatConfig({ thinkingLevel: level });
|
||||
},
|
||||
[updateAgentChatConfig],
|
||||
);
|
||||
|
||||
return (
|
||||
<Flexbox
|
||||
align={'center'}
|
||||
gap={12}
|
||||
horizontal
|
||||
paddingInline={'0 20px'}
|
||||
style={{ minWidth: 130, width: '100%' }} // 三项时宽度需改回 200
|
||||
>
|
||||
<Flexbox flex={1}>
|
||||
<Slider
|
||||
marks={marks}
|
||||
max={1}
|
||||
min={0}
|
||||
onChange={updateThinkingLevel}
|
||||
step={1}
|
||||
tooltip={{ open: false }}
|
||||
value={currentValue}
|
||||
/>
|
||||
</Flexbox>
|
||||
</Flexbox>
|
||||
);
|
||||
});
|
||||
|
||||
export default ThinkingLevelSlider;
|
||||
@@ -66,6 +66,9 @@ export default {
|
||||
thinking: {
|
||||
title: '深度思考开关',
|
||||
},
|
||||
thinkingLevel: {
|
||||
title: '思考水平',
|
||||
},
|
||||
title: '模型扩展功能',
|
||||
urlContext: {
|
||||
desc: '开启后将自动解析网页链接,以获取实际网页上下文内容',
|
||||
|
||||
@@ -196,6 +196,10 @@ class ChatService {
|
||||
extendParams.thinkingBudget = chatConfig.thinkingBudget;
|
||||
}
|
||||
|
||||
if (modelExtendParams!.includes('thinkingLevel') && chatConfig.thinkingLevel) {
|
||||
extendParams.thinkingLevel = chatConfig.thinkingLevel;
|
||||
}
|
||||
|
||||
if (modelExtendParams!.includes('urlContext') && chatConfig.urlContext) {
|
||||
extendParams.urlContext = chatConfig.urlContext;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user