diff --git a/gpt4all-chat/chatllm.cpp b/gpt4all-chat/chatllm.cpp index 073a1d7a..b54a8696 100644 --- a/gpt4all-chat/chatllm.cpp +++ b/gpt4all-chat/chatllm.cpp @@ -770,14 +770,14 @@ bool ChatLLM::prompt(const QList &collectionList, const QString &prompt bool ChatLLM::promptInternal(const QList &collectionList, const QString &prompt, const QString &promptTemplate, int32_t n_predict, int32_t top_k, float top_p, float min_p, float temp, int32_t n_batch, float repeat_penalty, - int32_t repeat_penalty_tokens) + int32_t repeat_penalty_tokens, bool isToolCallResponse) { if (!isModelLoaded()) return false; QList databaseResults; const int retrievalSize = MySettings::globalInstance()->localDocsRetrievalSize(); - if (!collectionList.isEmpty()) { + if (!collectionList.isEmpty() && !isToolCallResponse) { emit requestRetrieveFromDB(collectionList, prompt, retrievalSize, &databaseResults); // blocks emit sourceExcerptsChanged(databaseResults); } @@ -847,7 +847,7 @@ bool ChatLLM::promptInternal(const QList &collectionList, const QString } SuggestionMode mode = MySettings::globalInstance()->suggestionMode(); - if (mode == SuggestionMode::On || (!databaseResults.isEmpty() && mode == SuggestionMode::LocalDocsOnly)) + if (mode == SuggestionMode::On || (mode == SuggestionMode::SourceExcerptsOnly && (!databaseResults.isEmpty() || isToolCallResponse))) generateQuestions(elapsed); else emit responseStopped(elapsed); @@ -876,7 +876,7 @@ bool ChatLLM::toolCallInternal(const QString &toolCall, int32_t n_predict, int32 } else { qWarning() << "WARNING: Could not find the tool for " << toolCall; return promptInternal(QList()/*collectionList*/, QString() /*prompt*/, promptTemplate, - n_predict, top_k, top_p, min_p, temp, n_batch, repeat_penalty, repeat_penalty_tokens); + n_predict, top_k, top_p, min_p, temp, n_batch, repeat_penalty, repeat_penalty_tokens, true /*isToolCallResponse*/); } const QString apiKey = MySettings::globalInstance()->braveSearchAPIKey(); @@ -888,7 +888,7 @@ bool ChatLLM::toolCallInternal(const QString &toolCall, int32_t n_predict, int32 emit sourceExcerptsChanged(braveResponse.second); return promptInternal(QList()/*collectionList*/, braveResponse.first, promptTemplate, - n_predict, top_k, top_p, min_p, temp, n_batch, repeat_penalty, repeat_penalty_tokens); + n_predict, top_k, top_p, min_p, temp, n_batch, repeat_penalty, repeat_penalty_tokens, true /*isToolCallResponse*/); } void ChatLLM::setShouldBeLoaded(bool b) diff --git a/gpt4all-chat/chatllm.h b/gpt4all-chat/chatllm.h index 31e99c71..b4874b70 100644 --- a/gpt4all-chat/chatllm.h +++ b/gpt4all-chat/chatllm.h @@ -199,7 +199,7 @@ Q_SIGNALS: protected: bool promptInternal(const QList &collectionList, const QString &prompt, const QString &promptTemplate, int32_t n_predict, int32_t top_k, float top_p, float min_p, float temp, int32_t n_batch, float repeat_penalty, - int32_t repeat_penalty_tokens); + int32_t repeat_penalty_tokens, bool isToolCallResponse = false); bool toolCallInternal(const QString &toolcall, int32_t n_predict, int32_t top_k, float top_p, float min_p, float temp, int32_t n_batch, float repeat_penalty, int32_t repeat_penalty_tokens); bool handlePrompt(int32_t token); diff --git a/gpt4all-chat/mysettings.cpp b/gpt4all-chat/mysettings.cpp index 57f94ca2..e1530a85 100644 --- a/gpt4all-chat/mysettings.cpp +++ b/gpt4all-chat/mysettings.cpp @@ -51,7 +51,7 @@ static const QVariantMap basicDefaults { { "saveChatsContext", false }, { "serverChat", false }, { "userDefaultModel", "Application default" }, - { "suggestionMode", QVariant::fromValue(SuggestionMode::LocalDocsOnly) }, + { "suggestionMode", QVariant::fromValue(SuggestionMode::SourceExcerptsOnly) }, { "localdocs/chunkSize", 512 }, { "localdocs/retrievalSize", 3 }, { "localdocs/showReferences", true }, diff --git a/gpt4all-chat/mysettings.h b/gpt4all-chat/mysettings.h index d4aa4c5a..59301cf2 100644 --- a/gpt4all-chat/mysettings.h +++ b/gpt4all-chat/mysettings.h @@ -21,9 +21,9 @@ namespace MySettingsEnums { * ApplicationSettings.qml, as well as the corresponding name lists in mysettings.cpp */ enum class SuggestionMode { - LocalDocsOnly = 0, - On = 1, - Off = 2, + SourceExcerptsOnly = 0, + On = 1, + Off = 2, }; Q_ENUM_NS(SuggestionMode) diff --git a/gpt4all-chat/qml/ApplicationSettings.qml b/gpt4all-chat/qml/ApplicationSettings.qml index 1e459e99..5fe4bea5 100644 --- a/gpt4all-chat/qml/ApplicationSettings.qml +++ b/gpt4all-chat/qml/ApplicationSettings.qml @@ -350,7 +350,7 @@ MySettingsTab { Layout.alignment: Qt.AlignRight // NOTE: indices match values of SuggestionMode enum, keep them in sync model: ListModel { - ListElement { name: qsTr("When chatting with LocalDocs") } + ListElement { name: qsTr("When source excerpts are cited") } ListElement { name: qsTr("Whenever possible") } ListElement { name: qsTr("Never") } }