mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-22 03:10:15 +01:00
* 🔧 fix: Update file source references to include 'azure_blob' for correct service initialization * 🔧 fix: Add Azure Blob Storage Emulator entries to .gitignore * fix: Update file source references to include 'azure_blob' for correct service initialization * fix: Refactor Azure Blob Storage functions to use environment variables for access control and container name, fix deletion improper logging and improper params * fix: Add basePath determination for agent file uploads based on MIME type * fix: Implement file streaming to Azure Blob Storage to optimize memory usage during uploads (non-images) * fix: Update SourceIcon to include 'azure_blob' class and adjust model setting in useSelectorEffects for assistants * chore: import order --------- Co-authored-by: Danny Avila <danny@librechat.ai>
79 lines
2.2 KiB
TypeScript
79 lines
2.2 KiB
TypeScript
import { Terminal, Type, Database } from 'lucide-react';
|
|
import { EModelEndpoint, FileSources } from 'librechat-data-provider';
|
|
import { MinimalIcon } from '~/components/Endpoints';
|
|
import { cn } from '~/utils';
|
|
|
|
const sourceToEndpoint = {
|
|
[FileSources.openai]: EModelEndpoint.openAI,
|
|
[FileSources.azure]: EModelEndpoint.azureOpenAI,
|
|
};
|
|
|
|
const sourceToClassname = {
|
|
[FileSources.openai]: 'bg-white/75 dark:bg-black/65',
|
|
[FileSources.azure]: 'azure-bg-color',
|
|
[FileSources.azure_blob]: 'azure-bg-color',
|
|
[FileSources.execute_code]: 'bg-black text-white opacity-85',
|
|
[FileSources.text]: 'bg-blue-500 dark:bg-blue-900 opacity-85 text-white',
|
|
[FileSources.vectordb]: 'bg-yellow-700 dark:bg-yellow-900 opacity-85 text-white',
|
|
};
|
|
|
|
const defaultClassName =
|
|
'absolute right-0 bottom-0 rounded-full p-[0.15rem] text-gray-600 transition-colors';
|
|
|
|
export default function SourceIcon({
|
|
source,
|
|
isCodeFile,
|
|
className = defaultClassName,
|
|
}: {
|
|
source?: FileSources;
|
|
isCodeFile?: boolean;
|
|
className?: string;
|
|
}) {
|
|
if (isCodeFile === true) {
|
|
return (
|
|
<div className={cn(className, sourceToClassname[FileSources.execute_code] ?? '')}>
|
|
<span className="flex items-center justify-center">
|
|
<Terminal className="h-3 w-3" />
|
|
</span>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (source === FileSources.text) {
|
|
return (
|
|
<div className={cn(className, sourceToClassname[source] ?? '')}>
|
|
<span className="flex items-center justify-center">
|
|
<Type className="h-3 w-3" />
|
|
</span>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (source === FileSources.vectordb) {
|
|
return (
|
|
<div className={cn(className, sourceToClassname[source] ?? '')}>
|
|
<span className="flex items-center justify-center">
|
|
<Database className="h-3 w-3" />
|
|
</span>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const endpoint = sourceToEndpoint[source ?? ''];
|
|
|
|
if (!endpoint) {
|
|
return null;
|
|
}
|
|
return (
|
|
<div className={cn(className, sourceToClassname[source ?? ''] ?? '')}>
|
|
<span className="flex items-center justify-center">
|
|
<MinimalIcon
|
|
endpoint={endpoint}
|
|
size={14}
|
|
isCreatedByUser={false}
|
|
iconClassName="h-3 w-3"
|
|
/>
|
|
</span>
|
|
</div>
|
|
);
|
|
}
|