|
@@ -1,6 +1,25 @@
|
|
|
import { useMemo, useState } from 'react'
|
|
import { useMemo, useState } from 'react'
|
|
|
import { submitManualQueryBatch } from '../../api/workbench.js'
|
|
import { submitManualQueryBatch } from '../../api/workbench.js'
|
|
|
|
|
|
|
|
|
|
+const JSON_EXAMPLE = `{
|
|
|
|
|
+ "queries": [
|
|
|
|
|
+ "符号 视频 灵感 怎么做",
|
|
|
|
|
+ "符号 视频 灵感 有哪些",
|
|
|
|
|
+ {
|
|
|
|
|
+ "query_text": "叙事体裁 视频 灵感 为什么",
|
|
|
|
|
+ "axes": {
|
|
|
|
|
+ "实质": "叙事体裁",
|
|
|
|
|
+ "模态": "视频",
|
|
|
|
|
+ "业务阶段": "灵感",
|
|
|
|
|
+ "知识类型": "为什么"
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {
|
|
|
|
|
+ "source": "manual_upload"
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+}`
|
|
|
|
|
+
|
|
|
function normalizeJsonQueries(value) {
|
|
function normalizeJsonQueries(value) {
|
|
|
if (Array.isArray(value)) return value
|
|
if (Array.isArray(value)) return value
|
|
|
if (!value || typeof value !== 'object') return []
|
|
if (!value || typeof value !== 'object') return []
|
|
@@ -89,10 +108,16 @@ export default function ManualQueryModal({ mode, onClose, onSubmitted }) {
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
{mode === 'json' ? (
|
|
{mode === 'json' ? (
|
|
|
- <label className="manual-upload">
|
|
|
|
|
- <input accept=".json,application/json" type="file" onChange={onFileChange} />
|
|
|
|
|
- <span>{fileName || '选择 JSON 文件'}</span>
|
|
|
|
|
- </label>
|
|
|
|
|
|
|
+ <>
|
|
|
|
|
+ <label className="manual-upload">
|
|
|
|
|
+ <input accept=".json,application/json" type="file" onChange={onFileChange} />
|
|
|
|
|
+ <span>{fileName || '选择 JSON 文件'}</span>
|
|
|
|
|
+ </label>
|
|
|
|
|
+ <div className="manual-json-example">
|
|
|
|
|
+ <div className="manual-json-example-title">JSON 格式案例</div>
|
|
|
|
|
+ <pre>{JSON_EXAMPLE}</pre>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </>
|
|
|
) : (
|
|
) : (
|
|
|
<textarea
|
|
<textarea
|
|
|
className="manual-textarea"
|
|
className="manual-textarea"
|