MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / askForChat

Method askForChat

src/plugins/chat/widgets/inlinechatwidget.cpp:530–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

528}
529
530bool InlineChatWidgetPrivate::askForChat()
531{
532 chatInfo.originalRange = editSrv->getBackgroundRange(chatInfo.fileName, selectionMarker);
533 if (chatInfo.originalRange.start.line == -1 || chatInfo.originalRange.end.line == -1)
534 return false;
535 chatInfo.originalText = editSrv->rangeText(chatInfo.fileName, chatInfo.originalRange);
536
537 auto f = questionLabel->font();
538 f.setUnderline(state == QuestionStart);
539 questionLabel->setFont(f);
540
541 auto question = edit->toPlainText();
542 if (prevState == FollowSubmit && state == SubmitStart) {
543 auto historyQuestion = questionLabel->text();
544 if (!historyQuestion.isEmpty())
545 question.prepend(historyQuestion + ", ");
546 }
547
548 QSignalBlocker blk(edit);
549 edit->clear();
550 edit->onTextChanged();
551 questionLabel->setEnabled(true);
552 answerLabel->setEnabled(true);
553 questionLabel->setText(question);
554 answerLabel->clear();
555
556 auto *futureWatcher = new QFutureWatcher<QString>();
557 futureWatcher->setFuture(QtConcurrent::run(this, &InlineChatWidgetPrivate::createPrompt, question, false));
558 connect(futureWatcher, &QFutureWatcher<QString>::finished, this, &InlineChatWidgetPrivate::handleCreatePromptFinished);
559 futureWatcherList << futureWatcher;
560 return true;
561}
562
563QList<Diff> InlineChatWidgetPrivate::diffText(const QString &str1, const QString &str2)
564{

Callers

nothing calls this directly

Calls 11

connectFunction · 0.85
fontMethod · 0.80
onTextChangedMethod · 0.80
getBackgroundRangeMethod · 0.45
rangeTextMethod · 0.45
setFontMethod · 0.45
textMethod · 0.45
isEmptyMethod · 0.45
clearMethod · 0.45
setEnabledMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected