mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-10 10:02:36 +01:00
📤 fix: Show Proper Upload Options for Azure and Agent Endpoints (#11081)
* fix: only show upload to provider for azureOpenAi when use responses api is true * fix: model_parameters not available on first load so Upload Image incorrectly shown - now we query if not populated * test: update tests for new azureOpenAI Responses API logic * chore: correct order of headers in OAuth request to ensure proper content type is set * fix: add useResponsesApi prop to AttachFileMenu and DragDropModal components --------- Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
parent
4fe223eedd
commit
7183223e59
9 changed files with 131 additions and 11 deletions
|
|
@ -278,7 +278,6 @@ describe('AttachFileMenu', () => {
|
|||
{ name: 'OpenAI', endpoint: EModelEndpoint.openAI },
|
||||
{ name: 'Anthropic', endpoint: EModelEndpoint.anthropic },
|
||||
{ name: 'Google', endpoint: EModelEndpoint.google },
|
||||
{ name: 'Azure OpenAI', endpoint: EModelEndpoint.azureOpenAI },
|
||||
{ name: 'Custom', endpoint: EModelEndpoint.custom },
|
||||
];
|
||||
|
||||
|
|
@ -301,6 +300,45 @@ describe('AttachFileMenu', () => {
|
|||
expect(screen.getByText('Upload to Provider')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
it('should show Upload to Provider for Azure OpenAI with useResponsesApi', () => {
|
||||
mockUseAgentToolPermissions.mockReturnValue({
|
||||
fileSearchAllowedByAgent: false,
|
||||
codeAllowedByAgent: false,
|
||||
provider: EModelEndpoint.azureOpenAI,
|
||||
});
|
||||
|
||||
renderAttachFileMenu({
|
||||
endpoint: EModelEndpoint.azureOpenAI,
|
||||
endpointType: EModelEndpoint.azureOpenAI,
|
||||
useResponsesApi: true,
|
||||
});
|
||||
|
||||
const button = screen.getByRole('button', { name: /attach file options/i });
|
||||
fireEvent.click(button);
|
||||
|
||||
expect(screen.getByText('Upload to Provider')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should NOT show Upload to Provider for Azure OpenAI without useResponsesApi', () => {
|
||||
mockUseAgentToolPermissions.mockReturnValue({
|
||||
fileSearchAllowedByAgent: false,
|
||||
codeAllowedByAgent: false,
|
||||
provider: EModelEndpoint.azureOpenAI,
|
||||
});
|
||||
|
||||
renderAttachFileMenu({
|
||||
endpoint: EModelEndpoint.azureOpenAI,
|
||||
endpointType: EModelEndpoint.azureOpenAI,
|
||||
useResponsesApi: false,
|
||||
});
|
||||
|
||||
const button = screen.getByRole('button', { name: /attach file options/i });
|
||||
fireEvent.click(button);
|
||||
|
||||
expect(screen.queryByText('Upload to Provider')).not.toBeInTheDocument();
|
||||
expect(screen.getByText('Upload Image')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Agent Capabilities', () => {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ describe('DragDropModal - Provider Detection', () => {
|
|||
{ name: 'OpenAI', value: EModelEndpoint.openAI },
|
||||
{ name: 'Anthropic', value: EModelEndpoint.anthropic },
|
||||
{ name: 'Google', value: EModelEndpoint.google },
|
||||
{ name: 'Azure OpenAI', value: EModelEndpoint.azureOpenAI },
|
||||
{ name: 'Custom', value: EModelEndpoint.custom },
|
||||
];
|
||||
|
||||
|
|
@ -72,6 +71,10 @@ describe('DragDropModal - Provider Detection', () => {
|
|||
expect(isDocumentSupportedProvider(value)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
it('should NOT recognize Azure OpenAI as supported (requires useResponsesApi)', () => {
|
||||
expect(isDocumentSupportedProvider(EModelEndpoint.azureOpenAI)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('real-world scenarios', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue