fix: AgentNotchView 动态高度 + 启动时权限已就绪不弹窗
This commit is contained in:
parent
6b9db7ce48
commit
701dc1f18f
@ -55,7 +55,6 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSSpeechSynthesizerDel
|
|||||||
// 两个权限都 OK → 直接启动
|
// 两个权限都 OK → 直接启动
|
||||||
if hasAccessibility && hasInputMonitoring {
|
if hasAccessibility && hasInputMonitoring {
|
||||||
startKeyMonitor()
|
startKeyMonitor()
|
||||||
showReadyAlert()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -126,9 +126,7 @@ struct AgentNotchView: View {
|
|||||||
// MARK: - 实时流式输出
|
// MARK: - 实时流式输出
|
||||||
|
|
||||||
private var streamingContentView: some View {
|
private var streamingContentView: some View {
|
||||||
let hasTools = !tracker.toolEntries.isEmpty
|
ScrollViewReader { proxy in
|
||||||
|
|
||||||
return ScrollViewReader { proxy in
|
|
||||||
ScrollView(.vertical, showsIndicators: false) {
|
ScrollView(.vertical, showsIndicators: false) {
|
||||||
Text(tracker.streamingContent)
|
Text(tracker.streamingContent)
|
||||||
.font(.system(size: 12))
|
.font(.system(size: 12))
|
||||||
@ -137,8 +135,8 @@ struct AgentNotchView: View {
|
|||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.id("streaming_bottom")
|
.id("streaming_bottom")
|
||||||
}
|
}
|
||||||
.frame(height: hasTools ? maxStreamingHeight : nil)
|
.frame(minHeight: 40, maxHeight: maxStreamingHeight)
|
||||||
.frame(maxHeight: maxStreamingHeight)
|
.layoutPriority(1)
|
||||||
.padding(.horizontal, 14)
|
.padding(.horizontal, 14)
|
||||||
.padding(.vertical, 6)
|
.padding(.vertical, 6)
|
||||||
.onChange(of: tracker.streamingContent) { _, _ in
|
.onChange(of: tracker.streamingContent) { _, _ in
|
||||||
@ -172,11 +170,10 @@ struct AgentNotchView: View {
|
|||||||
.clipped()
|
.clipped()
|
||||||
.padding(.horizontal, 4)
|
.padding(.horizontal, 4)
|
||||||
.onReceive(tracker.$toolEntries) { entries in
|
.onReceive(tracker.$toolEntries) { entries in
|
||||||
// 并行工具调用防抖:0.1s 内连续出现只滚一次到底
|
|
||||||
scrollWorkItem?.cancel()
|
scrollWorkItem?.cancel()
|
||||||
let workItem = DispatchWorkItem {
|
let workItem = DispatchWorkItem {
|
||||||
withAnimation {
|
if let lastID = entries.last?.id {
|
||||||
if let lastID = entries.last?.id {
|
withAnimation(nil) {
|
||||||
proxy.scrollTo(lastID, anchor: .bottom)
|
proxy.scrollTo(lastID, anchor: .bottom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user