@@ -981,7 +981,7 @@ struct ChatScreen: View {
981981 . fill ( Color . white. opacity ( 0.06 ) )
982982 . frame ( height: 1 )
983983
984- NetworkDashboard ( client: client, modelManager: modelManager)
984+ NetworkDashboard ( client: client, modelManager: modelManager, store : store )
985985 . frame ( maxHeight: 220 )
986986 }
987987 . frame ( width: 240 )
@@ -5247,6 +5247,78 @@ struct BuildErrorBanner: View {
52475247 }
52485248}
52495249
5250+ // MARK: - Context Overflow Banner
5251+
5252+ struct ContextOverflowBanner : View {
5253+ let tokens : Int
5254+ var onSummarize : ( ) -> Void
5255+ var onNewThread : ( ) -> Void
5256+
5257+ private var percentage : Double {
5258+ min ( Double ( tokens) / 180_000.0 , 1.0 )
5259+ }
5260+
5261+ var body : some View {
5262+ HStack ( spacing: 10 ) {
5263+ Image ( systemName: " exclamationmark.triangle.fill " )
5264+ . font ( . system( size: 14 ) )
5265+ . foregroundStyle ( TrinityTheme . golden)
5266+
5267+ VStack ( alignment: . leading, spacing: 2 ) {
5268+ Text ( " Context overflow warning " )
5269+ . font ( . system( size: 12 , weight: . bold) )
5270+ . foregroundStyle ( TrinityTheme . golden)
5271+ Text ( " \( tokens) tokens ( \( Int ( percentage * 100 ) ) %) " )
5272+ . font ( . system( size: 10 ) )
5273+ . foregroundStyle ( Color . white. opacity ( 0.5 ) )
5274+ }
5275+
5276+ Spacer ( )
5277+
5278+ HStack ( spacing: 6 ) {
5279+ Button {
5280+ onSummarize ( )
5281+ } label: {
5282+ HStack ( spacing: 4 ) {
5283+ Image ( systemName: " text.alignleft " )
5284+ . font ( . system( size: 9 ) )
5285+ Text ( " Summarize " )
5286+ . font ( . system( size: 10 , weight: . bold) )
5287+ }
5288+ . foregroundStyle ( . black)
5289+ . padding ( . horizontal, 10 )
5290+ . padding ( . vertical, 4 )
5291+ . background ( TrinityTheme . golden)
5292+ . clipShape ( Capsule ( ) )
5293+ }
5294+ . buttonStyle ( . plain)
5295+
5296+ Button {
5297+ onNewThread ( )
5298+ } label: {
5299+ Text ( " New thread " )
5300+ . font ( . system( size: 10 , weight: . bold) )
5301+ . foregroundStyle ( TrinityTheme . accent)
5302+ . padding ( . horizontal, 8 )
5303+ . padding ( . vertical, 4 )
5304+ . background ( Color . white. opacity ( 0.08 ) )
5305+ . clipShape ( Capsule ( ) )
5306+ }
5307+ . buttonStyle ( . plain)
5308+ }
5309+ }
5310+ . padding ( 10 )
5311+ . background ( TrinityTheme . golden. opacity ( 0.08 ) )
5312+ . clipShape ( RoundedRectangle ( cornerRadius: 10 ) )
5313+ . overlay (
5314+ RoundedRectangle ( cornerRadius: 10 )
5315+ . stroke ( TrinityTheme . golden. opacity ( 0.3 ) , lineWidth: 1 )
5316+ )
5317+ . padding ( . horizontal, 60 )
5318+ . padding ( . bottom, 8 )
5319+ }
5320+ }
5321+
52505322// MARK: - Memory Proposal Card (Feature 8)
52515323
52525324struct MemoryProposalCard : View {
@@ -5460,6 +5532,7 @@ struct LiveSpeedIndicator: View {
54605532struct NetworkDashboard : View {
54615533 @ObservedObject var client : ChatClient
54625534 @ObservedObject var modelManager : ModelManager
5535+ @ObservedObject var store : ThreadStore
54635536 @StateObject private var networkLog = NetworkLog . shared
54645537 @State private var isExpanded = false
54655538
@@ -5596,7 +5669,7 @@ struct NetworkDashboard: View {
55965669 @ViewBuilder
55975670 private var offlineQueueSection : some View {
55985671 if !client. offlineQueue. isEmpty {
5599- VStack ( alignment: . leading, spacing: 2 ) {
5672+ VStack ( alignment: . leading, spacing: 8 ) {
56005673 Text ( " Offline Queue ( \( client. offlineQueue. count) ) " )
56015674 . font ( . system( size: 9 , weight: . bold) )
56025675 . foregroundStyle ( TrinityTheme . statusWarn)
@@ -5617,45 +5690,33 @@ struct NetworkDashboard: View {
56175690 . buttonStyle ( . plain)
56185691 }
56195692 }
5620- }
5621-
5622- // TODO: Re-enable when onSummarize is implemented
5623- // Spacer()
5624- // Button {
5625- // onSummarize()
5626- // } label: {
5627- // Text("Summarize")
5628- // .font(.system(size: 10, weight: .bold))
5629- // .foregroundStyle(.black)
5630- // .padding(.horizontal, 8)
5631- // .padding(.vertical, 4)
5632- // .background(TrinityTheme.golden)
5633- // .clipShape(Capsule())
5634- // }
5635- // .buttonStyle(.plain)
56365693
5637- Button {
5638- onNewThread ( )
5639- } label: {
5640- Text ( " New thread " )
5641- . font ( . system( size: 10 , weight: . bold) )
5642- . foregroundStyle ( TrinityTheme . accent)
5643- . padding ( . horizontal, 8 )
5644- . padding ( . vertical, 4 )
5645- . background ( Color . white. opacity ( 0.08 ) )
5646- . clipShape ( Capsule ( ) )
5694+ HStack {
5695+ Spacer ( )
5696+ Button {
5697+ store. newThread ( )
5698+ } label: {
5699+ Text ( " New thread " )
5700+ . font ( . system( size: 10 , weight: . bold) )
5701+ . foregroundStyle ( TrinityTheme . accent)
5702+ . padding ( . horizontal, 8 )
5703+ . padding ( . vertical, 4 )
5704+ . background ( Color . white. opacity ( 0.08 ) )
5705+ . clipShape ( Capsule ( ) )
5706+ }
5707+ . buttonStyle ( . plain)
5708+ }
56475709 }
5648- . buttonStyle ( . plain)
5710+ . padding ( 10 )
5711+ . background ( TrinityTheme . golden. opacity ( 0.08 ) )
5712+ . clipShape ( RoundedRectangle ( cornerRadius: 10 ) )
5713+ . overlay (
5714+ RoundedRectangle ( cornerRadius: 10 )
5715+ . stroke ( TrinityTheme . golden. opacity ( 0.3 ) , lineWidth: 1 )
5716+ )
5717+ . padding ( . horizontal, 60 )
5718+ . padding ( . bottom, 6 )
56495719 }
5650- . padding ( 10 )
5651- . background ( TrinityTheme . golden. opacity ( 0.08 ) )
5652- . clipShape ( RoundedRectangle ( cornerRadius: 10 ) )
5653- . overlay (
5654- RoundedRectangle ( cornerRadius: 10 )
5655- . stroke ( TrinityTheme . golden. opacity ( 0.3 ) , lineWidth: 1 )
5656- )
5657- . padding ( . horizontal, 60 )
5658- . padding ( . bottom, 6 )
56595720 }
56605721}
56615722
0 commit comments