mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-09-05 07:36:53 +08:00
feat(Processor): support setting extension to empty to indicate no extension restriction
This commit is contained in:
@@ -93,7 +93,7 @@ def _compress_image_for_embedding(input_bytes: bytes) -> Tuple[bytes, Dict[str,
|
|||||||
|
|
||||||
class VectorIndexProcessor:
|
class VectorIndexProcessor:
|
||||||
name = "向量索引"
|
name = "向量索引"
|
||||||
supported_exts = ["jpg", "jpeg", "png", "bmp", "txt", "md"]
|
supported_exts: List[str] = [] # 留空表示不限扩展名
|
||||||
config_schema = [
|
config_schema = [
|
||||||
{
|
{
|
||||||
"key": "action", "label": "操作", "type": "select", "required": True, "default": "create",
|
"key": "action", "label": "操作", "type": "select", "required": True, "default": "create",
|
||||||
|
|||||||
@@ -61,7 +61,11 @@ export const ContextMenu: React.FC<ContextMenuProps> = (props) => {
|
|||||||
if (!entry.is_dir && processorTypes.length > 0) {
|
if (!entry.is_dir && processorTypes.length > 0) {
|
||||||
const ext = entry.name.split('.').pop()?.toLowerCase() || '';
|
const ext = entry.name.split('.').pop()?.toLowerCase() || '';
|
||||||
processorSubMenu = processorTypes
|
processorSubMenu = processorTypes
|
||||||
.filter(pt => pt.supported_exts.includes(ext))
|
.filter(pt => {
|
||||||
|
const exts = pt.supported_exts;
|
||||||
|
if (!Array.isArray(exts) || exts.length === 0) return true;
|
||||||
|
return exts.includes(ext);
|
||||||
|
})
|
||||||
.map(pt => ({
|
.map(pt => ({
|
||||||
key: 'processor-' + pt.type,
|
key: 'processor-' + pt.type,
|
||||||
label: pt.name,
|
label: pt.name,
|
||||||
|
|||||||
Reference in New Issue
Block a user