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;
classes = {
};
objectVersion = 50;
objectVersion = 56;
objects = {
/* Begin PBXBuildFile section */
@@ -28,6 +28,7 @@
CB28A51E29BF284000F0286A /* MessageTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB28A51D29BF284000F0286A /* MessageTextModel.swift */; };
CB28A52229C07BE500F0286A /* KeyboardMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB28A52129C07BE500F0286A /* KeyboardMonitor.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 */; };
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 */; };
@@ -71,6 +72,7 @@
buildActionMask = 2147483647;
files = (
182B42C929BBB1C500F06778 /* Colorful in Frameworks */,
CB5EC7FE29CC390600C890A6 /* Starscream in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -200,6 +202,7 @@
name = OSXChatGPT;
packageProductDependencies = (
182B42C829BBB1C500F06778 /* Colorful */,
CB5EC7FD29CC390600C890A6 /* Starscream */,
);
productName = OSXChatGPT;
productReference = CB1DCABE29B4F09D00B1D4E1 /* OSXChatGPT.app */;
@@ -231,6 +234,7 @@
mainGroup = CB1DCAB529B4F09D00B1D4E1;
packageReferences = (
182B42C729BBB1C500F06778 /* XCRemoteSwiftPackageReference "Colorful" */,
CB5EC7FC29CC390600C890A6 /* XCRemoteSwiftPackageReference "Starscream" */,
);
productRefGroup = CB1DCABF29B4F09D00B1D4E1 /* Products */;
projectDirPath = "";
@@ -489,6 +493,14 @@
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 */
/* Begin XCSwiftPackageProductDependency section */
@@ -497,6 +509,11 @@
package = 182B42C729BBB1C500F06778 /* XCRemoteSwiftPackageReference "Colorful" */;
productName = Colorful;
};
CB5EC7FD29CC390600C890A6 /* Starscream */ = {
isa = XCSwiftPackageProductDependency;
package = CB5EC7FC29CC390600C890A6 /* XCRemoteSwiftPackageReference "Starscream" */;
productName = Starscream;
};
/* End XCSwiftPackageProductDependency section */
/* Begin XCVersionGroup section */

View File

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

View File

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