Skip to content

Commit caaf4a3

Browse files
committed
Merge branch 'feature/widget-refactor' into develop
2 parents b520a09 + 3581873 commit caaf4a3

53 files changed

Lines changed: 2292 additions & 1189 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1520"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "C8189B152938972F00C9DCDA"
18+
BuildableName = "Copilot for Xcode.app"
19+
BlueprintName = "Copilot for Xcode"
20+
ReferencedContainer = "container:Copilot for Xcode.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<TestPlans>
31+
<TestPlanReference
32+
reference = "container:TestPlan.xctestplan"
33+
default = "YES">
34+
</TestPlanReference>
35+
</TestPlans>
36+
</TestAction>
37+
<LaunchAction
38+
buildConfiguration = "Debug"
39+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
40+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
41+
launchStyle = "0"
42+
useCustomWorkingDirectory = "NO"
43+
ignoresPersistentStateOnLaunch = "NO"
44+
debugDocumentVersioning = "YES"
45+
debugServiceExtension = "internal"
46+
allowLocationSimulation = "YES">
47+
<BuildableProductRunnable
48+
runnableDebuggingMode = "0">
49+
<BuildableReference
50+
BuildableIdentifier = "primary"
51+
BlueprintIdentifier = "C8189B152938972F00C9DCDA"
52+
BuildableName = "Copilot for Xcode.app"
53+
BlueprintName = "Copilot for Xcode"
54+
ReferencedContainer = "container:Copilot for Xcode.xcodeproj">
55+
</BuildableReference>
56+
</BuildableProductRunnable>
57+
<CommandLineArguments>
58+
<CommandLineArgument
59+
argument = "-_NS_4445425547 YES"
60+
isEnabled = "YES">
61+
</CommandLineArgument>
62+
</CommandLineArguments>
63+
</LaunchAction>
64+
<ProfileAction
65+
buildConfiguration = "Release"
66+
shouldUseLaunchSchemeArgsEnv = "YES"
67+
savedToolIdentifier = ""
68+
useCustomWorkingDirectory = "NO"
69+
debugDocumentVersioning = "YES">
70+
<BuildableProductRunnable
71+
runnableDebuggingMode = "0">
72+
<BuildableReference
73+
BuildableIdentifier = "primary"
74+
BlueprintIdentifier = "C8189B152938972F00C9DCDA"
75+
BuildableName = "Copilot for Xcode.app"
76+
BlueprintName = "Copilot for Xcode"
77+
ReferencedContainer = "container:Copilot for Xcode.xcodeproj">
78+
</BuildableReference>
79+
</BuildableProductRunnable>
80+
</ProfileAction>
81+
<AnalyzeAction
82+
buildConfiguration = "Debug">
83+
</AnalyzeAction>
84+
<ArchiveAction
85+
buildConfiguration = "Debug"
86+
customArchiveName = "Copilot for Xcode Debug"
87+
revealArchiveInOrganizer = "YES">
88+
</ArchiveAction>
89+
</Scheme>

Core/Package.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ let package = Package(
8686
.product(name: "UserDefaultsObserver", package: "Tool"),
8787
.product(name: "AppMonitoring", package: "Tool"),
8888
.product(name: "SuggestionBasic", package: "Tool"),
89+
.product(name: "PromptToCode", package: "Tool"),
8990
.product(name: "ChatTab", package: "Tool"),
9091
.product(name: "Logger", package: "Tool"),
9192
.product(name: "OpenAIService", package: "Tool"),
@@ -152,6 +153,7 @@ let package = Package(
152153
.target(
153154
name: "PromptToCodeService",
154155
dependencies: [
156+
.product(name: "PromptToCode", package: "Tool"),
155157
.product(name: "FocusedCodeFinder", package: "Tool"),
156158
.product(name: "SuggestionBasic", package: "Tool"),
157159
.product(name: "OpenAIService", package: "Tool"),
@@ -219,6 +221,7 @@ let package = Package(
219221
dependencies: [
220222
"PromptToCodeService",
221223
"ChatGPTChatTab",
224+
.product(name: "PromptToCode", package: "Tool"),
222225
.product(name: "Toast", package: "Tool"),
223226
.product(name: "UserDefaultsObserver", package: "Tool"),
224227
.product(name: "SharedUIComponents", package: "Tool"),

Core/Sources/ChatGPTChatTab/Views/ThemedMarkdownText.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ struct ThemedMarkdownText: View {
1515
let content: MarkdownContent
1616

1717
init(_ text: String) {
18-
self.content = .init(text)
18+
content = .init(text)
1919
}
20-
20+
2121
init(_ content: MarkdownContent) {
2222
self.content = content
2323
}
@@ -71,6 +71,8 @@ extension MarkdownUI.Theme {
7171
}
7272
.codeBlock { configuration in
7373
let wrapCode = UserDefaults.shared.value(for: \.wrapCodeInChatCodeBlock)
74+
|| ["plaintext", "text", "markdown", "sh", "bash", "shell", "latex", "tex"]
75+
.contains(configuration.language)
7476

7577
if wrapCode {
7678
AsyncCodeBlockView(

Core/Sources/ChatPlugin/AskChatGPT.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ public func askChatGPT(
1212
let memory = AutoManagedChatGPTMemory(
1313
systemPrompt: systemPrompt,
1414
configuration: configuration,
15-
functionProvider: NoChatGPTFunctionProvider()
15+
functionProvider: NoChatGPTFunctionProvider(),
16+
maxNumberOfMessages: .max
1617
)
1718
let service = LegacyChatGPTService(
1819
memory: memory,

Core/Sources/ChatPlugin/CallAIFunction.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ func callAIFunction(
2222
memory: AutoManagedChatGPTMemory(
2323
systemPrompt: "You are now the following python function: ```# \(description)\n\(function)```\n\nOnly respond with your `return` value.",
2424
configuration: configuration,
25-
functionProvider: NoChatGPTFunctionProvider()
25+
functionProvider: NoChatGPTFunctionProvider(),
26+
maxNumberOfMessages: .max
2627
),
2728
configuration: configuration
2829
)

Core/Sources/ChatService/ContextAwareAutoManagedChatGPTMemory.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public final class ContextAwareAutoManagedChatGPTMemory: ChatGPTMemory {
2222
memory = AutoManagedChatGPTMemory(
2323
systemPrompt: "",
2424
configuration: configuration,
25-
functionProvider: functionProvider
25+
functionProvider: functionProvider,
26+
maxNumberOfMessages: UserDefaults.shared.value(for: \.chatGPTMaxMessageCount)
2627
)
2728
contextController = DynamicContextController(
2829
memory: memory,

Core/Sources/HostApp/CustomCommandSettings/CustomCommandView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ struct CustomCommandView: View {
149149
case .customChat:
150150
Text("Custom Chat")
151151
case .promptToCode:
152-
Text("Prompt to Code")
152+
Text("Modification")
153153
case .singleRoundDialog:
154154
Text("Single Round Dialog")
155155
}
@@ -201,7 +201,7 @@ struct CustomCommandView: View {
201201
"This command sends a message to the active chat tab. You can provide additional context through the \"Extra System Prompt\" as well."
202202
)
203203
}
204-
SubSection(title: Text("Prompt to Code")) {
204+
SubSection(title: Text("Modification")) {
205205
Text(
206206
"This command opens the prompt-to-code panel and executes the provided requirements on the selected code. You can provide additional context through the \"Extra Context\" as well."
207207
)

Core/Sources/HostApp/CustomCommandSettings/EditCustomCommandView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct EditCustomCommandView: View {
3737
case .sendMessage:
3838
return "Send Message"
3939
case .promptToCode:
40-
return "Prompt to Code"
40+
return "Modification"
4141
case .customChat:
4242
return "Custom Chat"
4343
case .singleRoundDialog:

Core/Sources/HostApp/FeatureSettingsView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ struct FeatureSettingsView: View {
2626
}
2727
.sidebarItem(
2828
tag: 2,
29-
title: "Prompt to Code",
30-
subtitle: "Write code with natural language",
29+
title: "Modification",
30+
subtitle: "Write or modify code with natural language",
3131
image: "paintbrush"
3232
)
3333

Core/Sources/HostApp/ServiceView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct ServiceView: View {
3333
)).sidebarItem(
3434
tag: 2,
3535
title: "Chat Models",
36-
subtitle: "Chat, Prompt to Code",
36+
subtitle: "Chat, Modification",
3737
image: "globe"
3838
)
3939

@@ -43,7 +43,7 @@ struct ServiceView: View {
4343
)).sidebarItem(
4444
tag: 3,
4545
title: "Embedding Models",
46-
subtitle: "Chat, Prompt to Code",
46+
subtitle: "Chat, Modification",
4747
image: "globe"
4848
)
4949

0 commit comments

Comments
 (0)