mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-25 16:26:51 +08:00
### What problem does this PR solve? Fixes: Fixed some bugs #10703 - Removed S3 upload from the file upload component - Updated the dropdown menu style on the model provider page - Updated some model provider icons - Fixed other style issues ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -63,7 +63,7 @@ const AddDataSourceModal = ({
|
||||
] as FieldValues
|
||||
}
|
||||
>
|
||||
<div className="flex items-center justify-end w-full gap-2">
|
||||
<div className="flex items-center justify-end w-full gap-2 py-4">
|
||||
<DynamicForm.CancelButton
|
||||
handleCancel={() => {
|
||||
hideModal?.();
|
||||
|
||||
@ -302,7 +302,7 @@ const GoogleDriveTokenField = ({
|
||||
</div>
|
||||
)}
|
||||
<FileUploader
|
||||
className="py-4"
|
||||
className="py-4 border-[0.5px] bg-bg-card text-text-secondary"
|
||||
value={files}
|
||||
onValueChange={handleValueChange}
|
||||
accept={{ '*.json': [FileMimeType.Json] }}
|
||||
|
||||
@ -270,101 +270,101 @@ export const DataSourceFormFields = {
|
||||
defaultValue: 'uploaded',
|
||||
},
|
||||
],
|
||||
[DataSourceKey.GOOGLE_DRIVE]: [
|
||||
{
|
||||
label: 'Primary Admin Email',
|
||||
name: 'config.credentials.google_primary_admin',
|
||||
type: FormFieldType.Text,
|
||||
required: true,
|
||||
placeholder: 'admin@example.com',
|
||||
tooltip: t('setting.google_drivePrimaryAdminTip'),
|
||||
},
|
||||
{
|
||||
label: 'OAuth Token JSON',
|
||||
name: 'config.credentials.google_tokens',
|
||||
type: FormFieldType.Textarea,
|
||||
required: true,
|
||||
render: (fieldProps) => (
|
||||
<GoogleDriveTokenField
|
||||
value={fieldProps.value}
|
||||
onChange={fieldProps.onChange}
|
||||
placeholder='{ "token": "...", "refresh_token": "...", ... }'
|
||||
/>
|
||||
),
|
||||
tooltip: t('setting.google_driveTokenTip'),
|
||||
},
|
||||
{
|
||||
label: 'My Drive Emails',
|
||||
name: 'config.my_drive_emails',
|
||||
type: FormFieldType.Text,
|
||||
required: true,
|
||||
placeholder: 'user1@example.com,user2@example.com',
|
||||
tooltip: t('setting.google_driveMyDriveEmailsTip'),
|
||||
},
|
||||
{
|
||||
label: 'Shared Folder URLs',
|
||||
name: 'config.shared_folder_urls',
|
||||
type: FormFieldType.Textarea,
|
||||
required: true,
|
||||
placeholder:
|
||||
'https://drive.google.com/drive/folders/XXXXX,https://drive.google.com/drive/folders/YYYYY',
|
||||
tooltip: t('setting.google_driveSharedFoldersTip'),
|
||||
},
|
||||
// The fields below are intentionally disabled for now. Uncomment them when we
|
||||
// reintroduce shared drive controls or advanced impersonation options.
|
||||
// {
|
||||
// label: 'Shared Drive URLs',
|
||||
// name: 'config.shared_drive_urls',
|
||||
// type: FormFieldType.Text,
|
||||
// required: false,
|
||||
// placeholder:
|
||||
// 'Optional: comma-separated shared drive links if you want to include them.',
|
||||
// },
|
||||
// {
|
||||
// label: 'Specific User Emails',
|
||||
// name: 'config.specific_user_emails',
|
||||
// type: FormFieldType.Text,
|
||||
// required: false,
|
||||
// placeholder:
|
||||
// 'Optional: comma-separated list of users to impersonate (overrides defaults).',
|
||||
// },
|
||||
// {
|
||||
// label: 'Include My Drive',
|
||||
// name: 'config.include_my_drives',
|
||||
// type: FormFieldType.Checkbox,
|
||||
// required: false,
|
||||
// defaultValue: true,
|
||||
// },
|
||||
// {
|
||||
// label: 'Include Shared Drives',
|
||||
// name: 'config.include_shared_drives',
|
||||
// type: FormFieldType.Checkbox,
|
||||
// required: false,
|
||||
// defaultValue: false,
|
||||
// },
|
||||
// {
|
||||
// label: 'Include “Shared with me”',
|
||||
// name: 'config.include_files_shared_with_me',
|
||||
// type: FormFieldType.Checkbox,
|
||||
// required: false,
|
||||
// defaultValue: false,
|
||||
// },
|
||||
// {
|
||||
// label: 'Allow Images',
|
||||
// name: 'config.allow_images',
|
||||
// type: FormFieldType.Checkbox,
|
||||
// required: false,
|
||||
// defaultValue: false,
|
||||
// },
|
||||
{
|
||||
label: '',
|
||||
name: 'config.credentials.authentication_method',
|
||||
type: FormFieldType.Text,
|
||||
required: false,
|
||||
hidden: true,
|
||||
defaultValue: 'uploaded',
|
||||
},
|
||||
],
|
||||
// [DataSourceKey.GOOGLE_DRIVE]: [
|
||||
// {
|
||||
// label: 'Primary Admin Email',
|
||||
// name: 'config.credentials.google_primary_admin',
|
||||
// type: FormFieldType.Text,
|
||||
// required: true,
|
||||
// placeholder: 'admin@example.com',
|
||||
// tooltip: t('setting.google_drivePrimaryAdminTip'),
|
||||
// },
|
||||
// {
|
||||
// label: 'OAuth Token JSON',
|
||||
// name: 'config.credentials.google_tokens',
|
||||
// type: FormFieldType.Textarea,
|
||||
// required: true,
|
||||
// render: (fieldProps) => (
|
||||
// <GoogleDriveTokenField
|
||||
// value={fieldProps.value}
|
||||
// onChange={fieldProps.onChange}
|
||||
// placeholder='{ "token": "...", "refresh_token": "...", ... }'
|
||||
// />
|
||||
// ),
|
||||
// tooltip: t('setting.google_driveTokenTip'),
|
||||
// },
|
||||
// {
|
||||
// label: 'My Drive Emails',
|
||||
// name: 'config.my_drive_emails',
|
||||
// type: FormFieldType.Text,
|
||||
// required: true,
|
||||
// placeholder: 'user1@example.com,user2@example.com',
|
||||
// tooltip: t('setting.google_driveMyDriveEmailsTip'),
|
||||
// },
|
||||
// {
|
||||
// label: 'Shared Folder URLs',
|
||||
// name: 'config.shared_folder_urls',
|
||||
// type: FormFieldType.Textarea,
|
||||
// required: true,
|
||||
// placeholder:
|
||||
// 'https://drive.google.com/drive/folders/XXXXX,https://drive.google.com/drive/folders/YYYYY',
|
||||
// tooltip: t('setting.google_driveSharedFoldersTip'),
|
||||
// },
|
||||
// // The fields below are intentionally disabled for now. Uncomment them when we
|
||||
// // reintroduce shared drive controls or advanced impersonation options.
|
||||
// // {
|
||||
// // label: 'Shared Drive URLs',
|
||||
// // name: 'config.shared_drive_urls',
|
||||
// // type: FormFieldType.Text,
|
||||
// // required: false,
|
||||
// // placeholder:
|
||||
// // 'Optional: comma-separated shared drive links if you want to include them.',
|
||||
// // },
|
||||
// // {
|
||||
// // label: 'Specific User Emails',
|
||||
// // name: 'config.specific_user_emails',
|
||||
// // type: FormFieldType.Text,
|
||||
// // required: false,
|
||||
// // placeholder:
|
||||
// // 'Optional: comma-separated list of users to impersonate (overrides defaults).',
|
||||
// // },
|
||||
// // {
|
||||
// // label: 'Include My Drive',
|
||||
// // name: 'config.include_my_drives',
|
||||
// // type: FormFieldType.Checkbox,
|
||||
// // required: false,
|
||||
// // defaultValue: true,
|
||||
// // },
|
||||
// // {
|
||||
// // label: 'Include Shared Drives',
|
||||
// // name: 'config.include_shared_drives',
|
||||
// // type: FormFieldType.Checkbox,
|
||||
// // required: false,
|
||||
// // defaultValue: false,
|
||||
// // },
|
||||
// // {
|
||||
// // label: 'Include “Shared with me”',
|
||||
// // name: 'config.include_files_shared_with_me',
|
||||
// // type: FormFieldType.Checkbox,
|
||||
// // required: false,
|
||||
// // defaultValue: false,
|
||||
// // },
|
||||
// // {
|
||||
// // label: 'Allow Images',
|
||||
// // name: 'config.allow_images',
|
||||
// // type: FormFieldType.Checkbox,
|
||||
// // required: false,
|
||||
// // defaultValue: false,
|
||||
// // },
|
||||
// {
|
||||
// label: '',
|
||||
// name: 'config.credentials.authentication_method',
|
||||
// type: FormFieldType.Text,
|
||||
// required: false,
|
||||
// hidden: true,
|
||||
// defaultValue: 'uploaded',
|
||||
// },
|
||||
// ],
|
||||
};
|
||||
|
||||
export const DataSourceFormDefaultValues = {
|
||||
|
||||
@ -65,7 +65,7 @@ export const ModelProviderCard: FC<IModelCardProps> = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={`w-full rounded-lg border border-border-default`}>
|
||||
<div className={`w-full rounded-lg border border-border-button`}>
|
||||
{/* Header */}
|
||||
<div className="flex h-16 items-center justify-between p-4 cursor-pointer transition-colors">
|
||||
<div className="flex items-center space-x-3">
|
||||
@ -131,7 +131,7 @@ export const ModelProviderCard: FC<IModelCardProps> = ({
|
||||
{item.llm.map((model) => (
|
||||
<div
|
||||
key={model.name}
|
||||
className="flex items-center border-b border-border-default justify-between p-3 hover:bg-bg-card transition-colors"
|
||||
className="flex items-center border-b-[0.5px] border-border-button justify-between p-3 hover:bg-bg-card transition-colors"
|
||||
>
|
||||
<div className="flex items-center space-x-3">
|
||||
<span className="font-medium">
|
||||
|
||||
@ -156,7 +156,7 @@ const SystemSetting = ({ onOk, loading }: IProps) => {
|
||||
)}
|
||||
</label>
|
||||
<SelectWithSearch
|
||||
triggerClassName="w-3/4"
|
||||
triggerClassName="w-3/4 flex items-center"
|
||||
allowClear={id !== 'llm_id'}
|
||||
value={value}
|
||||
options={options}
|
||||
@ -175,7 +175,7 @@ const SystemSetting = ({ onOk, loading }: IProps) => {
|
||||
{t('systemModelDescription')}
|
||||
</div>
|
||||
</div>
|
||||
<div className="px-7 py-6 space-y-6 max-h-[70vh] overflow-y-auto border rounded-lg">
|
||||
<div className="px-7 py-6 space-y-6 max-h-[70vh] overflow-y-auto border border-border-button rounded-lg">
|
||||
{llmList.map((item) => (
|
||||
<Items key={item.id} {...item} />
|
||||
))}
|
||||
|
||||
@ -122,7 +122,7 @@ export const AvailableModels: FC<{
|
||||
{filteredModels.map((model) => (
|
||||
<div
|
||||
key={model.name}
|
||||
className=" border border-border-default rounded-lg p-3 hover:bg-bg-input transition-colors group"
|
||||
className=" border border-border-button rounded-lg p-3 hover:bg-bg-input transition-colors group"
|
||||
>
|
||||
<div className="flex items-center space-x-3 mb-3">
|
||||
<LlmIcon name={model.name} imgClass="h-8 w-8 text-text-primary" />
|
||||
|
||||
@ -11,7 +11,7 @@ export const UsedModel = ({
|
||||
}) => {
|
||||
const { factoryList, myLlmList: llmList, loading } = useSelectLlmList();
|
||||
return (
|
||||
<div className="flex flex-col w-full gap-4 mb-4">
|
||||
<div className="flex flex-col w-full gap-5 mb-4">
|
||||
<div className="text-text-primary text-2xl font-medium mb-2 mt-4">
|
||||
{t('setting.addedModels')}
|
||||
</div>
|
||||
|
||||
@ -13,6 +13,7 @@ import {
|
||||
import { useFetchTenantInfo } from '@/hooks/user-setting-hooks';
|
||||
import { IAddLlmRequestBody } from '@/interfaces/request/llm';
|
||||
import { getRealModelName } from '@/utils/llm-util';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { useCallback, useState } from 'react';
|
||||
import { ApiKeyPostBody } from '../interface';
|
||||
|
||||
@ -29,7 +30,7 @@ export const useSubmitApiKey = () => {
|
||||
hideModal: hideApiKeyModal,
|
||||
showModal: showApiKeyModal,
|
||||
} = useSetModalState();
|
||||
|
||||
const queryClient = useQueryClient();
|
||||
const onApiKeySavingOk = useCallback(
|
||||
async (postBody: ApiKeyPostBody) => {
|
||||
const ret = await saveApiKey({
|
||||
@ -38,11 +39,12 @@ export const useSubmitApiKey = () => {
|
||||
});
|
||||
|
||||
if (ret === 0) {
|
||||
queryClient.invalidateQueries({ queryKey: ['llmList'] });
|
||||
hideApiKeyModal();
|
||||
setEditMode(false);
|
||||
}
|
||||
},
|
||||
[hideApiKeyModal, saveApiKey, savingParams],
|
||||
[hideApiKeyModal, saveApiKey, savingParams, queryClient],
|
||||
);
|
||||
|
||||
const onShowApiKeyModal = useCallback(
|
||||
|
||||
@ -193,9 +193,9 @@ const ModelProviders = () => {
|
||||
[showApiKeyModal, showLlmAddingModal, ModalMap, detailedLlmList],
|
||||
);
|
||||
return (
|
||||
<div className="flex w-full border-[0.5px] border-border-default rounded-lg relative ">
|
||||
<div className="flex w-full border-[0.5px] border-border-button rounded-lg relative ">
|
||||
<Spotlight />
|
||||
<section className="flex flex-col gap-4 w-3/5 px-5 border-r border-border-button overflow-auto scrollbar-auto">
|
||||
<section className="flex flex-col gap-4 w-3/5 px-5 border-r-[0.5px] border-border-button overflow-auto scrollbar-auto">
|
||||
<SystemSetting
|
||||
onOk={onSystemSettingSavingOk}
|
||||
loading={saveSystemModelSettingLoading}
|
||||
|
||||
@ -69,7 +69,7 @@ const ApiKeyModal = ({
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={editMode ? t('editModel') : t('modify')}
|
||||
title={t('configureModelTitle')}
|
||||
open={visible}
|
||||
onOpenChange={(open) => !open && hideModal()}
|
||||
onOk={handleOk}
|
||||
@ -77,6 +77,7 @@ const ApiKeyModal = ({
|
||||
confirmLoading={loading}
|
||||
okText={t('save')}
|
||||
cancelText={t('cancel')}
|
||||
className="!w-[600px]"
|
||||
>
|
||||
<Form {...form}>
|
||||
<div className="space-y-4 py-4">
|
||||
@ -85,9 +86,11 @@ const ApiKeyModal = ({
|
||||
rules={{ required: t('apiKeyMessage') }}
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel className="text-sm font-medium text-text-primary">
|
||||
<FormLabel
|
||||
className="text-sm font-medium text-text-secondary"
|
||||
required
|
||||
>
|
||||
{t('apiKey')}
|
||||
<span className="ml-1 text-destructive">*</span>
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
|
||||
Reference in New Issue
Block a user