Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8770b9e

Browse files
committed
Pre-release 0.44.151
1 parenta757a4a commit8770b9e

File tree

15 files changed

+224
-22
lines changed

15 files changed

+224
-22
lines changed

‎Core/Package.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ let package = Package(
254254
.target(
255255
name:"GitHubCopilotViewModel",
256256
dependencies:[
257+
"Client",
257258
.product(name:"GitHubCopilotService",package:"Tool"),
258259
.product(name:"ComposableArchitecture",package:"swift-composable-architecture"),
259260
.product(name:"Status",package:"Tool"),

‎Core/Sources/ConversationTab/ModeAndModelPicker/ModelManagerUtils.swift‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public extension CopilotModelManager {
179179
staticfunc getDefaultChatModel(scope:PromptTemplateScope=.chatPanel)->LLMModel?{
180180
letLLMs=CopilotModelManager.getAvailableLLMs()
181181
letLLMsInScope=LLMs.filter({ $0.scopes.contains(scope)})
182-
letdefaultModel=LLMsInScope.first(where:{ $0.isChatDefault})
182+
letdefaultModel=LLMsInScope.first(where:{ $0.isChatDefault&& !$0.isAutoModel})
183183
// If a default model is found, return it
184184
iflet defaultModel= defaultModel{
185185
returnLLMModel(
@@ -202,7 +202,7 @@ public extension CopilotModelManager {
202202
}
203203

204204
// If no default model is found, fallback to the first available model
205-
iflet firstModel=LLMsInScope.first{
205+
iflet firstModel=LLMsInScope.first(where:{ !$0.isAutoModel}){
206206
returnLLMModel(
207207
modelName: firstModel.modelName,
208208
modelFamily: firstModel.modelFamily,
@@ -270,3 +270,7 @@ public extension LLMModel {
270270
/// Apply to `Copilot Models`
271271
varisAutoModel:Bool{ isStandardModel && modelName=="Auto"}
272272
}
273+
274+
extensionCopilotModel{
275+
varisAutoModel:Bool{ modelName=="Auto"}
276+
}

‎Core/Sources/GitHubCopilotViewModel/GitHubCopilotViewModel.swift‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import ComposableArchitecture
44
import Status
55
import SwiftUI
66
import Cache
7+
import Client
78

89
publicstructSignInResponse{
910
publicletstatus:SignInInitiateStatus
@@ -126,7 +127,7 @@ public class GitHubCopilotViewModel: ObservableObject {
126127
waitingForSignIn=false
127128
}
128129

129-
publicfunc copyAndOpen(){
130+
publicfunc copyAndOpen(fromHostApp:Bool=false){
130131
waitingForSignIn=true
131132
guardlet signInResponseelse{
132133
toast("Missing sign in details.",.error)
@@ -137,10 +138,10 @@ public class GitHubCopilotViewModel: ObservableObject {
137138
pasteboard.setString(signInResponse.userCode, forType:NSPasteboard.PasteboardType.string)
138139
toast("Sign-in code\(signInResponse.userCode) copied",.info)
139140
NSWorkspace.shared.open(signInResponse.verificationURL)
140-
waitForSignIn()
141+
waitForSignIn(fromHostApp: fromHostApp)
141142
}
142143

143-
publicfunc waitForSignIn(){
144+
publicfunc waitForSignIn(fromHostApp:Bool=false){
144145
Task{
145146
do{
146147
guard waitingForSignInelse{return}
@@ -155,14 +156,19 @@ public class GitHubCopilotViewModel: ObservableObject {
155156
self.status= status
156157
awaitStatus.shared.updateAuthStatus(.loggedIn, username: username)
157158
broadcastStatusChange()
158-
letmodels=try?await service.models()
159-
iflet models= models, !models.isEmpty{
160-
CopilotModelManager.updateLLMs(models)
159+
if !fromHostApp{
160+
letmodels=try?await service.models()
161+
iflet models= models, !models.isEmpty{
162+
CopilotModelManager.updateLLMs(models)
163+
}
164+
}else{
165+
letxpcService=trygetService()
166+
_=try?await xpcService.updateCopilotModels()
161167
}
162168
}catchlet error asGitHubCopilotError{
163169
switch error{
164170
case.languageServerError(.timeout):
165-
waitForSignIn()
171+
waitForSignIn(fromHostApp: fromHostApp)
166172
return
167173
case.languageServerError(
168174
.serverError(

‎Core/Sources/HostApp/AdvancedSettings/SuggestionSection.swift‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ struct SuggestionSection: View {
77
@AppStorage(\.realtimeNESToggle)varrealtimeNESToggle
88
@StatevarisSuggestionFeatureDisabledLanguageListViewOpen=false
99
@StateprivatevarshouldPresentTurnoffSheet=false
10+
@ObservedObjectprivatevarfeatureFlags=FeatureFlagManager.shared
1011

1112
varrealtimeSuggestionBinding:Binding<Bool>{
1213
Binding(
@@ -27,11 +28,15 @@ struct SuggestionSection: View {
2728
title:"Enable completions while typing",
2829
isOn: realtimeSuggestionBinding
2930
)
30-
Divider()
31-
SettingsToggle(
32-
title:"Enable Next Edit Suggestions (NES)",
33-
isOn: $realtimeNESToggle
34-
)
31+
32+
if featureFlags.isEditorPreviewEnabled{
33+
Divider()
34+
SettingsToggle(
35+
title:"Enable Next Edit Suggestions (NES)",
36+
isOn: $realtimeNESToggle
37+
)
38+
}
39+
3540
Divider()
3641
SettingsToggle(
3742
title:"Accept suggestions with Tab",

‎Core/Sources/HostApp/GeneralSettings/CopilotConnectionView.swift‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ struct CopilotConnectionView: View {
5757
isPresented: $viewModel.isSignInAlertPresented,
5858
presenting: viewModel.signInResponse){ _in
5959
Button("Cancel", role:.cancel, action:{})
60-
Button("Copy Code and Open", action: viewModel.copyAndOpen)
60+
Button(
61+
"Copy Code and Open",
62+
action:{ viewModel.copyAndOpen(fromHostApp:true)}
63+
)
6164
} message:{ responsein
6265
Text("""
6366
Please enter the above code in the\

‎Core/Sources/Service/SuggestionCommandHandler/PseudoCommandHandler.swift‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import WorkspaceSuggestionService
1010
import XcodeInspector
1111
import XPCShared
1212
import AXHelper
13+
import GitHubCopilotService
1314

1415
/// It's used to run some commands without really triggering the menu bar item.
1516
///
@@ -59,7 +60,8 @@ struct PseudoCommandHandler {
5960
ifTask.isCancelled{return}
6061

6162
letcodeCompletionEnabled=UserDefaults.shared.value(for: \.realtimeSuggestionToggle)
62-
letnesEnabled=UserDefaults.shared.value(for: \.realtimeNESToggle)
63+
// Enabled both by Feature Flag and User.
64+
letnesEnabled=FeatureFlagNotifierImpl.shared.featureFlags.editorPreviewFeatures &&UserDefaults.shared.value(for: \.realtimeNESToggle)
6365
guard codeCompletionEnabled || nesEnabledelse{
6466
cleanupAllSuggestions(filespace: filespace, presenter:nil)
6567
return

‎Core/Sources/Service/XPCService.swift‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,21 @@ public class XPCService: NSObject, XPCServiceProtocol {
594594
}
595595
}
596596

597+
publicfunc updateCopilotModels(withReply reply:@escaping(Data?,Error?)->Void){
598+
Task{@MainActorin
599+
do{
600+
letservice=tryGitHubCopilotViewModel.shared.getGitHubCopilotAuthService()
601+
letmodels=tryawait service.models()
602+
CopilotModelManager.updateLLMs(models)
603+
letdata=tryJSONEncoder().encode(models)
604+
reply(data,nil)
605+
}catch{
606+
Logger.service.error("Failed to get models:\(error.localizedDescription)")
607+
reply(nil,NSError.from(error))
608+
}
609+
}
610+
}
611+
597612
// MARK: - BYOK
598613
publicfunc saveBYOKApiKey(_ params:Data, withReply reply:@escaping(Data?)->Void){
599614
letdecoder=JSONDecoder()

‎Core/Sources/SuggestionWidget/ChatWindow/ChatLoginView.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct ChatLoginView: View {
7777
Button("Cancel", role:.cancel, action:{})
7878
.scaledFont(.body)
7979

80-
Button("Copy Code and Open", action: viewModel.copyAndOpen)
80+
Button("Copy Code and Open", action:{viewModel.copyAndOpen(fromHostApp:false)})
8181
.scaledFont(.body)
8282
} message:{ responsein
8383
Text("""
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import GitHubCopilotService
2+
3+
extensionWidgetWindowsController{
4+
5+
@MainActor
6+
varisNESFeatureFlagEnabled:Bool{
7+
FeatureFlagNotifierImpl.shared.featureFlags.editorPreviewFeatures
8+
}
9+
10+
func setupFeatureFlagObservers(){
11+
Task{@MainActorin
12+
letsinker=FeatureFlagNotifierImpl.shared.featureFlagsDidChange
13+
.sink(receiveValue:{[weak self] _in
14+
self?.onFeatureFlagChanged()
15+
})
16+
17+
awaitself.storeCancellables([sinker])
18+
}
19+
}
20+
21+
@MainActor
22+
func onFeatureFlagChanged(){
23+
if !isNESFeatureFlagEnabled{
24+
hideAllNESWindows()
25+
}
26+
}
27+
}

‎Core/Sources/SuggestionWidget/Extensions/WidgetWindowsController+NES.swift‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import AppKit
2+
import GitHubCopilotService
23

34
extensionWidgetWindowsController{
45
func setupNESSuggestionPanelObservers(){
@@ -16,6 +17,40 @@ extension WidgetWindowsController {
1617
}
1718
}
1819

20+
@MainActor
21+
func applyOpacityForNESWindows(by noFocus:Bool){
22+
guard !noFocus, isNESFeatureFlagEnabled
23+
else{
24+
hideAllNESWindows()
25+
return
26+
}
27+
28+
displayAllNESWindows()
29+
}
30+
31+
@MainActor
32+
func hideAllNESWindows(){
33+
windows.nesMenuWindow.alphaValue=0
34+
windows.nesDiffWindow.setIsVisible(false)
35+
36+
hideNESDiffWindow()
37+
38+
windows.nesNotificationWindow.alphaValue=0
39+
windows.nesNotificationWindow.setIsVisible(false)
40+
}
41+
42+
@MainActor
43+
func displayAllNESWindows(){
44+
windows.nesMenuWindow.alphaValue=1
45+
windows.nesDiffWindow.setIsVisible(true)
46+
47+
windows.nesDiffWindow.alphaValue=1
48+
windows.nesDiffWindow.setIsVisible(true)
49+
50+
windows.nesNotificationWindow.alphaValue=1
51+
windows.nesNotificationWindow.setIsVisible(true)
52+
}
53+
1954
@MainActor
2055
func hideNESDiffWindow(){
2156
NSAnimationContext.runAnimationGroup{ contextin

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp