Latest rc5 fixes (#2492)

* Adjust the size of the new conversation tray to enlarge a bit.

* Add themeable code syntax highlighting.

* Change the default size to a larger context chunk for localdocs.

Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
AT
2024-06-30 19:15:01 -04:00
committed by GitHub
parent 4a1a3c48e8
commit 37dbd56153
5 changed files with 348 additions and 288 deletions

View File

@@ -949,13 +949,35 @@ Rectangle {
ChatViewTextProcessor {
id: textProcessor
fontPixelSize: myTextArea.font.pixelSize
}
function resetChatViewTextProcessor() {
textProcessor.fontPixelSize = myTextArea.font.pixelSize
textProcessor.codeColors.defaultColor = theme.codeDefaultColor
textProcessor.codeColors.keywordColor = theme.codeKeywordColor
textProcessor.codeColors.functionColor = theme.codeFunctionColor
textProcessor.codeColors.functionCallColor = theme.codeFunctionCallColor
textProcessor.codeColors.commentColor = theme.codeCommentColor
textProcessor.codeColors.stringColor = theme.codeStringColor
textProcessor.codeColors.numberColor = theme.codeNumberColor
textProcessor.codeColors.headerColor = theme.codeHeaderColor
textProcessor.codeColors.backgroundColor = theme.codeBackgroundColor
textProcessor.textDocument = textDocument
myTextArea.text = value
}
Component.onCompleted: {
textProcessor.setLinkColor(theme.linkColor);
textProcessor.setHeaderColor(name === qsTr("Response: ") ? theme.darkContrast : theme.lightContrast);
textProcessor.textDocument = textDocument
resetChatViewTextProcessor();
}
Connections {
target: MySettings
function onFontSizeChanged() {
myTextArea.resetChatViewTextProcessor();
}
function onChatThemeChanged() {
myTextArea.resetChatViewTextProcessor();
}
}
Accessible.role: Accessible.Paragraph
@@ -1463,7 +1485,7 @@ Rectangle {
id: conversationTrayButton
anchors.bottom: textInputView.top
anchors.horizontalCenter: textInputView.horizontalCenter
width: 30
width: 40
height: 30
visible: chatModel.count && !currentChat.isServer && currentChat.isModelLoaded
property bool isHovered: conversationTrayMouseAreaButton.containsMouse
@@ -1474,13 +1496,14 @@ Rectangle {
}
Text {
id: conversationTrayTextButton
anchors.horizontalCenter: parent.horizontalCenter
anchors.centerIn: parent
horizontalAlignment: Qt.AlignHCenter
leftPadding: 5
rightPadding: 5
text: "\u00B7\u00B7\u00B7"
color: theme.textColor
font.pixelSize: 20 // fixed size
font.pixelSize: 30 // fixed size
font.bold: true
}
}
@@ -1670,8 +1693,8 @@ Rectangle {
anchors.right: textInputView.right
anchors.verticalCenter: textInputView.verticalCenter
anchors.rightMargin: 15
imageWidth: theme.fontSizeLarger
imageHeight: theme.fontSizeLarger
imageWidth: theme.fontSizeLargest
imageHeight: theme.fontSizeLargest
visible: !currentChat.isServer && ModelList.selectableModels.count !== 0
enabled: !currentChat.responseInProgress
source: "qrc:/gpt4all/icons/send_message.svg"

View File

@@ -824,8 +824,6 @@ QtObject {
// lighter contrast
property color mutedLighterTextColor: {
switch (MySettings.chatTheme) {
// case "LegacyDark":
// case "Dark":
default:
return gray300;
}
@@ -834,8 +832,6 @@ QtObject {
// light contrast
property color mutedLightTextColor: {
switch (MySettings.chatTheme) {
// case "LegacyDark":
// case "Dark":
default:
return gray400;
}
@@ -1069,6 +1065,95 @@ QtObject {
}
}
property color codeDefaultColor: {
switch (MySettings.chatTheme) {
case "LegacyDark":
case "Dark":
default:
return textColor;
}
}
property color codeKeywordColor: {
switch (MySettings.chatTheme) {
case "LegacyDark":
case "Dark":
return "#2e95d3"; // blue
default:
return "#195273"; // dark blue
}
}
property color codeFunctionColor: {
switch (MySettings.chatTheme) {
case "LegacyDark":
case "Dark":
return"#f22c3d"; // red
default:
return"#7d1721"; // dark red
}
}
property color codeFunctionCallColor: {
switch (MySettings.chatTheme) {
case "LegacyDark":
case "Dark":
return "#e9950c"; // orange
default:
return "#815207"; // dark orange
}
}
property color codeCommentColor: {
switch (MySettings.chatTheme) {
case "LegacyDark":
case "Dark":
return "#808080"; // gray
default:
return "#474747"; // dark gray
}
}
property color codeStringColor: {
switch (MySettings.chatTheme) {
case "LegacyDark":
case "Dark":
return "#00a37d"; // green
default:
return "#004a39"; // dark green
}
}
property color codeNumberColor: {
switch (MySettings.chatTheme) {
case "LegacyDark":
case "Dark":
return "#df3079"; // fuchsia
default:
return "#761942"; // dark fuchsia
}
}
property color codeHeaderColor: {
switch (MySettings.chatTheme) {
case "LegacyDark":
case "Dark":
return containerBackground;
default:
return green50;
}
}
property color codeBackgroundColor: {
switch (MySettings.chatTheme) {
case "LegacyDark":
case "Dark":
return controlBackground;
default:
return gray100;
}
}
property real fontScale: MySettings.fontSize === "Small" ? 1 :
MySettings.fontSize === "Medium" ? 1.3 :
/* "Large" */ 1.8