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

Commit37407e4

Browse files
committed
Pre-release 0.31.106
1 parentb9029ca commit37407e4

File tree

8 files changed

+83
-25
lines changed

8 files changed

+83
-25
lines changed

‎Core/Sources/ConversationTab/ModelPicker.swift

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import SwiftUI
22
import ChatService
33
import Persist
44
import ComposableArchitecture
5+
import GitHubCopilotService
56

67
publicletSELECTED_LLM_KEY="selectedLLM"
78

@@ -27,6 +28,18 @@ extension AppState {
2728
}
2829
}
2930

31+
extensionCopilotModelManager{
32+
staticfunc getAvailableChatLLMs()->[LLMModel]{
33+
letLLMs=CopilotModelManager.getAvailableLLMs()
34+
letavailableModels=LLMs.filter(
35+
{ $0.scopes.contains(.chatPanel)}
36+
).map{
37+
LLMModel(modelName: $0.modelName, modelFamily: $0.modelFamily)
38+
}
39+
return availableModels.isEmpty?[defaultModel]: availableModels
40+
}
41+
}
42+
3043
structLLMModel:Codable,Hashable{
3144
letmodelName:String
3245
letmodelFamily:String
@@ -35,12 +48,15 @@ struct LLMModel: Codable, Hashable {
3548
letdefaultModel=LLMModel(modelName:"GPT-4o", modelFamily:"gpt-4o")
3649
structModelPicker:View{
3750
@StateprivatevarselectedModel= defaultModel.modelName
38-
@Stateprivatevarmodels:[LLMModel]=[ defaultModel]
3951
@StateprivatevarisHovered=false
4052
@StateprivatevarisPressed=false
4153

4254
init(){
43-
self.updateCurrentModel()
55+
self.updateCurrentModel()
56+
}
57+
58+
varmodels:[LLMModel]{
59+
CopilotModelManager.getAvailableChatLLMs()
4460
}
4561

4662
func updateCurrentModel(){
@@ -74,13 +90,9 @@ struct ModelPicker: View {
7490
isHovered= hovering
7591
}
7692
.onAppear(){
93+
updateCurrentModel()
7794
Task{
78-
updateCurrentModel()
79-
self.models=awaitChatService.shared.copilotModels().filter(
80-
{ $0.scopes.contains(.chatPanel)}
81-
).map{
82-
LLMModel(modelName: $0.modelName, modelFamily: $0.modelFamily)
83-
}
95+
awaitrefreshModels()
8496
}
8597
}
8698
.help("Pick Model")
@@ -93,6 +105,14 @@ struct ModelPicker: View {
93105
letwidth= selectedModel.size(withAttributes: attributes).width
94106
returnCGFloat(width+20)
95107
}
108+
109+
@MainActor
110+
func refreshModels()async{
111+
letcopilotModels=awaitChatService.shared.copilotModels()
112+
if !copilotModels.isEmpty{
113+
CopilotModelManager.updateLLMs(copilotModels)
114+
}
115+
}
96116
}
97117

98118
structModelPicker_Previews:PreviewProvider{

‎Core/Sources/GitHubCopilotViewModel/GitHubCopilotViewModel.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ public class GitHubCopilotViewModel: ObservableObject {
155155
waitingForSignIn=false
156156
self.username= username
157157
self.status= status
158+
letmodels=try?await service.models()
159+
iflet models= models, !models.isEmpty{
160+
CopilotModelManager.updateLLMs(models)
161+
}
158162
awaitStatus.shared.updateAuthStatus(.loggedIn, username: username)
159163
broadcastStatusChange()
160164
}catchlet error asGitHubCopilotError{

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ struct PseudoCommandHandler {
266266
if now.timeIntervalSince(lastBundleNotFoundTime)>60*60{
267267
Self.lastBundleNotFoundTime= now
268268
toast.toast(
269-
title:"Extension Permission Not Granted",
269+
title:"GitHub CopilotExtension Permission Not Granted",
270270
content:"""
271271
Enable Extensions → Xcode Source Editor → GitHub Copilot\
272272
for Xcode for faster and full-featured code completion.\
@@ -287,7 +287,7 @@ struct PseudoCommandHandler {
287287
content:"Quit and restart Xcode to enable extension.",
288288
level:.warning,
289289
button:.init(
290-
title:"Restart",
290+
title:"Restart Xcode",
291291
action:{NSWorkspace.restartXcode()}
292292
)
293293
)

‎Core/Sources/SuggestionWidget/WidgetWindowsController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ public final class WidgetWindows {
744744
it.isReleasedWhenClosed=false
745745
it.isOpaque=false
746746
it.backgroundColor=.clear
747-
it.level=widgetLevel(0)
747+
it.level=widgetLevel(2)
748748
it.collectionBehavior=[.fullScreenAuxiliary,.transient,.canJoinAllSpaces]
749749
it.hasShadow=false
750750
it.contentView=NSHostingView(
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import ConversationServiceProvider
2+
3+
publicclassCopilotModelManager{
4+
privatestaticvaravailableLLMs:[CopilotModel]=[]
5+
6+
publicstaticfunc updateLLMs(_ models:[CopilotModel]){
7+
availableLLMs= models
8+
}
9+
10+
publicstaticfunc getAvailableLLMs()->[CopilotModel]{
11+
return availableLLMs
12+
}
13+
14+
publicstaticfunc hasLLMs()->Bool{
15+
return !availableLLMs.isEmpty
16+
}
17+
18+
publicstaticfunc clearLLMs(){
19+
availableLLMs=[]
20+
}
21+
}

‎Tool/Sources/GitHubCopilotService/LanguageServer/GitHubCopilotService.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,12 @@ public final class GitHubCopilotService:
683683
privatefunc updateServiceAuthStatus(_ status:GitHubCopilotRequest.CheckStatus.Response)async{
684684
Logger.gitHubCopilot.info("check status response:\(status)")
685685
if status.status==.ok || status.status==.maybeOk{
686+
if !CopilotModelManager.hasLLMs(){
687+
letmodels=try?awaitmodels()
688+
iflet models= models, !models.isEmpty{
689+
CopilotModelManager.updateLLMs(models)
690+
}
691+
}
686692
awaitStatus.shared.updateAuthStatus(.loggedIn, username: status.user)
687693
awaitunwatchAuthStatus()
688694
}elseif status.status==.notAuthorized{
@@ -874,6 +880,8 @@ public final class GitHubCopilotService:
874880

875881
iflet signoutError{
876882
throw signoutError
883+
}else{
884+
CopilotModelManager.clearLLMs()
877885
}
878886
}
879887
}

‎Tool/Sources/Toast/NotificationView.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ struct AutoDismissMessage: View {
1515
message.level.colorasColor,
1616
in:RoundedRectangle(cornerRadius:8)
1717
)
18+
.frame(minWidth:300)
1819
}
1920
}
2021

@@ -53,7 +54,10 @@ public struct NotificationView: View {
5354
Spacer()
5455

5556
iflet button= message.button{
56-
Button(action: button.action){
57+
Button(action:{
58+
button.action()
59+
onDismiss()
60+
}){
5761
Text(button.title)
5862
.padding(.horizontal,7)
5963
.padding(.vertical,3)
@@ -76,10 +80,6 @@ public struct NotificationView: View {
7680
}else{
7781
AutoDismissMessage(message: message)
7882
.frame(maxWidth:.infinity)
79-
.overlay{
80-
RoundedRectangle(cornerRadius:8)
81-
.stroke(Color.black.opacity(0.3), lineWidth:1)
82-
}
8383
}
8484
}
8585
}

‎Tool/Sources/Toast/Toast.swift

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,20 @@ public extension NSWorkspace {
271271
}
272272
NSWorkspace.shared.open(URL(string: urlString)!)
273273
}else{
274-
letscript=NSAppleScript(
275-
source:"""
276-
tell application"System Preferences"
277-
activate
278-
set the current pane to pane id"com.apple.preferences.extensions"
279-
end tell
280-
"""
281-
)
282-
script?.executeAndReturnError(nil)
274+
letprocess=Process()
275+
process.executableURL=URL(fileURLWithPath:"/usr/bin/open")
276+
process.arguments=[
277+
"-b",
278+
"com.apple.systempreferences",
279+
"/System/Library/PreferencePanes/Extensions.prefPane"
280+
]
281+
282+
do{
283+
try process.run()
284+
}catch{
285+
// Handle error silently
286+
return
287+
}
283288
}
284289
}
285290

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp