您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

index.tsx 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import { useTestRetrieval } from '@/hooks/use-knowledge-request';
  2. import { useCallback, useState } from 'react';
  3. import { TopTitle } from '../dataset-title';
  4. import TestingForm from './testing-form';
  5. import { TestingResult } from './testing-result';
  6. function Vertical() {
  7. return <div>xxx</div>;
  8. }
  9. export default function RetrievalTesting() {
  10. const {
  11. loading,
  12. setValues,
  13. refetch,
  14. data,
  15. onPaginationChange,
  16. page,
  17. pageSize,
  18. handleFilterSubmit,
  19. filterValue,
  20. } = useTestRetrieval();
  21. const [count, setCount] = useState(1);
  22. const addCount = useCallback(() => {
  23. setCount(2);
  24. }, []);
  25. const removeCount = useCallback(() => {
  26. setCount(1);
  27. }, []);
  28. return (
  29. <div className="p-5">
  30. <section className="flex justify-between items-center">
  31. <TopTitle
  32. title={'Retrieval testing'}
  33. description={`Conduct a retrieval test to check if RAGFlow can recover the intended content for the LLM.`}
  34. ></TopTitle>
  35. {/* <Button>Save as Preset</Button> */}
  36. </section>
  37. {count === 1 ? (
  38. <section className="flex divide-x h-full">
  39. <div className="p-4 flex-1">
  40. <div className="flex justify-between pb-2.5">
  41. <span className="text-text-primary font-semibold text-2xl">
  42. Test setting
  43. </span>
  44. {/* <Button variant={'outline'} onClick={addCount}>
  45. <Plus /> Add New Test
  46. </Button> */}
  47. </div>
  48. <TestingForm
  49. loading={loading}
  50. setValues={setValues}
  51. refetch={refetch}
  52. ></TestingForm>
  53. </div>
  54. <TestingResult
  55. data={data}
  56. page={page}
  57. pageSize={pageSize}
  58. filterValue={filterValue}
  59. handleFilterSubmit={handleFilterSubmit}
  60. onPaginationChange={onPaginationChange}
  61. ></TestingResult>
  62. </section>
  63. ) : (
  64. <section className="flex gap-2">
  65. <div className="flex-1">
  66. <TestingForm
  67. loading={loading}
  68. setValues={setValues}
  69. refetch={refetch}
  70. ></TestingForm>
  71. <TestingResult
  72. data={data}
  73. page={page}
  74. pageSize={pageSize}
  75. filterValue={filterValue}
  76. handleFilterSubmit={handleFilterSubmit}
  77. onPaginationChange={onPaginationChange}
  78. ></TestingResult>
  79. </div>
  80. <div className="flex-1">
  81. <TestingForm
  82. loading={loading}
  83. setValues={setValues}
  84. refetch={refetch}
  85. ></TestingForm>
  86. <TestingResult
  87. data={data}
  88. page={page}
  89. pageSize={pageSize}
  90. filterValue={filterValue}
  91. handleFilterSubmit={handleFilterSubmit}
  92. onPaginationChange={onPaginationChange}
  93. ></TestingResult>
  94. </div>
  95. </section>
  96. )}
  97. </div>
  98. );
  99. }