mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-05-03 16:57:48 +08:00
### What problem does this PR solve? Feat: Configure structured data output for agent forms #10866 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
46
web/src/components/jsonjoy-builder/lib/utils.ts
Normal file
46
web/src/components/jsonjoy-builder/lib/utils.ts
Normal file
@ -0,0 +1,46 @@
|
||||
import { clsx, type ClassValue } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
import type { Translation } from '../i18n/translation-keys.ts';
|
||||
import type { SchemaType } from '../types/jsonSchema.ts';
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
||||
// Helper functions for backward compatibility
|
||||
export const getTypeColor = (type: SchemaType): string => {
|
||||
switch (type) {
|
||||
case 'string':
|
||||
return 'text-blue-500 bg-blue-50';
|
||||
case 'number':
|
||||
case 'integer':
|
||||
return 'text-purple-500 bg-purple-50';
|
||||
case 'boolean':
|
||||
return 'text-green-500 bg-green-50';
|
||||
case 'object':
|
||||
return 'text-orange-500 bg-orange-50';
|
||||
case 'array':
|
||||
return 'text-pink-500 bg-pink-50';
|
||||
case 'null':
|
||||
return 'text-gray-500 bg-gray-50';
|
||||
}
|
||||
};
|
||||
|
||||
// Get type display label
|
||||
export const getTypeLabel = (t: Translation, type: SchemaType): string => {
|
||||
switch (type) {
|
||||
case 'string':
|
||||
return t.schemaTypeString;
|
||||
case 'number':
|
||||
case 'integer':
|
||||
return t.schemaTypeNumber;
|
||||
case 'boolean':
|
||||
return t.schemaTypeBoolean;
|
||||
case 'object':
|
||||
return t.schemaTypeObject;
|
||||
case 'array':
|
||||
return t.schemaTypeArray;
|
||||
case 'null':
|
||||
return t.schemaTypeNull;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user