| 160 | } |
| 161 | |
| 162 | void MessageComponent::initSenderInfo() |
| 163 | { |
| 164 | QHBoxLayout *senderInfoLayout = new QHBoxLayout; |
| 165 | qobject_cast<QVBoxLayout *>(layout())->addLayout(senderInfoLayout); |
| 166 | |
| 167 | senderHead = new DLabel(this); |
| 168 | senderName = new DLabel(this); |
| 169 | |
| 170 | editButton = new DPushButton(this); |
| 171 | editButton->setIcon(QIcon::fromTheme("uc_chat_edit")); |
| 172 | editButton->setFlat(true); |
| 173 | editButton->setFixedSize(QSize(24, 24)); |
| 174 | editButton->setToolTip(tr("edit")); |
| 175 | |
| 176 | auto currentLLMInfo = ChatManager::instance()->getCurrentLLMInfo(); |
| 177 | |
| 178 | switch (messageData.messageType()) { |
| 179 | case MessageData::Ask: { |
| 180 | senderName->setText("You"); |
| 181 | senderHead->setPixmap(QIcon::fromTheme("uc_chat_user").pixmap(24, 24)); |
| 182 | break; |
| 183 | } |
| 184 | case MessageData::Anwser: |
| 185 | senderName->setText(currentLLMInfo.modelName); |
| 186 | if (!currentLLMInfo.icon.isNull()) |
| 187 | senderHead->setPixmap(currentLLMInfo.icon.pixmap(24, 24)); |
| 188 | editButton->setVisible(false); |
| 189 | break; |
| 190 | } |
| 191 | |
| 192 | senderInfoLayout->setSpacing(5); |
| 193 | senderInfoLayout->addWidget(senderHead); |
| 194 | senderInfoLayout->addWidget(senderName); |
| 195 | senderInfoLayout->addStretch(1); |
| 196 | senderInfoLayout->addWidget(editButton); |
| 197 | } |
| 198 | |
| 199 | void MessageComponent::initMessageSection() |
| 200 | { |
nothing calls this directly
no test coverage detected