mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-06-04 01:28:58 -04:00
Version 0.3.1
Improve chat text input Add Llama chat support Fix monospace font
This commit is contained in:
commit
d6e02d9d2a
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"Name" : "QodeAssist",
|
"Name" : "QodeAssist",
|
||||||
"Version" : "0.3.0",
|
"Version" : "0.3.1",
|
||||||
"CompatVersion" : "${IDE_VERSION_COMPAT}",
|
"CompatVersion" : "${IDE_VERSION_COMPAT}",
|
||||||
"Vendor" : "Petr Mironychev",
|
"Vendor" : "Petr Mironychev",
|
||||||
"Copyright" : "(C) ${IDE_COPYRIGHT_YEAR} Petr Mironychev, (C) ${IDE_COPYRIGHT_YEAR} The Qt Company Ltd",
|
"Copyright" : "(C) ${IDE_COPYRIGHT_YEAR} Petr Mironychev, (C) ${IDE_COPYRIGHT_YEAR} The Qt Company Ltd",
|
||||||
|
@ -7,7 +7,6 @@ namespace QodeAssist::Chat {
|
|||||||
|
|
||||||
void ChatUtils::copyToClipboard(const QString &text)
|
void ChatUtils::copyToClipboard(const QString &text)
|
||||||
{
|
{
|
||||||
qDebug() << "call clipboard" << text;
|
|
||||||
QGuiApplication::clipboard()->setText(text);
|
QGuiApplication::clipboard()->setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,17 +81,16 @@ ChatRootView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
ScrollView {
|
||||||
Layout.fillWidth: true
|
id: view
|
||||||
spacing: 5
|
|
||||||
|
|
||||||
QQC.TextField {
|
Layout.fillWidth: true
|
||||||
|
Layout.minimumHeight: 30
|
||||||
|
Layout.maximumHeight: root.height / 2
|
||||||
|
|
||||||
|
QQC.TextArea {
|
||||||
id: messageInput
|
id: messageInput
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.minimumWidth: 60
|
|
||||||
Layout.minimumHeight: 30
|
|
||||||
rightInset: -(parent.width - sendButton.width - clearButton.width)
|
|
||||||
placeholderText: qsTr("Type your message here...")
|
placeholderText: qsTr("Type your message here...")
|
||||||
placeholderTextColor: "#888"
|
placeholderTextColor: "#888"
|
||||||
color: root.primaryColor.hslLightness > 0.5 ? "black" : "white"
|
color: root.primaryColor.hslLightness > 0.5 ? "black" : "white"
|
||||||
@ -102,30 +101,31 @@ ChatRootView {
|
|||||||
: Qt.darker(root.primaryColor, 1.5)
|
: Qt.darker(root.primaryColor, 1.5)
|
||||||
border.width: 1
|
border.width: 1
|
||||||
}
|
}
|
||||||
|
Keys.onPressed: function(event) {
|
||||||
onAccepted: sendButton.clicked()
|
if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && !(event.modifiers & Qt.ShiftModifier)) {
|
||||||
|
sendChatMessage()
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: sendButton
|
id: sendButton
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignBottom
|
||||||
Layout.minimumHeight: 30
|
|
||||||
text: qsTr("Send")
|
text: qsTr("Send")
|
||||||
onClicked: {
|
onClicked: sendChatMessage()
|
||||||
if (messageInput.text.trim() !== "") {
|
|
||||||
root.sendMessage(messageInput.text);
|
|
||||||
messageInput.text = ""
|
|
||||||
scrollToBottom()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
id: clearButton
|
id: clearButton
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignBottom
|
||||||
Layout.minimumHeight: 30
|
text: qsTr("Clear Chat")
|
||||||
text: qsTr("Clear")
|
|
||||||
onClicked: clearChat()
|
onClicked: clearChat()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,4 +158,10 @@ ChatRootView {
|
|||||||
function scrollToBottom() {
|
function scrollToBottom() {
|
||||||
Qt.callLater(chatListView.positionViewAtEnd)
|
Qt.callLater(chatListView.positionViewAtEnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sendChatMessage() {
|
||||||
|
root.sendMessage(messageInput.text);
|
||||||
|
messageInput.text = ""
|
||||||
|
scrollToBottom()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,19 @@ Rectangle {
|
|||||||
property string language: ""
|
property string language: ""
|
||||||
property color selectionColor
|
property color selectionColor
|
||||||
|
|
||||||
|
readonly property string monospaceFont: {
|
||||||
|
switch (Qt.platform.os) {
|
||||||
|
case "windows":
|
||||||
|
return "Consolas";
|
||||||
|
case "osx":
|
||||||
|
return "Menlo";
|
||||||
|
case "linux":
|
||||||
|
return "DejaVu Sans Mono";
|
||||||
|
default:
|
||||||
|
return "monospace";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
border.color: root.color.hslLightness > 0.5 ? Qt.darker(root.color, 1.3)
|
border.color: root.color.hslLightness > 0.5 ? Qt.darker(root.color, 1.3)
|
||||||
: Qt.lighter(root.color, 1.3)
|
: Qt.lighter(root.color, 1.3)
|
||||||
border.width: 2
|
border.width: 2
|
||||||
@ -48,7 +61,8 @@ Rectangle {
|
|||||||
text: root.code
|
text: root.code
|
||||||
readOnly: true
|
readOnly: true
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
font.family: "monospace"
|
font.family: monospaceFont
|
||||||
|
font.pointSize: 12
|
||||||
color: parent.color.hslLightness > 0.5 ? "black" : "white"
|
color: parent.color.hslLightness > 0.5 ? "black" : "white"
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
selectionColor: root.selectionColor
|
selectionColor: root.selectionColor
|
||||||
|
@ -94,6 +94,7 @@ public:
|
|||||||
templateManager.registerTemplate<Templates::DeepSeekCoderChat>();
|
templateManager.registerTemplate<Templates::DeepSeekCoderChat>();
|
||||||
templateManager.registerTemplate<Templates::CodeLlamaChat>();
|
templateManager.registerTemplate<Templates::CodeLlamaChat>();
|
||||||
templateManager.registerTemplate<Templates::QwenChat>();
|
templateManager.registerTemplate<Templates::QwenChat>();
|
||||||
|
templateManager.registerTemplate<Templates::LlamaChat>();
|
||||||
|
|
||||||
Utils::Icon QCODEASSIST_ICON(
|
Utils::Icon QCODEASSIST_ICON(
|
||||||
{{":/resources/images/qoderassist-icon.png", Utils::Theme::IconsBaseColor}});
|
{{":/resources/images/qoderassist-icon.png", Utils::Theme::IconsBaseColor}});
|
||||||
|
@ -46,4 +46,10 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class LlamaChat : public CodeLlamaChat
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QString name() const override { return "Llama Chat"; }
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace QodeAssist::Templates
|
} // namespace QodeAssist::Templates
|
||||||
|
Loading…
x
Reference in New Issue
Block a user