Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
王蔡翾
rz-GB-web
Commits
6ed251e9
Commit
6ed251e9
authored
Nov 13, 2026
by
王蔡翾
Browse files
bug修复
parent
60f45bfe
Changes
6
Show whitespace changes
Inline
Side-by-side
scripts/verify-prototype.mjs
View file @
6ed251e9
import
assert
from
'
node:assert/strict
'
import
{
extractProfileFromText
}
from
'
../src/lib/profileImport.ts
'
import
{
registrationDate
,
registrationReminder
}
from
'
../src/lib/day2.ts
'
import
{
researchSourceLabel
,
toolNames
}
from
'
../src/lib/day3.ts
'
// 验收型公司名称曾触发“业绩”误识别;导入应保留原文事实并去掉字段标签。
const
draft
=
extractProfileFromText
(
'
杭州验收科技有限公司
\n
主营业务:智慧水务、监测设备
\n
服务地区:浙江、江苏
\n
资质:电子与智能化工程专业承包二级
'
)
...
...
@@ -25,4 +26,11 @@ const deadline = ['报名截止时间:2026年11月11日17:30']
assert
.
equal
(
registrationReminder
(
deadline
,
'
2026-11-11
'
,
Date
.
parse
(
'
2026-11-11T17:29:59+08:00
'
))?.
label
,
'
报名今天截止
'
)
assert
.
equal
(
registrationReminder
(
deadline
,
'
2026-11-11
'
,
Date
.
parse
(
'
2026-11-11T17:30:00+08:00
'
))?.
label
,
'
报名已截止
'
)
assert
.
equal
(
registrationReminder
(
deadline
,
'
2026-11-11
'
)?.
display
,
'
2026-11-11 17:30
'
)
console
.
log
(
'
原型交互数据检查通过(18 项断言)
'
)
// 历史回答来源中既有后端工具名,也有真实标题。展示时应保留专名,并为缺失标题提供中文提示。
assert
.
equal
(
toolNames
.
SNAPSHOT_QA
,
'
生成追问回答
'
)
assert
.
equal
(
researchSourceLabel
(
'
get_company_profile
'
,
false
),
'
基础画像
'
)
assert
.
equal
(
researchSourceLabel
(
'
North Water Holdings Ltd.
'
,
true
),
'
North Water Holdings Ltd.
'
)
assert
.
equal
(
researchSourceLabel
(
'
'
,
true
),
'
查看原始来源
'
)
assert
.
equal
(
researchSourceLabel
(
undefined
,
false
),
'
已核验资料
'
)
console
.
log
(
'
原型交互数据检查通过
'
)
src/components/ConversationView.tsx
View file @
6ed251e9
import
{
createUuid
}
from
'
../lib/uuid
'
import
{
useEffect
,
useRef
,
useState
}
from
'
react
'
import
{
useCallback
,
useEffect
,
useRef
,
useState
}
from
'
react
'
import
type
{
ReactNode
}
from
'
react
'
import
{
Send
,
Loader2
}
from
'
lucide-react
'
import
{
useNavigate
}
from
'
react-router
'
...
...
@@ -20,7 +20,12 @@ export function ConversationView({ id: initialId, scope: initialScope, embedded
const
[
input
,
setInput
]
=
useState
(
''
),
[
error
,
setError
]
=
useState
(
''
),
[
busy
,
setBusy
]
=
useState
(
false
)
const
[
ready
,
setReady
]
=
useState
(
!
id
)
const
scrollRef
=
useRef
<
HTMLDivElement
>
(
null
)
useEffect
(()
=>
{
scrollRef
.
current
?.
scrollTo
({
top
:
scrollRef
.
current
.
scrollHeight
,
behavior
:
'
smooth
'
})
},
[
messages
])
const
scrollToBottom
=
useCallback
(()
=>
{
const
scrollArea
=
scrollRef
.
current
if
(
scrollArea
)
scrollArea
.
scrollTo
({
top
:
scrollArea
.
scrollHeight
})
},
[])
// 提问先加入消息列表,回答随后由卡片加载。两个更新都需要在对应内容渲染后计算底部位置。
useEffect
(
scrollToBottom
,
[
messages
,
scrollToBottom
])
const
inFlight
=
useRef
(
false
)
// 网络结果未知时保留会话与幂等键;重复点击或手动重试不产生第二次模型请求。
const
pending
=
useRef
<
{
signature
:
string
;
key
:
string
;
conversationId
?:
string
}
|
null
>
(
null
)
...
...
@@ -69,8 +74,8 @@ export function ConversationView({ id: initialId, scope: initialScope, embedded
{
!
ready
&&
!
error
&&
<
p
role
=
"status"
className
=
"text-sm text-ink-400"
>
正在读取历史会话…
</
p
>
}
{
messages
.
map
(
row
=>
embedded
?
<
article
key
=
{
row
.
id
}
className
=
"space-y-3"
>
<
div
className
=
"flex justify-end"
><
p
className
=
"max-w-[85%] whitespace-pre-wrap rounded-2xl rounded-br-sm bg-brand-500 px-4 py-2 text-[14px] text-white shadow-[0_2px_8px_rgba(99,102,241,.25)]"
>
{
row
.
content
}
</
p
></
div
>
{
row
.
task_id
&&
<
ResearchTask
id
=
{
row
.
task_id
}
/>
}
</
article
>
:
row
.
task_id
?
<
ResearchTask
key
=
{
row
.
id
}
id
=
{
row
.
task_id
}
title
=
{
row
.
content
}
/>
:
<
article
key
=
{
row
.
id
}
className
=
"rounded-[16px] bg-white px-4 py-3 font-bold whitespace-pre-wrap"
>
{
row
.
content
}
</
article
>)
}
{
row
.
task_id
&&
<
ResearchTask
id
=
{
row
.
task_id
}
onSettled
=
{
scrollToBottom
}
/>
}
</
article
>
:
row
.
task_id
?
<
ResearchTask
key
=
{
row
.
id
}
id
=
{
row
.
task_id
}
title
=
{
row
.
content
}
onSettled
=
{
scrollToBottom
}
/>
:
<
article
key
=
{
row
.
id
}
className
=
"rounded-[16px] bg-white px-4 py-3 font-bold whitespace-pre-wrap"
>
{
row
.
content
}
</
article
>)
}
</
div
>
</
div
>
...
...
src/components/OpportunityTable.tsx
View file @
6ed251e9
...
...
@@ -53,7 +53,8 @@ export function OpportunityTable({ items, batchId, onOpenPanel }: {
<
td
className
=
"whitespace-nowrap px-3 py-3"
>
{
p
.
budgetWan
==
null
?
<
span
className
=
"text-ink-400"
>
未披露
</
span
>
:
<
span
className
=
"font-num font-bold"
>
{
p
.
budgetWan
.
toLocaleString
()
}
<
span
className
=
"text-xs font-medium text-ink-400"
>
万元
</
span
></
span
>
}
</
td
>
<
td
className
=
"px-3 py-3 text-xs"
><
p
className
=
{
`font-semibold
${
reminder
&&
reminder
.
days
>=
0
&&
reminder
.
days
<=
7
?
'
text-bad-500
'
:
'
text-ink-600
'
}
`
}
>
{
reminder
?.
label
??
'
报名截止时间待核验
'
}
</
p
>
{
reminder
&&
<
time
className
=
"mt-1 block font-num text-ink-600"
dateTime
=
{
reminder
.
dateTime
}
>
{
reminder
.
display
}
</
time
>
}{
timing
&&
<
p
className
=
"mt-1 break-words text-ink-600"
>
{
timing
}
</
p
>
}
<
p
className
=
"mt-1 font-num text-ink-400"
>
发布
{
p
.
publishDate
||
'
未知
'
}
</
p
></
td
>
<
td
className
=
"px-3 py-3 text-xs leading-relaxed text-ink-600"
>
{
summary
?.
conclusion
?.
participation
||
((
requirements
.
length
?
requirements
:
qualifications
).
slice
(
0
,
2
).
map
((
line
,
i
)
=>
<
p
key
=
{
i
}
className
=
"mb-1 break-words"
>
{
line
}
</
p
>))
}{
!
summary
?.
conclusion
?.
participation
&&
!
qualifications
.
length
&&
'
请核对公告中的资格和业绩要求
'
}
</
td
>
<
td
className
=
"px-3 py-3"
><
Popover
.
Root
open
=
{
scoreProject
===
p
.
id
}
onOpenChange
=
{
value
=>
setScoreProject
(
value
?
p
.
id
:
null
)
}
><
Popover
.
Trigger
asChild
><
button
onMouseEnter
=
{
()
=>
setScoreProject
(
p
.
id
)
}
onMouseLeave
=
{
()
=>
setScoreProject
(
null
)
}
onFocus
=
{
()
=>
setScoreProject
(
p
.
id
)
}
onBlur
=
{
()
=>
setScoreProject
(
null
)
}
onClick
=
{
e
=>
e
.
stopPropagation
()
}
className
=
"whitespace-nowrap font-num text-[15px] font-bold text-brand-500"
aria
-
label
=
{
`查看
${
p
.
title
}
匹配度构成`
}
>
{
match
?.
score
??
'
—
'
}{
match
?.
score
!=
null
&&
<
span
className
=
"text-xs font-medium text-ink-400"
>
分
</
span
>
}
</
button
></
Popover
.
Trigger
><
Popover
.
Portal
><
Popover
.
Content
onClick
=
{
e
=>
e
.
stopPropagation
()
}
sideOffset
=
{
8
}
className
=
"z-50 w-72 rounded-card border border-line-soft bg-white p-3 shadow-card-hover"
><
h4
className
=
"text-xs font-medium"
>
贴合度打分构成
</
h4
>
{
match
?
<><
ul
className
=
"mt-2 space-y-2"
>
{
Object
.
entries
(
match
.
dimensions
).
map
(([
key
,
dim
])
=>
<
li
key
=
{
key
}
className
=
"text-xs"
><
div
className
=
"flex justify-between"
><
span
>
{
defaultMatchDimNames
[
key
as
keyof
typeof
defaultMatchDimNames
]
??
key
}
· 权重
{
match
.
weights
[
key
]
}
%
</
span
><
b
>
{
dim
.
known
?
`
${
dim
.
score
}
分`
:
'
待核验
'
}
</
b
></
div
><
p
className
=
"mt-0.5 text-[11px] text-ink-400"
>
{
dim
.
basis
}
</
p
></
li
>)
}
</
ul
><
p
className
=
"mt-2 text-[11px] text-ink-400"
>
完整性
{
match
.
completeness
}
% · 档案 v
{
match
.
profileVersion
}
·
{
match
.
limitation
}
</
p
></>
:
<
p
className
=
"mt-2 text-xs text-ink-400"
>
尚无已保存评分,请完善公司档案后重新检索。
</
p
>
}
</
Popover
.
Content
></
Popover
.
Portal
></
Popover
.
Root
></
td
>
{
/* 匹配度是只读浮层。悬停时不抢现有光标,关闭时也不把刚切到检索框的焦点还给分数按钮。 */
}
<
td
className
=
"px-3 py-3"
><
Popover
.
Root
open
=
{
scoreProject
===
p
.
id
}
onOpenChange
=
{
value
=>
setScoreProject
(
value
?
p
.
id
:
null
)
}
><
Popover
.
Trigger
asChild
><
button
onMouseEnter
=
{
()
=>
setScoreProject
(
p
.
id
)
}
onMouseLeave
=
{
()
=>
setScoreProject
(
null
)
}
onFocus
=
{
()
=>
setScoreProject
(
p
.
id
)
}
onBlur
=
{
()
=>
setScoreProject
(
null
)
}
onClick
=
{
e
=>
e
.
stopPropagation
()
}
className
=
"whitespace-nowrap font-num text-[15px] font-bold text-brand-500"
aria
-
label
=
{
`查看
${
p
.
title
}
匹配度构成`
}
>
{
match
?.
score
??
'
—
'
}{
match
?.
score
!=
null
&&
<
span
className
=
"text-xs font-medium text-ink-400"
>
分
</
span
>
}
</
button
></
Popover
.
Trigger
><
Popover
.
Portal
><
Popover
.
Content
onOpenAutoFocus
=
{
e
=>
e
.
preventDefault
()
}
onCloseAutoFocus
=
{
e
=>
e
.
preventDefault
()
}
onClick
=
{
e
=>
e
.
stopPropagation
()
}
sideOffset
=
{
8
}
className
=
"z-50 w-72 rounded-card border border-line-soft bg-white p-3 shadow-card-hover"
><
h4
className
=
"text-xs font-medium"
>
贴合度打分构成
</
h4
>
{
match
?
<><
ul
className
=
"mt-2 space-y-2"
>
{
Object
.
entries
(
match
.
dimensions
).
map
(([
key
,
dim
])
=>
<
li
key
=
{
key
}
className
=
"text-xs"
><
div
className
=
"flex justify-between"
><
span
>
{
defaultMatchDimNames
[
key
as
keyof
typeof
defaultMatchDimNames
]
??
key
}
· 权重
{
match
.
weights
[
key
]
}
%
</
span
><
b
>
{
dim
.
known
?
`
${
dim
.
score
}
分`
:
'
待核验
'
}
</
b
></
div
><
p
className
=
"mt-0.5 text-[11px] text-ink-400"
>
{
dim
.
basis
}
</
p
></
li
>)
}
</
ul
><
p
className
=
"mt-2 text-[11px] text-ink-400"
>
完整性
{
match
.
completeness
}
% · 档案 v
{
match
.
profileVersion
}
·
{
match
.
limitation
}
</
p
></>
:
<
p
className
=
"mt-2 text-xs text-ink-400"
>
尚无已保存评分,请完善公司档案后重新检索。
</
p
>
}
</
Popover
.
Content
></
Popover
.
Portal
></
Popover
.
Root
></
td
>
<
td
className
=
"whitespace-nowrap px-3 py-3"
><
div
className
=
"flex flex-wrap items-center gap-1.5"
><
button
onClick
=
{
e
=>
{
e
.
stopPropagation
();
open
(
item
)
}
}
className
=
"inline-flex items-center gap-1 rounded-full border-brand-gradient px-2.5 py-1 text-[12px] font-medium shadow-card hover:shadow-card-hover"
><
Sparkles
size
=
{
12
}
className
=
"text-brand-500"
/><
span
className
=
"text-brand-gradient"
>
AI 分析
</
span
></
button
>
<
button
disabled
=
{
saving
}
onClick
=
{
e
=>
{
e
.
stopPropagation
();
void
follow
(
p
.
id
)
}
}
aria
-
pressed
=
{
watched
}
aria
-
label
=
{
watched
?
'
取消重点关注
'
:
'
加入重点关注
'
}
className
=
"rounded-full p-1 text-brand-500 hover:bg-brand-50"
><
Star
size
=
{
15
}
fill
=
{
watched
?
'
currentColor
'
:
'
none
'
}
/></
button
>
{
watched
&&
<
button
onClick
=
{
e
=>
{
e
.
stopPropagation
();
setTagProject
(
p
.
id
)
}
}
aria
-
label
=
"管理关注标签"
className
=
"rounded-full p-1 text-ink-400 hover:bg-brand-50 hover:text-brand-500"
><
Tag
size
=
{
13
}
/></
button
>
}
...
...
src/components/ResearchTask.tsx
View file @
6ed251e9
import
{
createUuid
}
from
'
../lib/uuid
'
import
{
Check
,
ChevronDown
,
CircuitBoard
,
Loader2
}
from
'
lucide-react
'
import
{
useRef
,
useState
}
from
'
react
'
import
{
useEffect
,
useRef
,
useState
}
from
'
react
'
import
{
api
}
from
'
../lib/api
'
import
{
useTaskEvents
}
from
'
../hooks/useTaskEvents
'
import
type
{
ResearchReport
}
from
'
../lib/day3
'
import
{
toolNames
}
from
'
../lib/day3
'
import
{
researchSourceLabel
,
toolNames
}
from
'
../lib/day3
'
import
{
inputClass
,
message
}
from
'
../lib/day2
'
import
type
{
SearchReport
}
from
'
../lib/day2
'
import
{
MarketReport
}
from
'
./MarketReport
'
...
...
@@ -14,7 +14,7 @@ import { GhostButton, PrimaryButton } from './ui-ext/AiButton'
const
answerTime
=
new
Intl
.
DateTimeFormat
(
'
sv-SE
'
,
{
timeZone
:
'
Asia/Shanghai
'
,
year
:
'
numeric
'
,
month
:
'
2-digit
'
,
day
:
'
2-digit
'
,
hour
:
'
2-digit
'
,
minute
:
'
2-digit
'
})
/** 一次提交对应一张卡片,使用同一份任务状态渲染进展、确认表单、正文及完成时间。 */
export
function
ResearchTask
({
id
,
title
}:
{
id
:
string
;
title
?:
string
})
{
export
function
ResearchTask
({
id
,
title
,
onSettled
}:
{
id
:
string
;
title
?:
string
;
onSettled
?:
()
=>
void
})
{
const
[
revision
,
setRevision
]
=
useState
(
0
)
const
{
task
,
error
:
streamError
}
=
useTaskEvents
(
id
,
revision
)
const
[
busy
,
setBusy
]
=
useState
(
false
),
[
error
,
setError
]
=
useState
(
''
)
...
...
@@ -44,7 +44,12 @@ export function ResearchTask({ id, title }: { id: string; title?: string }) {
setRevision
(
x
=>
x
+
1
)
}
catch
(
e
)
{
setError
(
message
(
e
))
}
finally
{
setBusy
(
false
)
}
}
const
complete
=
!!
task
&&
!
[
'
RECEIVED
'
,
'
PLANNING
'
,
'
RUNNING
'
].
includes
(
task
.
status
)
const
settledStatus
=
task
&&
!
[
'
RECEIVED
'
,
'
PLANNING
'
,
'
RUNNING
'
].
includes
(
task
.
status
)
?
task
.
status
:
null
const
complete
=
settledStatus
!==
null
// 正文和待确认表单由任务回读异步渲染。等卡片提交到 DOM 后通知滚动区,同一状态的轮询回读无需重复滚动。
useEffect
(()
=>
{
if
(
settledStatus
)
onSettled
?.()
},
[
id
,
settledStatus
,
onSettled
])
const
hasChoices
=
report
?.
choices
?.
some
(
choice
=>
choice
.
options
.
length
>
0
&&
!
choice
.
selected
)
const
canContinue
=
task
?.
status
!==
'
WAITING_ENTITY
'
||
hasChoices
return
<
article
className
=
"rounded-[16px] bg-white px-4 py-3 shadow-card"
>
...
...
@@ -52,8 +57,11 @@ export function ResearchTask({ id, title }: { id: string; title?: string }) {
{
!
task
?
<
p
role
=
"status"
>
{
streamError
||
'
正在读取任务…
'
}
</
p
>
:
<>
{
/* 状态切换时重置展开状态。结束后默认收起,手动展开可回看;继续执行时重新展开。 */
}
<
details
key
=
{
`
${
id
}
:
${
complete
}
`
}
open
=
{
!
complete
}
className
=
"group mb-3 rounded-ctrl bg-canvas px-3 py-2"
>
<
summary
className
=
"flex cursor-pointer list-none items-center gap-2 text-[12px] font-semibold text-brand-500"
>
{
complete
?
<
CircuitBoard
size
=
{
13
}
/>
:
<
Loader2
size
=
{
13
}
className
=
"animate-spin"
/>
}
Skill 调用进展
<
ChevronDown
size
=
{
13
}
className
=
"-rotate-90 group-open:rotate-0"
/></
summary
>
<
ul
className
=
"mt-1 space-y-1"
>
{
task
.
calls
.
map
(
call
=>
<
li
key
=
{
String
(
call
.
id
)
}
className
=
"flex items-center gap-1.5 text-[12px] text-ink-600"
>
{
call
.
status
===
'
SUCCEEDED
'
?
<
Check
size
=
{
12
}
className
=
"text-ok-500"
/>
:
<
span
className
=
"h-3 w-3"
/>
}{
toolNames
[
String
(
call
.
tool_name
)]
??
String
(
call
.
tool_name
)
}
</
li
>)
}
</
ul
>
<
summary
className
=
"flex cursor-pointer list-none items-center gap-2 text-[12px] font-semibold text-brand-500"
>
{
complete
?
<
CircuitBoard
size
=
{
13
}
/>
:
<
Loader2
size
=
{
13
}
className
=
"animate-spin"
/>
}
技能调用进展
<
ChevronDown
size
=
{
13
}
className
=
"-rotate-90 group-open:rotate-0"
/></
summary
>
<
ul
className
=
"mt-1 space-y-1"
>
{
task
.
calls
.
map
(
call
=>
{
const
name
=
String
(
call
.
tool_name
)
return
<
li
key
=
{
String
(
call
.
id
)
}
className
=
"flex items-center gap-1.5 text-[12px] text-ink-600"
>
{
call
.
status
===
'
SUCCEEDED
'
?
<
Check
size
=
{
12
}
className
=
"text-ok-500"
/>
:
<
span
className
=
"h-3 w-3"
/>
}{
Object
.
hasOwn
(
toolNames
,
name
)
?
toolNames
[
name
]
:
'
处理调研资料
'
}
</
li
>
})
}
</
ul
>
</
details
>
{
(
error
||
streamError
)
&&
<
p
role
=
"alert"
className
=
"mb-2 text-xs text-bad-500"
>
{
error
||
streamError
}
</
p
>
}
{
(
task
.
status
.
startsWith
(
'
WAITING_
'
)
||
[
'
FAILED
'
,
'
PARTIAL
'
,
'
CANCELLED
'
].
includes
(
task
.
status
))
&&
task
.
question
&&
<
p
className
=
"mb-3 text-[13px] text-ink-600"
role
=
{
task
.
status
===
'
FAILED
'
?
'
alert
'
:
undefined
}
>
{
task
.
question
}
</
p
>
}
...
...
@@ -77,9 +85,13 @@ export function ResearchTask({ id, title }: { id: string; title?: string }) {
{
report
.
gaps
?.
length
>
0
&&
<
ul
className
=
"list-disc space-y-1 pl-5 text-[13px]"
>
{
report
.
gaps
.
map
(
gap
=>
<
li
key
=
{
gap
}
>
{
gap
}
</
li
>)
}
</
ul
>
}
{
report
.
kind
===
'
SNAPSHOT_QA
'
&&
complete
&&
task
.
evidence
.
length
>
0
&&
<
details
className
=
"rounded-ctrl bg-canvas px-3 py-1.5 text-[13px]"
>
<
summary
className
=
"cursor-pointer font-medium text-ink-900"
>
回答来源
</
summary
>
<
ul
className
=
"space-y-1"
>
{
task
.
evidence
.
filter
(
source
=>
source
.
verified
).
map
(
source
=>
<
li
key
=
{
source
.
id
}
className
=
"break-words"
>
{
source
.
url
&&
/^https
?
:
\/\/
/i
.
test
(
source
.
url
)
?
<
a
href
=
{
source
.
url
}
target
=
"_blank"
rel
=
"noopener noreferrer"
className
=
"text-brand-500 hover:underline"
>
{
source
.
title
||
'
打开原网页
'
}
</
a
>
:
source
.
title
||
source
.
locator
}
</
li
>)
}
</
ul
>
<
ul
className
=
"space-y-1"
>
{
task
.
evidence
.
filter
(
source
=>
source
.
verified
).
map
(
source
=>
{
const
url
=
source
.
url
&&
/^https
?
:
\/\/
/i
.
test
(
source
.
url
)
?
source
.
url
:
null
const
label
=
researchSourceLabel
(
source
.
title
,
!!
url
)
return
<
li
key
=
{
source
.
id
}
className
=
"break-words"
>
{
url
?
<
a
href
=
{
url
}
target
=
"_blank"
rel
=
"noopener noreferrer"
className
=
"text-brand-500 hover:underline"
>
{
label
}
</
a
>
:
label
}
</
li
>
})
}
</
ul
>
</
details
>
}
</
div
>
}
{
task
.
answeredAt
&&
<
time
dateTime
=
{
task
.
answeredAt
}
className
=
"mt-3 block font-num text-[11px] text-ink-400"
>
{
answerTime
.
format
(
new
Date
(
task
.
answeredAt
))
}
</
time
>
}
...
...
src/lib/day3.ts
View file @
6ed251e9
...
...
@@ -27,4 +27,13 @@ export const toolNames: Record<string, string> = {
find_competitors
:
'
真实投标竞对
'
,
search_bids
:
'
定位项目公告
'
,
get_bid_detail
:
'
项目正文
'
,
find_potential_bidders
:
'
潜在投标者
'
,
get_price_trends
:
'
品牌型号历史单价
'
,
web_search
:
'
检索公开资料
'
,
web_fetch
:
'
读取公开网页
'
,
model_json
:
'
生成有据建议
'
,
vision
:
'
识别文件页面
'
,
FILE_PARSE
:
'
本地文件提取
'
,
ENTITY_CACHE
:
'
读取已确认主体(缓存)
'
,
get_top_purchasers
:
'
统计主要采购方
'
,
get_top_suppliers
:
'
统计主要中标企业
'
,
// 快照追问的调用记录使用后端操作枚举,普通调研步骤则使用工具名。
SNAPSHOT_QA
:
'
生成追问回答
'
,
}
/** 历史快照既有工具名,也有公告、网页和上传文件的原始标题。只替换已知工具名,缺标题时用中文提示。 */
export
function
researchSourceLabel
(
title
:
string
|
undefined
,
hasLink
:
boolean
)
{
const
name
=
title
?.
trim
()
if
(
!
name
)
return
hasLink
?
'
查看原始来源
'
:
'
已核验资料
'
return
Object
.
hasOwn
(
toolNames
,
name
)
?
toolNames
[
name
]
:
name
}
src/pages/ResearchPage.tsx
View file @
6ed251e9
import
{
createUuid
}
from
'
../lib/uuid
'
import
{
useEffect
,
useRef
,
useState
}
from
'
react
'
import
{
useCallback
,
useEffect
,
useRef
,
useState
}
from
'
react
'
import
{
useSearchParams
}
from
'
react-router
'
import
{
MessagesSquare
,
UserSearch
,
GitCompareArrows
,
Map
,
Send
,
X
,
Loader2
}
from
'
lucide-react
'
import
{
api
}
from
'
../lib/api
'
...
...
@@ -31,6 +31,12 @@ export function ResearchPage() {
const
[
fileId
,
setFileId
]
=
useState
<
string
|
null
>
(
null
)
const
inFlight
=
useRef
(
false
)
const
pending
=
useRef
<
{
signature
:
string
;
key
:
string
;
conversationId
?:
string
}
|
null
>
(
null
)
const
taskScrollRef
=
useRef
<
HTMLDivElement
>
(
null
)
// 直接打开单个任务的链接时没有会话容器,等卡片渲染后滚动当前页面的内容区。
const
scrollTaskToBottom
=
useCallback
(()
=>
{
const
scrollArea
=
taskScrollRef
.
current
if
(
scrollArea
)
scrollArea
.
scrollTo
({
top
:
scrollArea
.
scrollHeight
})
},
[])
useEffect
(()
=>
{
if
(
entry
!==
'
project
'
&&
!
params
.
get
(
'
parent
'
))
return
...
...
@@ -87,8 +93,8 @@ export function ResearchPage() {
if
(
conversationId
||
qaBatch
||
qaProject
)
return
<
ConversationView
key
=
{
conversationId
??
`
${
qaBatch
}
:
${
qaProject
}
`
}
id
=
{
conversationId
??
undefined
}
scope
=
{
qaBatch
||
qaProject
?
{
batchId
:
qaBatch
,
projectId
:
qaProject
}
:
undefined
}
/>
return
<
div
className
=
"flex h-full"
>
<
div
className
=
"flex min-w-0 flex-1 flex-col"
>
<
div
className
=
"flex-1 overflow-y-auto px-6 py-5 scrollbar-thin"
>
{
selected
?
<
div
className
=
"mx-auto max-w-[820px] space-y-4"
><
ResearchTask
id
=
{
selected
}
/></
div
>
:
<
div
className
=
"mx-auto max-w-[720px] pt-10"
>
<
div
ref
=
{
taskScrollRef
}
className
=
"flex-1 overflow-y-auto px-6 py-5 scrollbar-thin"
>
{
selected
?
<
div
className
=
"mx-auto max-w-[820px] space-y-4"
><
ResearchTask
id
=
{
selected
}
onSettled
=
{
scrollTaskToBottom
}
/></
div
>
:
<
div
className
=
"mx-auto max-w-[720px] pt-10"
>
<
div
className
=
"text-center"
>
<
div
className
=
"mx-auto flex h-14 w-14 items-center justify-center rounded-2xl shadow-card-hover"
style
=
{
{
background
:
'
linear-gradient(135deg, #6366F1 0%, #818CF8 100%)
'
}
}
><
MessagesSquare
size
=
{
24
}
className
=
"text-white"
/></
div
>
<
h1
className
=
"mt-4 text-[22px] font-bold"
>
对话
<
span
className
=
"text-brand-gradient"
>
调研
</
span
></
h1
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment