update model star
This commit is contained in:
parent
2ce1e11c05
commit
0178a9b024
@ -419,64 +419,60 @@ export function ModelSelect() {
|
|||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<div className="infio-loading">loading...</div>
|
<div className="infio-loading">loading...</div>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<div className="infio-model-section">
|
||||||
|
<ul>
|
||||||
|
{filteredOptions.map((option, index) => {
|
||||||
|
// 计算正确的选中索引,考虑搜索模式和非搜索模式
|
||||||
|
const isSelected = searchTerm
|
||||||
|
? index === selectedIndex
|
||||||
|
: index + settings.collectedChatModels?.length === selectedIndex;
|
||||||
|
|
||||||
{/* 所有模型区域 */}
|
return (
|
||||||
<div className="infio-model-section">
|
<DropdownMenu.Item
|
||||||
<ul>
|
key={option.id}
|
||||||
{filteredOptions.map((option, index) => {
|
onSelect={() => {
|
||||||
// 计算正确的选中索引,考虑搜索模式和非搜索模式
|
setSettings({
|
||||||
const isSelected = searchTerm
|
...settings,
|
||||||
? index === selectedIndex
|
chatModelProvider: modelProvider,
|
||||||
: index + settings.collectedChatModels?.length === selectedIndex;
|
chatModelId: option.id,
|
||||||
|
})
|
||||||
return (
|
setChatModelId(option.id)
|
||||||
<DropdownMenu.Item
|
setSearchTerm("")
|
||||||
key={option.id}
|
setIsOpen(false)
|
||||||
onSelect={() => {
|
}}
|
||||||
setSettings({
|
className={`infio-llm-setting-combobox-option ${isSelected ? 'is-selected' : ''}`}
|
||||||
...settings,
|
onMouseEnter={() => {
|
||||||
chatModelProvider: modelProvider,
|
// 计算正确的鼠标悬停索引
|
||||||
chatModelId: option.id,
|
const hoverIndex = searchTerm
|
||||||
})
|
? index
|
||||||
setChatModelId(option.id)
|
: index + settings.collectedChatModels?.length;
|
||||||
setSearchTerm("")
|
setSelectedIndex(hoverIndex);
|
||||||
setIsOpen(false)
|
}}
|
||||||
}}
|
asChild
|
||||||
className={`infio-llm-setting-combobox-option ${isSelected ? 'is-selected' : ''}`}
|
>
|
||||||
onMouseEnter={() => {
|
<li
|
||||||
// 计算正确的鼠标悬停索引
|
className={`infio-llm-setting-model-item ${option.isCollected ? 'infio-collected-model-item' : ''}`}
|
||||||
const hoverIndex = searchTerm
|
title={option.id}
|
||||||
? index
|
|
||||||
: index + settings.collectedChatModels?.length;
|
|
||||||
setSelectedIndex(hoverIndex);
|
|
||||||
}}
|
|
||||||
asChild
|
|
||||||
>
|
>
|
||||||
<li
|
<div className="infio-model-item-text-wrapper">
|
||||||
className={`infio-llm-setting-model-item ${option.isCollected ? 'infio-collected-model-item' : ''}`}
|
<HighlightedText segments={option.html} />
|
||||||
title={option.id}
|
</div>
|
||||||
|
<div
|
||||||
|
className="infio-model-item-star"
|
||||||
|
onClick={(e) => toggleCollected(option.id, e)}
|
||||||
|
title={option.isCollected ? "star" : "unstar"}
|
||||||
>
|
>
|
||||||
<div className="infio-model-item-text-wrapper">
|
{option.isCollected ?
|
||||||
<HighlightedText segments={option.html} />
|
<Star size={16} className="infio-star-active" /> :
|
||||||
</div>
|
<Star size={16} className="infio-star-inactive" />
|
||||||
<div
|
}
|
||||||
className="infio-model-item-star"
|
</div>
|
||||||
onClick={(e) => toggleCollected(option.id, e)}
|
</li>
|
||||||
title={option.isCollected ? "star" : "unstar"}
|
</DropdownMenu.Item>
|
||||||
>
|
);
|
||||||
{option.isCollected ?
|
})}
|
||||||
<Star size={16} className="infio-star-active" /> :
|
</ul>
|
||||||
<Star size={16} className="infio-star-inactive" />
|
</div>
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</DropdownMenu.Item>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</DropdownMenu.Content>
|
</DropdownMenu.Content>
|
||||||
</DropdownMenu.Portal>
|
</DropdownMenu.Portal>
|
||||||
@ -580,7 +576,7 @@ export function ModelSelect() {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
width: 30%;
|
width: 45%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Provider selector */
|
/* Provider selector */
|
||||||
@ -623,7 +619,7 @@ export function ModelSelect() {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
width: 70%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search input */
|
/* Search input */
|
||||||
@ -653,8 +649,7 @@ export function ModelSelect() {
|
|||||||
|
|
||||||
/* Dropdown menu container */
|
/* Dropdown menu container */
|
||||||
.infio-llm-setting-combobox-dropdown {
|
.infio-llm-setting-combobox-dropdown {
|
||||||
max-height: 350px;
|
max-height: 400px;
|
||||||
overflow-y: auto;
|
|
||||||
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12), 0 3px 6px rgba(0, 0, 0, 0.08);
|
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12), 0 3px 6px rgba(0, 0, 0, 0.08);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
border: 1px solid var(--background-modifier-border);
|
border: 1px solid var(--background-modifier-border);
|
||||||
@ -663,6 +658,8 @@ export function ModelSelect() {
|
|||||||
/* 模型区域样式 */
|
/* 模型区域样式 */
|
||||||
.infio-model-section {
|
.infio-model-section {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
max-height: 300px;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.infio-model-section-title {
|
.infio-model-section-title {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user