Skip to content

Commit 5788ee1

Browse files
committed
Added PythonKit + fixed input field lag
1 parent 1af96c1 commit 5788ee1

4 files changed

Lines changed: 49 additions & 7 deletions

File tree

interview_coder.xcodeproj/project.pbxproj

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
7B110A432E9DC96C0093D372 /* PythonKit in Frameworks */ = {isa = PBXBuildFile; productRef = 7B110A422E9DC96C0093D372 /* PythonKit */; };
1011
7B2D06A92E97BC8E00369D76 /* MarkdownUI in Frameworks */ = {isa = PBXBuildFile; productRef = 7B2D06A82E97BC8E00369D76 /* MarkdownUI */; };
1112
/* End PBXBuildFile section */
1213

@@ -57,6 +58,7 @@
5758
buildActionMask = 2147483647;
5859
files = (
5960
7B2D06A92E97BC8E00369D76 /* MarkdownUI in Frameworks */,
61+
7B110A432E9DC96C0093D372 /* PythonKit in Frameworks */,
6062
);
6163
runOnlyForDeploymentPostprocessing = 0;
6264
};
@@ -118,6 +120,7 @@
118120
name = interview_coder;
119121
packageProductDependencies = (
120122
7B2D06A82E97BC8E00369D76 /* MarkdownUI */,
123+
7B110A422E9DC96C0093D372 /* PythonKit */,
121124
);
122125
productName = interview_coder;
123126
productReference = 7B2430AB2E96436300E3DDE4 /* Codex++.app */;
@@ -203,6 +206,7 @@
203206
minimizedProjectReferenceProxies = 1;
204207
packageReferences = (
205208
7B2D06A72E97BC8E00369D76 /* XCRemoteSwiftPackageReference "swift-markdown-ui" */,
209+
7B110A412E9DC96C0093D372 /* XCRemoteSwiftPackageReference "PythonKit" */,
206210
);
207211
preferredProjectObjectVersion = 77;
208212
productRefGroup = 7B2430AC2E96436300E3DDE4 /* Products */;
@@ -402,6 +406,7 @@
402406
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
403407
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
404408
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
409+
CODE_SIGN_ENTITLEMENTS = interview_coder/interview_coder.entitlements;
405410
CODE_SIGN_IDENTITY = "Apple Development";
406411
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
407412
CODE_SIGN_STYLE = Automatic;
@@ -418,7 +423,6 @@
418423
INFOPLIST_KEY_NSHumanReadableCopyright = "";
419424
INFOPLIST_KEY_NSMicrophoneUsageDescription = "Microphone is used to record audio notes and previews.";
420425
INFOPLIST_KEY_NSScreenCaptureUsageDescription = "Screen capture is used to take screenshots for analysis.";
421-
CODE_SIGN_ENTITLEMENTS = interview_coder/interview_coder.entitlements;
422426
LD_RUNPATH_SEARCH_PATHS = (
423427
"$(inherited)",
424428
"@executable_path/../Frameworks",
@@ -440,6 +444,7 @@
440444
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
441445
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
442446
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
447+
CODE_SIGN_ENTITLEMENTS = interview_coder/interview_coder.entitlements;
443448
CODE_SIGN_IDENTITY = "Apple Development";
444449
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
445450
CODE_SIGN_STYLE = Automatic;
@@ -456,7 +461,6 @@
456461
INFOPLIST_KEY_NSHumanReadableCopyright = "";
457462
INFOPLIST_KEY_NSMicrophoneUsageDescription = "Microphone is used to record audio notes and previews.";
458463
INFOPLIST_KEY_NSScreenCaptureUsageDescription = "Screen capture is used to take screenshots for analysis.";
459-
CODE_SIGN_ENTITLEMENTS = interview_coder/interview_coder.entitlements;
460464
LD_RUNPATH_SEARCH_PATHS = (
461465
"$(inherited)",
462466
"@executable_path/../Frameworks",
@@ -583,6 +587,14 @@
583587
/* End XCConfigurationList section */
584588

585589
/* Begin XCRemoteSwiftPackageReference section */
590+
7B110A412E9DC96C0093D372 /* XCRemoteSwiftPackageReference "PythonKit" */ = {
591+
isa = XCRemoteSwiftPackageReference;
592+
repositoryURL = "https://github.com/pvieito/PythonKit.git";
593+
requirement = {
594+
branch = master;
595+
kind = branch;
596+
};
597+
};
586598
7B2D06A72E97BC8E00369D76 /* XCRemoteSwiftPackageReference "swift-markdown-ui" */ = {
587599
isa = XCRemoteSwiftPackageReference;
588600
repositoryURL = "https://github.com/gonzalezreal/swift-markdown-ui";
@@ -594,6 +606,11 @@
594606
/* End XCRemoteSwiftPackageReference section */
595607

596608
/* Begin XCSwiftPackageProductDependency section */
609+
7B110A422E9DC96C0093D372 /* PythonKit */ = {
610+
isa = XCSwiftPackageProductDependency;
611+
package = 7B110A412E9DC96C0093D372 /* XCRemoteSwiftPackageReference "PythonKit" */;
612+
productName = PythonKit;
613+
};
597614
7B2D06A82E97BC8E00369D76 /* MarkdownUI */ = {
598615
isa = XCSwiftPackageProductDependency;
599616
package = 7B2D06A72E97BC8E00369D76 /* XCRemoteSwiftPackageReference "swift-markdown-ui" */;

interview_coder.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

interview_coder/AppModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ final class AppModel: NSObject, ObservableObject {
4343
@Published var thinkingTokensPerSecond: Double = 0
4444
@Published var showReasoningInTranscript: Bool = false
4545
@Published var showManualInput: Bool = false
46-
@Published var manualInstructionDraft: String = ""
46+
var manualInstructionDraft: String = ""
4747
@Published var focusManualInputNonce: Int = 0
4848
@Published var manualInputPinned: Bool = UserDefaults.standard.bool(forKey: "manualInputPinned")
4949
@Published var transcriptViewMode: Int = 1 // 1: rendered, 2: raw markdown, 3: plain text

interview_coder/PanelView.swift

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ struct PanelView: View {
1616
@FocusState private var manualInputFocused: Bool
1717
@State private var isDroppingAsset: Bool = false
1818
@State private var showBranchPopover: Bool = false
19+
// Local draft to avoid re-rendering entire view on each keystroke
20+
@State private var localManualDraft: String = ""
1921
// Collapsible Settings sections
2022
@State private var sectionProfilesExpanded: Bool = true
2123
@State private var sectionModelExpanded: Bool = true
@@ -658,7 +660,7 @@ private var headerBar: some View { DragHost { headerContent }.zIndex(2) }
658660
.buttonStyle(.plain)
659661
.help(model.manualInputPinned ? "Pinned: keep input open across sessions" : "Pin input: keep open across sessions")
660662
}
661-
TextEditor(text: $model.manualInstructionDraft)
663+
TextEditor(text: $localManualDraft)
662664
.focused($manualInputFocused)
663665
.scrollContentBackground(.hidden)
664666
.frame(minHeight: 56, maxHeight: 100)
@@ -674,9 +676,23 @@ private var headerBar: some View { DragHost { headerContent }.zIndex(2) }
674676
)
675677
.padding([.leading, .trailing, .bottom], 8)
676678
.animation(nil, value: model.showManualInput)
677-
.onAppear { manualInputFocused = true }
678-
.onChange(of: model.showManualInput) { _, now in if now { manualInputFocused = true } }
679+
.onAppear {
680+
manualInputFocused = true
681+
localManualDraft = model.manualInstructionDraft
682+
}
683+
.onChange(of: model.showManualInput) { _, now in
684+
if now {
685+
manualInputFocused = true
686+
localManualDraft = model.manualInstructionDraft
687+
} else {
688+
localManualDraft = ""
689+
}
690+
}
679691
.onChange(of: model.focusManualInputNonce) { _, _ in manualInputFocused = true }
692+
.onChange(of: localManualDraft) { _, newValue in
693+
// Keep model draft in sync without triggering global view updates
694+
model.manualInstructionDraft = newValue
695+
}
680696
}
681697

682698
private var hasAnyAssistant: Bool { model.conversation.contains(where: { $0.role == .assistant }) }

0 commit comments

Comments
 (0)