Merge remote-tracking branch 'upstream/main' into feat-knowlege-ocr
This commit is contained in:
@@ -2594,9 +2594,11 @@ export function isWebSearchModel(model: Model): boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
const baseName = getBaseModelName(model.id, '/').toLowerCase()
|
||||
|
||||
// 不管哪个供应商都判断了
|
||||
if (model.id.includes('claude')) {
|
||||
return CLAUDE_SUPPORTED_WEBSEARCH_REGEX.test(model.id)
|
||||
return CLAUDE_SUPPORTED_WEBSEARCH_REGEX.test(baseName)
|
||||
}
|
||||
|
||||
if (provider.type === 'openai-response') {
|
||||
@@ -2608,7 +2610,7 @@ export function isWebSearchModel(model: Model): boolean {
|
||||
}
|
||||
|
||||
if (provider.id === 'perplexity') {
|
||||
return PERPLEXITY_SEARCH_MODELS.includes(model?.id)
|
||||
return PERPLEXITY_SEARCH_MODELS.includes(baseName)
|
||||
}
|
||||
|
||||
if (provider.id === 'aihubmix') {
|
||||
@@ -2617,31 +2619,31 @@ export function isWebSearchModel(model: Model): boolean {
|
||||
}
|
||||
|
||||
const models = ['gemini-2.0-flash-search', 'gemini-2.0-flash-exp-search', 'gemini-2.0-pro-exp-02-05-search']
|
||||
return models.includes(model?.id)
|
||||
return models.includes(baseName)
|
||||
}
|
||||
|
||||
if (provider?.type === 'openai') {
|
||||
if (GEMINI_SEARCH_MODELS.includes(model?.id) || isOpenAIWebSearchModel(model)) {
|
||||
if (GEMINI_SEARCH_MODELS.includes(baseName) || isOpenAIWebSearchModel(model)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
if (provider.id === 'gemini' || provider?.type === 'gemini') {
|
||||
return GEMINI_SEARCH_MODELS.includes(model?.id)
|
||||
return GEMINI_SEARCH_MODELS.includes(baseName)
|
||||
}
|
||||
|
||||
if (provider.id === 'hunyuan') {
|
||||
return model?.id !== 'hunyuan-lite'
|
||||
return baseName !== 'hunyuan-lite'
|
||||
}
|
||||
|
||||
if (provider.id === 'zhipu') {
|
||||
return model?.id?.startsWith('glm-4-')
|
||||
return baseName?.startsWith('glm-4-')
|
||||
}
|
||||
|
||||
if (provider.id === 'dashscope') {
|
||||
const models = ['qwen-turbo', 'qwen-max', 'qwen-plus', 'qwq']
|
||||
// matches id like qwen-max-0919, qwen-max-latest
|
||||
return models.some((i) => model.id.startsWith(i))
|
||||
return models.some((i) => baseName.startsWith(i))
|
||||
}
|
||||
|
||||
if (provider.id === 'openrouter') {
|
||||
@@ -2685,7 +2687,9 @@ export function isGenerateImageModel(model: Model): boolean {
|
||||
if (isEmbedding) {
|
||||
return false
|
||||
}
|
||||
if (GENERATE_IMAGE_MODELS.includes(model.id)) {
|
||||
|
||||
const baseName = getBaseModelName(model.id, '/').toLowerCase()
|
||||
if (GENERATE_IMAGE_MODELS.includes(baseName)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
@@ -196,7 +196,10 @@ export const cleanupMultipleBlocks = (dispatch: AppDispatch, blockIds: string[])
|
||||
|
||||
const getBlocksFiles = async (blockIds: string[]) => {
|
||||
const blocks = await db.message_blocks.where('id').anyOf(blockIds).toArray()
|
||||
const files = blocks.filter((block) => block.type === MessageBlockType.FILE).map((block) => block.file)
|
||||
const files = blocks
|
||||
.filter((block) => block.type === MessageBlockType.FILE || block.type === MessageBlockType.IMAGE)
|
||||
.map((block) => block.file)
|
||||
.filter((file): file is FileType => file !== undefined)
|
||||
return isEmpty(files) ? [] : files
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ const HomeWindow: FC = () => {
|
||||
|
||||
fetchChatCompletion({
|
||||
messages: [userMessage],
|
||||
assistant: { ...assistant, model: quickAssistantModel || getDefaultModel() },
|
||||
assistant: { ...assistant, model: quickAssistantModel || getDefaultModel(), settings: { streamOutput: true } },
|
||||
onChunkReceived: (chunk: Chunk) => {
|
||||
if (chunk.type === ChunkType.TEXT_DELTA) {
|
||||
blockContent += chunk.text
|
||||
|
||||
@@ -51,7 +51,7 @@ export const processMessages = async (
|
||||
|
||||
await fetchChatCompletion({
|
||||
messages: [userMessage],
|
||||
assistant,
|
||||
assistant: { ...assistant, settings: { streamOutput: true } },
|
||||
onChunkReceived: (chunk: Chunk) => {
|
||||
switch (chunk.type) {
|
||||
case ChunkType.THINKING_DELTA:
|
||||
|
||||
Reference in New Issue
Block a user