mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Feat: add trino support (#10512)
### What problem does this PR solve? issue: [#10296](https://github.com/infiniflow/ragflow/issues/10296) change: - ExeSQL: support connecting to Trino. - Validation: password can be empty only when db_type === "trino"; all other database types keep the existing requirement (non-empty). ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -8,14 +8,27 @@ export const ExeSQLFormSchema = {
|
||||
username: z.string().min(1),
|
||||
host: z.string().min(1),
|
||||
port: z.number(),
|
||||
password: z.string().min(1),
|
||||
password: z.string().optional().or(z.literal('')),
|
||||
max_records: z.number(),
|
||||
};
|
||||
|
||||
export const FormSchema = z.object({
|
||||
sql: z.string().optional(),
|
||||
...ExeSQLFormSchema,
|
||||
});
|
||||
export const FormSchema = z
|
||||
.object({
|
||||
sql: z.string().optional(),
|
||||
...ExeSQLFormSchema,
|
||||
})
|
||||
.superRefine((v, ctx) => {
|
||||
if (
|
||||
v.db_type !== 'trino' &&
|
||||
!(v.password && v.password.trim().length > 0)
|
||||
) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
path: ['password'],
|
||||
message: 'String must contain at least 1 character(s)',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export function useSubmitForm() {
|
||||
const { testDbConnect, loading } = useTestDbConnect();
|
||||
|
||||
@ -2139,6 +2139,7 @@ export const ExeSQLOptions = [
|
||||
'mariadb',
|
||||
'mssql',
|
||||
'IBM DB2',
|
||||
'trino',
|
||||
].map((x) => ({
|
||||
label: upperFirst(x),
|
||||
value: x,
|
||||
|
||||
Reference in New Issue
Block a user