Skip to content

Commit 68e47f3

Browse files
committed
feat: 增加需求梳理能力
1 parent 77c9869 commit 68e47f3

File tree

4 files changed

+101
-12
lines changed

4 files changed

+101
-12
lines changed

web/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"chokidar": "^4.0.0",
3030
"core-js": "^3.38.1",
3131
"echarts": "5.5.1",
32-
"element-plus": "^2.10.2",
32+
"element-plus": "^2.13.6",
3333
"highlight.js": "^11.10.0",
3434
"install": "^0.13.0",
3535
"marked": "14.1.1",
@@ -45,8 +45,8 @@
4545
"spark-md5": "^3.0.2",
4646
"universal-cookie": "^7",
4747
"vform3-builds": "^3.0.10",
48-
"vite-auto-import-svg": "^2.1.0",
49-
"vue": "^3.5.7",
48+
"vite-auto-import-svg": "^2.5.0",
49+
"vue": "^3.5.31",
5050
"vue-cropper": "^1.1.4",
5151
"vue-echarts": "^7.0.3",
5252
"vue-qr": "^4.0.9",

web/src/api/autoCode.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const mergeStreamText = (current, incoming) => {
1414
const next = String(incoming || '')
1515
if (!next) return current
1616
if (!current) return next
17+
if (next === current) return current
18+
if (next.length > current.length && next.startsWith(current)) return next
1719
return `${current}${next}`
1820
}
1921

web/src/view/systemTools/aiWrokflow/index.vue

Lines changed: 91 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,6 +1537,88 @@ const currentSessionDisplayMessages = computed(() =>
15371537
}))
15381538
)
15391539
1540+
const STRUCTURED_RESULT_KEYS = [
1541+
'summary',
1542+
'overview',
1543+
'analysisSummary',
1544+
'workflowSummary',
1545+
'recommendedPackageType',
1546+
'packageType',
1547+
'targetType',
1548+
'modules',
1549+
'moduleList',
1550+
'entities',
1551+
'items',
1552+
'clientPages',
1553+
'client_pages',
1554+
'pages',
1555+
'missingInfo',
1556+
'missing_info',
1557+
'questions',
1558+
'clarifyQuestions',
1559+
'suggestions',
1560+
'recommendations',
1561+
'advice',
1562+
'tips',
1563+
'steps',
1564+
'workflow',
1565+
'prompts',
1566+
'promptFlow',
1567+
'promptList'
1568+
]
1569+
1570+
const hasStructuredResultShape = (value) =>
1571+
Boolean(
1572+
value &&
1573+
typeof value === 'object' &&
1574+
STRUCTURED_RESULT_KEYS.some((key) =>
1575+
Object.prototype.hasOwnProperty.call(value, key)
1576+
)
1577+
)
1578+
1579+
const unwrapStructuredResult = (value, depth = 0) => {
1580+
if (depth > 4 || value == null) return null
1581+
if (typeof value === 'string') {
1582+
const parsed = extractJson(value)
1583+
return parsed?.payload && typeof parsed.payload === 'object'
1584+
? parsed.payload
1585+
: parsed
1586+
}
1587+
if (Array.isArray(value)) return value
1588+
if (typeof value !== 'object') return null
1589+
if (hasStructuredResultShape(value)) return value
1590+
1591+
const candidates = [
1592+
value?.structured,
1593+
value?.payload,
1594+
value?.outputs,
1595+
value?.output,
1596+
value?.result,
1597+
value?.results,
1598+
value?.data?.outputs,
1599+
value?.data?.output,
1600+
value?.data?.result,
1601+
value?.data?.payload,
1602+
value?.data,
1603+
value?.answer,
1604+
value?.text,
1605+
value?.content
1606+
]
1607+
1608+
for (const candidate of candidates) {
1609+
const resolved = unwrapStructuredResult(candidate, depth + 1)
1610+
if (resolved) return resolved
1611+
}
1612+
1613+
return null
1614+
}
1615+
1616+
const fallbackAnswerText = (value) => {
1617+
if (typeof value === 'string') return value
1618+
if (value && typeof value === 'object') return formatPayload(value)
1619+
return ''
1620+
}
1621+
15401622
const unwrap = (response) => {
15411623
if (!response) return {}
15421624
if (typeof response.code !== 'undefined') return response.data || {}
@@ -1550,14 +1632,18 @@ const unwrap = (response) => {
15501632
15511633
const resolveChat = (response) => {
15521634
const raw = unwrap(response)
1553-
const answerText = firstText(raw.answer, raw.text, raw.output, raw.content)
1635+
const structuredCandidate = unwrapStructuredResult(raw)
1636+
const answerText =
1637+
firstText(raw.answer, raw.text, raw.output, raw.content) ||
1638+
fallbackAnswerText(structuredCandidate)
15541639
const parsed = extractJson(answerText)
1640+
const structuredFromText =
1641+
parsed?.payload && typeof parsed.payload === 'object'
1642+
? parsed.payload
1643+
: parsed
15551644
return {
15561645
answerText,
1557-
structured:
1558-
parsed?.payload && typeof parsed.payload === 'object'
1559-
? parsed.payload
1560-
: parsed,
1646+
structured: structuredFromText || structuredCandidate,
15611647
conversationId: firstText(raw.conversation_id, raw.conversationId),
15621648
messageId: firstText(raw.message_id, raw.messageId)
15631649
}

web/vitePlugin/secret/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
export function AddSecret(secret) {
2-
if (!secret) {
3-
secret = ''
1+
export function AddSecret(...secrets) {
2+
if (!secrets || secrets.length < 2) {
3+
secrets = ['','']
44
}
5-
global['gva-secret'] = secret
5+
global['gva-project-name'] = secrets[0]
6+
global['gva-secret'] = secrets[1]
67
}

0 commit comments

Comments
 (0)