Merge branch 'main' of github.com:MustangYM/OSXChatGpt

# Conflicts:
#	OSXChatGPT/OSXChatGPT/WindowView/ChatRoomView.swift
This commit is contained in:
MustangYM
2023-03-23 22:05:09 +08:00
3 changed files with 36 additions and 4 deletions

View File

@@ -3,7 +3,7 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 50; objectVersion = 56;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
@@ -28,6 +28,7 @@
CB28A51E29BF284000F0286A /* MessageTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB28A51D29BF284000F0286A /* MessageTextModel.swift */; }; CB28A51E29BF284000F0286A /* MessageTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB28A51D29BF284000F0286A /* MessageTextModel.swift */; };
CB28A52229C07BE500F0286A /* KeyboardMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB28A52129C07BE500F0286A /* KeyboardMonitor.swift */; }; CB28A52229C07BE500F0286A /* KeyboardMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB28A52129C07BE500F0286A /* KeyboardMonitor.swift */; };
CB28A52829C1569900F0286A /* ThinkingAnimationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB28A52729C1569900F0286A /* ThinkingAnimationView.swift */; }; CB28A52829C1569900F0286A /* ThinkingAnimationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB28A52729C1569900F0286A /* ThinkingAnimationView.swift */; };
CB5EC7FE29CC390600C890A6 /* Starscream in Frameworks */ = {isa = PBXBuildFile; productRef = CB5EC7FD29CC390600C890A6 /* Starscream */; };
CBC4B0FF29B8BF9600650296 /* OSXChatGPT.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = CBC4B0FD29B8BF9600650296 /* OSXChatGPT.xcdatamodeld */; }; CBC4B0FF29B8BF9600650296 /* OSXChatGPT.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = CBC4B0FD29B8BF9600650296 /* OSXChatGPT.xcdatamodeld */; };
CBC4B12329B8D28D00650296 /* Message+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBC4B11D29B8D28D00650296 /* Message+CoreDataClass.swift */; }; CBC4B12329B8D28D00650296 /* Message+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBC4B11D29B8D28D00650296 /* Message+CoreDataClass.swift */; };
CBC4B12429B8D28D00650296 /* Message+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBC4B11E29B8D28D00650296 /* Message+CoreDataProperties.swift */; }; CBC4B12429B8D28D00650296 /* Message+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBC4B11E29B8D28D00650296 /* Message+CoreDataProperties.swift */; };
@@ -71,6 +72,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
182B42C929BBB1C500F06778 /* Colorful in Frameworks */, 182B42C929BBB1C500F06778 /* Colorful in Frameworks */,
CB5EC7FE29CC390600C890A6 /* Starscream in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -200,6 +202,7 @@
name = OSXChatGPT; name = OSXChatGPT;
packageProductDependencies = ( packageProductDependencies = (
182B42C829BBB1C500F06778 /* Colorful */, 182B42C829BBB1C500F06778 /* Colorful */,
CB5EC7FD29CC390600C890A6 /* Starscream */,
); );
productName = OSXChatGPT; productName = OSXChatGPT;
productReference = CB1DCABE29B4F09D00B1D4E1 /* OSXChatGPT.app */; productReference = CB1DCABE29B4F09D00B1D4E1 /* OSXChatGPT.app */;
@@ -231,6 +234,7 @@
mainGroup = CB1DCAB529B4F09D00B1D4E1; mainGroup = CB1DCAB529B4F09D00B1D4E1;
packageReferences = ( packageReferences = (
182B42C729BBB1C500F06778 /* XCRemoteSwiftPackageReference "Colorful" */, 182B42C729BBB1C500F06778 /* XCRemoteSwiftPackageReference "Colorful" */,
CB5EC7FC29CC390600C890A6 /* XCRemoteSwiftPackageReference "Starscream" */,
); );
productRefGroup = CB1DCABF29B4F09D00B1D4E1 /* Products */; productRefGroup = CB1DCABF29B4F09D00B1D4E1 /* Products */;
projectDirPath = ""; projectDirPath = "";
@@ -489,6 +493,14 @@
minimumVersion = 1.0.0; minimumVersion = 1.0.0;
}; };
}; };
CB5EC7FC29CC390600C890A6 /* XCRemoteSwiftPackageReference "Starscream" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/daltoniam/Starscream.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 4.0.0;
};
};
/* End XCRemoteSwiftPackageReference section */ /* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */ /* Begin XCSwiftPackageProductDependency section */
@@ -497,6 +509,11 @@
package = 182B42C729BBB1C500F06778 /* XCRemoteSwiftPackageReference "Colorful" */; package = 182B42C729BBB1C500F06778 /* XCRemoteSwiftPackageReference "Colorful" */;
productName = Colorful; productName = Colorful;
}; };
CB5EC7FD29CC390600C890A6 /* Starscream */ = {
isa = XCSwiftPackageProductDependency;
package = CB5EC7FC29CC390600C890A6 /* XCRemoteSwiftPackageReference "Starscream" */;
productName = Starscream;
};
/* End XCSwiftPackageProductDependency section */ /* End XCSwiftPackageProductDependency section */
/* Begin XCVersionGroup section */ /* Begin XCVersionGroup section */

View File

@@ -8,6 +8,15 @@
"revision" : "0bcf960c856d9f7cde10a0b464208585736c5e47", "revision" : "0bcf960c856d9f7cde10a0b464208585736c5e47",
"version" : "1.1.0" "version" : "1.1.0"
} }
},
{
"identity" : "starscream",
"kind" : "remoteSourceControl",
"location" : "https://github.com/daltoniam/Starscream.git",
"state" : {
"revision" : "df8d82047f6654d8e4b655d1b1525c64e1059d21",
"version" : "4.0.4"
}
} }
], ],
"version" : 2 "version" : 2

View File

@@ -180,16 +180,15 @@ struct ChatRoomView: View {
// //
}else { }else {
// //
sendMessage(scrollView: scrollView) sendMessage(scrollView: scrollView, text: lastMessageText)
} }
} }
} }
lastMessageText = newMessageText lastMessageText = newMessageText
} }
private func sendMessage(scrollView: ScrollViewProxy?) { private func sendMessage(scrollView: ScrollViewProxy?, text: String) {
guard !newMessageText.isEmpty else { return } guard !newMessageText.isEmpty else { return }
let msg = String(newMessageText.dropLast()) let msg = String(newMessageText.dropLast())
let replaceStr = msg.replacingOccurrences(of: " ", with: "") let replaceStr = msg.replacingOccurrences(of: " ", with: "")
if replaceStr.count == 0 { if replaceStr.count == 0 {
@@ -230,6 +229,7 @@ struct ChatRoomCellView: View {
Spacer() Spacer()
VStack { VStack {
Text(message.text ?? "") Text(message.text ?? "")
.textSelection(.enabled)
}.padding(12) }.padding(12)
.background(Color.blue.opacity(0.8)) .background(Color.blue.opacity(0.8))
.foregroundColor(.white) .foregroundColor(.white)
@@ -294,6 +294,7 @@ struct ChatRoomCellView: View {
Image(systemName: "doc.on.doc.fill") Image(systemName: "doc.on.doc.fill")
} }
} }
.textSelection(.enabled)
} }
Spacer() Spacer()
@@ -311,6 +312,7 @@ struct ChatRoomCellTextView: View {
HStack { HStack {
Text(textModel.text) Text(textModel.text)
.foregroundColor(.white) .foregroundColor(.white)
.textSelection(.enabled)
Spacer() Spacer()
} }
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
@@ -330,6 +332,7 @@ struct ChatRoomCellTextView: View {
.foregroundColor(.white) .foregroundColor(.white)
.frame(height: 20) .frame(height: 20)
.padding(.leading, 10) .padding(.leading, 10)
.textSelection(.enabled)
Spacer() Spacer()
Button(action: { Button(action: {
NSPasteboard.general.prepareForNewContents() NSPasteboard.general.prepareForNewContents()
@@ -341,6 +344,7 @@ struct ChatRoomCellTextView: View {
}.background(Color.white.opacity(0.4)) }.background(Color.white.opacity(0.4))
.padding(0) .padding(0)
.padding(.leading, 0) .padding(.leading, 0)
HStack { HStack {
Text(textModel.text) Text(textModel.text)
.font(.custom("SF Mono Bold", size: 14.5)) .font(.custom("SF Mono Bold", size: 14.5))
@@ -350,9 +354,11 @@ struct ChatRoomCellTextView: View {
.padding(.top, 0) .padding(.top, 0)
.padding(.leading, 10) .padding(.leading, 10)
.padding(.bottom, 15) .padding(.bottom, 15)
.textSelection(.enabled)
Spacer() Spacer()
} }
}.padding(.leading, 0) }.padding(.leading, 0)
.padding(.top, 0) .padding(.top, 0)
.background(Color.black.opacity(0.7)) .background(Color.black.opacity(0.7))