Fix/merge-main (#11262)

* merge branch 'main'

* fix: lint error

* fix yarn lock

* fix: lock

* fix: ci

* fix: yarn lock
This commit is contained in:
SuYao 2025-11-12 22:49:58 +08:00 committed by GitHub
parent 680fcb4b9d
commit d610943f0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 317 additions and 960 deletions

View File

@ -1,7 +1,7 @@
// Original path: src/renderer/src/components/EditableNumber/index.tsx
import { InputNumber } from 'antd'
import type { FC } from 'react'
import { useEffect, useRef, useState } from 'react'
import { useEffect, useState } from 'react'
import styled from 'styled-components'
export interface EditableNumberProps {
@ -41,7 +41,6 @@ const EditableNumber: FC<EditableNumberProps> = ({
}) => {
const [isEditing, setIsEditing] = useState(false)
const [inputValue, setInputValue] = useState(value)
const inputRef = useRef<HTMLInputElement>(null)
useEffect(() => {
setInputValue(value)
@ -75,7 +74,6 @@ const EditableNumber: FC<EditableNumberProps> = ({
<Container>
<InputNumber
style={{ ...style, opacity: isEditing ? 1 : 0 }}
ref={inputRef}
value={inputValue}
min={min}
max={max}

View File

@ -139,7 +139,7 @@ export default class OpenMineruPreprocessProvider extends BasePreprocessProvider
...(this.provider.apiKey ? { Authorization: `Bearer ${this.provider.apiKey}` } : {}),
...formData.getHeaders()
},
body: formData.getBuffer()
body: new Uint8Array(formData.getBuffer())
})
if (!response.ok) {

View File

@ -1,10 +1,11 @@
import { loggerService } from '@logger'
import type { SlashCommand,
import type {
AgentEntity,
AgentSessionEntity,
CreateSessionRequest,
GetAgentSessionResponse,
ListOptions,
SlashCommand,
UpdateSessionRequest,
UpdateSessionResponse
} from '@types'

View File

@ -4,6 +4,7 @@ import React, { memo } from 'react'
interface ActionIconButtonProps extends Omit<React.ComponentProps<'button'>, 'ref'> {
icon: React.ReactNode
active?: boolean
loading?: boolean
}
/**

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
import '@renderer/pages/home/Inputbar/tools'
import { Tooltip } from '@cherrystudio/ui'
import type { DropResult } from '@hello-pangea/dnd'
import { DragDropContext, Draggable, Droppable } from '@hello-pangea/dnd'
@ -394,19 +395,19 @@ const InputbarTools = ({ scope, assistantId, session }: InputbarToolsNewProps) =
</DragDropContext>
{showCollapseButton && (
<Tooltip content={isCollapse ? t('chat.input.tools.expand') : t('chat.input.tools.collapse')} showArrow>
<ActionIconButton
onClick={() => dispatch(setIsCollapsed(!isCollapse))}
icon={
<CircleChevronRight
size={18}
style={{
transform: isCollapse ? 'scaleX(1)' : 'scaleX(-1)'
}}
/>
}
/>
</Tooltip>
<Tooltip content={isCollapse ? t('chat.input.tools.expand') : t('chat.input.tools.collapse')} showArrow>
<ActionIconButton
onClick={() => dispatch(setIsCollapsed(!isCollapse))}
icon={
<CircleChevronRight
size={18}
style={{
transform: isCollapse ? 'scaleX(1)' : 'scaleX(-1)'
}}
/>
}
/>
</Tooltip>
)}
</ToolsContainer>
</Dropdown>

View File

@ -1,17 +1,15 @@
import { HolderOutlined } from '@ant-design/icons'
import { useCache } from '@data/hooks/useCache'
import { usePreference } from '@data/hooks/usePreference'
import { loggerService } from '@logger'
import { ActionIconButton } from '@renderer/components/Buttons'
import type { QuickPanelTriggerInfo } from '@renderer/components/QuickPanel'
import { QuickPanelReservedSymbol, QuickPanelView, useQuickPanel } from '@renderer/components/QuickPanel'
import TranslateButton from '@renderer/components/TranslateButton'
import { useRuntime } from '@renderer/hooks/useRuntime'
import { useSettings } from '@renderer/hooks/useSettings'
import { useTimer } from '@renderer/hooks/useTimer'
import useTranslate from '@renderer/hooks/useTranslate'
import PasteService from '@renderer/services/PasteService'
import { translateText } from '@renderer/services/TranslateService'
import { useAppDispatch } from '@renderer/store'
import { setSearching } from '@renderer/store/runtime'
import type { FileType } from '@renderer/types'
import { classNames } from '@renderer/utils'
import { formatQuotedText } from '@renderer/utils/formats'
@ -119,16 +117,15 @@ export const InputbarCore: FC<InputbarCoreProps> = ({
const { setExtensions } = useInputbarToolsInternalDispatch()
const isEmpty = text.trim().length === 0
const [inputFocus, setInputFocus] = useState(false)
const {
targetLanguage,
sendMessageShortcut,
fontSize,
pasteLongTextAsFile,
pasteLongTextThreshold,
autoTranslateWithSpace,
enableQuickPanelTriggers,
enableSpellCheck
} = useSettings()
const [targetLanguage] = usePreference('feature.translate.target_language')
const [sendMessageShortcut] = usePreference('chat.input.send_message_shortcut')
const [pasteLongTextAsFile] = usePreference('chat.input.paste_long_text_as_file')
const [pasteLongTextThreshold] = usePreference('chat.input.paste_long_text_threshold')
const [autoTranslateWithSpace] = usePreference('chat.input.translate.auto_translate_with_space')
const [enableQuickPanelTriggers] = usePreference('chat.input.quick_panel.triggers_enabled')
const [enableSpellCheck] = usePreference('app.spell_check.enabled')
const [fontSize] = usePreference('chat.message.font_size')
const [searching, setSearching] = useCache('chat.websearch.searching')
const quickPanelTriggersEnabled = forceEnableQuickPanelTriggers ?? enableQuickPanelTriggers
const [textareaHeight, setTextareaHeight] = useState<number>()
@ -137,10 +134,8 @@ export const InputbarCore: FC<InputbarCoreProps> = ({
const [isTranslating, setIsTranslating] = useState(false)
const { getLanguageByLangcode } = useTranslate()
const dispatch = useAppDispatch()
const [spaceClickCount, setSpaceClickCount] = useState(0)
const spaceClickTimer = useRef<NodeJS.Timeout | null>(null)
const { searching } = useRuntime()
const startDragY = useRef<number>(0)
const startHeight = useRef<number>(0)
const { setTimeoutTimer } = useTimer()
@ -522,12 +517,12 @@ export const InputbarCore: FC<InputbarCoreProps> = ({
const handleFocus = useCallback(() => {
setInputFocus(true)
dispatch(setSearching(false))
setSearching(false)
if (quickPanel.isVisible && quickPanel.triggerInfo?.type !== 'input') {
quickPanel.close()
}
PasteService.setLastFocusedComponent('inputbar')
}, [dispatch, quickPanel])
}, [quickPanel, setSearching])
const handleDragStart = useCallback(
(event: React.MouseEvent) => {
@ -624,9 +619,11 @@ export const InputbarCore: FC<InputbarCoreProps> = ({
if (isLoading) {
extras.push(
<Tooltip key="pause" placement="top" title={t('chat.input.pause')} mouseLeaveDelay={0} arrow>
<ActionIconButton onClick={onPause} style={{ marginRight: -2 }}>
<CirclePause size={20} color="var(--color-error)" />
</ActionIconButton>
<ActionIconButton
onClick={onPause}
style={{ marginRight: -2 }}
icon={<CirclePause size={20} color="var(--color-error)" />}
/>
</Tooltip>
)
}
@ -678,7 +675,7 @@ export const InputbarCore: FC<InputbarCoreProps> = ({
}}
disabled={isTranslating || searching}
onClick={() => {
searching && dispatch(setSearching(false))
searching && setSearching(false)
quickPanel.close()
}}
/>

View File

@ -21,9 +21,7 @@ const clearTopicTool = defineTool({
title={t('chat.input.clear.label', { Command: clearTopicShortcut })}
mouseLeaveDelay={0}
arrow>
<ActionIconButton onClick={actions.clearTopic}>
<PaintbrushVertical size={18} />
</ActionIconButton>
<ActionIconButton onClick={actions.clearTopic} icon={<PaintbrushVertical size={18} />}></ActionIconButton>
</Tooltip>
)
}

View File

@ -31,9 +31,7 @@ const ActivityDirectoryButton: FC<Props> = ({ quickPanel, quickPanelController,
return (
<Tooltip placement="top" title={t('chat.input.activity_directory.title')} mouseLeaveDelay={0} arrow>
<ActionIconButton onClick={handleOpenQuickPanel}>
<FolderOpen size={18} />
</ActionIconButton>
<ActionIconButton onClick={handleOpenQuickPanel} icon={<FolderOpen size={18} />}></ActionIconButton>
</Tooltip>
)
}

View File

@ -46,9 +46,10 @@ const MentionModelsButton: FC<Props> = ({
return (
<Tooltip placement="top" title={t('assistants.presets.edit.model.select.title')} mouseLeaveDelay={0} arrow>
<ActionIconButton onClick={handleOpenQuickPanel} active={mentionedModels.length > 0}>
<AtSign size={18} />
</ActionIconButton>
<ActionIconButton
onClick={handleOpenQuickPanel}
active={mentionedModels.length > 0}
icon={<AtSign size={18} />}></ActionIconButton>
</Tooltip>
)
}

View File

@ -37,9 +37,11 @@ const SlashCommandsButton: FC<Props> = ({ quickPanelController, session, openPan
return (
<Tooltip placement="top" title={t('chat.input.slash_commands.title')} mouseLeaveDelay={0} arrow>
<ActionIconButton onClick={handleOpenQuickPanel} active={isActive} disabled={!hasCommands}>
<Terminal size={18} />
</ActionIconButton>
<ActionIconButton
onClick={handleOpenQuickPanel}
active={isActive}
disabled={!hasCommands}
icon={<Terminal size={18} />}></ActionIconButton>
</Tooltip>
)
}

View File

@ -31,9 +31,10 @@ const WebSearchButton: FC<Props> = ({ quickPanelController, assistantId }) => {
title={enableWebSearch ? t('common.close') : t('chat.input.web_search.label')}
mouseLeaveDelay={0}
arrow>
<ActionIconButton onClick={onClick} active={!!enableWebSearch}>
<WebSearchProviderIcon pid={selectedProviderId} />
</ActionIconButton>
<ActionIconButton
onClick={onClick}
active={!!enableWebSearch}
icon={<WebSearchProviderIcon pid={selectedProviderId} />}></ActionIconButton>
</Tooltip>
)
}

View File

@ -43,9 +43,11 @@ const createSessionTool = defineTool({
return (
<Tooltip placement="top" title={t('chat.input.new_topic', { Command: newTopicShortcut })}>
<ActionIconButton onClick={handleCreateSession} disabled={createSessionDisabled} loading={creatingSession}>
<MessageSquareDiff size={19} />
</ActionIconButton>
<ActionIconButton
onClick={handleCreateSession}
disabled={createSessionDisabled}
loading={creatingSession}
icon={<MessageSquareDiff size={19} />}></ActionIconButton>
</Tooltip>
)
}

View File

@ -24,9 +24,7 @@ const newTopicTool = defineTool({
title={t('chat.input.new_topic', { Command: newTopicShortcut })}
mouseLeaveDelay={0}
arrow>
<ActionIconButton onClick={actions.addNewTopic}>
<MessageSquareDiff size={19} />
</ActionIconButton>
<ActionIconButton onClick={actions.addNewTopic} icon={<MessageSquareDiff size={19} />}></ActionIconButton>
</Tooltip>
)
}

View File

@ -21,9 +21,9 @@ const ToggleExpandTool: React.FC<{ context: ToggleExpandRenderContext }> = ({ co
title={isExpanded ? t('chat.input.collapse') : t('chat.input.expand')}
mouseLeaveDelay={0}
arrow>
<ActionIconButton onClick={handleToggle}>
{isExpanded ? <Minimize size={18} /> : <Maximize size={18} />}
</ActionIconButton>
<ActionIconButton
onClick={handleToggle}
icon={isExpanded ? <Minimize size={18} /> : <Maximize size={18} />}></ActionIconButton>
</Tooltip>
)
}

View File

@ -290,7 +290,7 @@ __metadata:
languageName: node
linkType: hard
"@ai-sdk/provider-utils@npm:3.0.10":
"@ai-sdk/provider-utils@npm:3.0.10, @ai-sdk/provider-utils@npm:^3.0.10":
version: 3.0.10
resolution: "@ai-sdk/provider-utils@npm:3.0.10"
dependencies:
@ -316,7 +316,7 @@ __metadata:
languageName: node
linkType: hard
"@ai-sdk/provider-utils@npm:3.0.17, @ai-sdk/provider-utils@npm:^3.0.10, @ai-sdk/provider-utils@npm:^3.0.12":
"@ai-sdk/provider-utils@npm:3.0.17, @ai-sdk/provider-utils@npm:^3.0.12":
version: 3.0.17
resolution: "@ai-sdk/provider-utils@npm:3.0.17"
dependencies:
@ -28546,7 +28546,7 @@ __metadata:
languageName: node
linkType: hard
"typescript@npm:^5.0.0, typescript@npm:^5.4.3, typescript@npm:^5.6.2":
"typescript@npm:^5.0.0, typescript@npm:^5.4.3, typescript@npm:^5.6.2, typescript@npm:^5.8.2":
version: 5.9.3
resolution: "typescript@npm:5.9.3"
bin:
@ -28566,19 +28566,9 @@ __metadata:
languageName: node
linkType: hard
"typescript@npm:^5.8.2":
"typescript@patch:typescript@npm%3A^5.0.0#optional!builtin<compat/typescript>, typescript@patch:typescript@npm%3A^5.4.3#optional!builtin<compat/typescript>, typescript@patch:typescript@npm%3A^5.6.2#optional!builtin<compat/typescript>, typescript@patch:typescript@npm%3A^5.8.2#optional!builtin<compat/typescript>":
version: 5.9.3
resolution: "typescript@npm:5.9.3"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10c0/6bd7552ce39f97e711db5aa048f6f9995b53f1c52f7d8667c1abdc1700c68a76a308f579cd309ce6b53646deb4e9a1be7c813a93baaf0a28ccd536a30270e1c5
languageName: node
linkType: hard
"typescript@patch:typescript@npm%3A^5.0.0#optional!builtin<compat/typescript>":
version: 5.9.2
resolution: "typescript@patch:typescript@npm%3A5.9.2#optional!builtin<compat/typescript>::version=5.9.2&hash=5786d5"
resolution: "typescript@patch:typescript@npm%3A5.9.3#optional!builtin<compat/typescript>::version=5.9.3&hash=5786d5"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
@ -28596,26 +28586,7 @@ __metadata:
languageName: node
linkType: hard
"typescript@patch:typescript@npm%3A^5.8.2#optional!builtin<compat/typescript>":
version: 5.9.3
resolution: "typescript@patch:typescript@npm%3A5.9.3#optional!builtin<compat/typescript>::version=5.9.3&hash=5786d5"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10c0/ad09fdf7a756814dce65bc60c1657b40d44451346858eea230e10f2e95a289d9183b6e32e5c11e95acc0ccc214b4f36289dcad4bf1886b0adb84d711d336a430
languageName: node
linkType: hard
"ua-parser-js@npm:^1.0.35":
version: 1.0.40
resolution: "ua-parser-js@npm:1.0.40"
bin:
ua-parser-js: script/cli.js
checksum: 10c0/2b6ac642c74323957dae142c31f72287f2420c12dced9603d989b96c132b80232779c429b296d7de4012ef8b64e0d8fadc53c639ef06633ce13d785a78b5be6c
languageName: node
linkType: hard
"ua-parser-js@npm:^1.0.37":
"ua-parser-js@npm:^1.0.35, ua-parser-js@npm:^1.0.37":
version: 1.0.41
resolution: "ua-parser-js@npm:1.0.41"
bin: