mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-06-23 22:18:38 +00:00
Better name for database results.
This commit is contained in:
parent
8c6ee9d02e
commit
f29d50eeef
@ -159,14 +159,14 @@ void Chat::handleModelLoadedChanged()
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
QList<ResultInfo> Chat::results() const
|
||||
QList<ResultInfo> Chat::databaseResults() const
|
||||
{
|
||||
return m_llmodel->results();
|
||||
return m_llmodel->databaseResults();
|
||||
}
|
||||
|
||||
void Chat::promptProcessing()
|
||||
{
|
||||
m_responseState = !results().isEmpty() ? Chat::LocalDocsProcessing : Chat::PromptProcessing;
|
||||
m_responseState = !databaseResults().isEmpty() ? Chat::LocalDocsProcessing : Chat::PromptProcessing;
|
||||
emit responseStateChanged();
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ void Chat::responseStopped()
|
||||
QList<QString> references;
|
||||
QList<QString> referencesContext;
|
||||
int validReferenceNumber = 1;
|
||||
for (const ResultInfo &info : results()) {
|
||||
for (const ResultInfo &info : databaseResults()) {
|
||||
if (info.file.isEmpty())
|
||||
continue;
|
||||
if (validReferenceNumber == 1)
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
Q_INVOKABLE void stopGenerating();
|
||||
Q_INVOKABLE void newPromptResponsePair(const QString &prompt);
|
||||
|
||||
QList<ResultInfo> results() const;
|
||||
QList<ResultInfo> databaseResults() const;
|
||||
|
||||
QString response() const;
|
||||
bool responseInProgress() const { return m_responseInProgress; }
|
||||
|
@ -392,15 +392,15 @@ bool ChatLLM::prompt(const QString &prompt, const QString &prompt_template, int3
|
||||
if (!isModelLoaded())
|
||||
return false;
|
||||
|
||||
m_results.clear();
|
||||
m_databaseResults.clear();
|
||||
const int retrievalSize = LocalDocs::globalInstance()->retrievalSize();
|
||||
emit requestRetrieveFromDB(m_chat->collectionList(), prompt, retrievalSize, &m_results); // blocks
|
||||
emit requestRetrieveFromDB(m_chat->collectionList(), prompt, retrievalSize, &m_databaseResults); // blocks
|
||||
|
||||
// Augment the prompt template with the results if any
|
||||
QList<QString> augmentedTemplate;
|
||||
if (!m_results.isEmpty())
|
||||
if (!m_databaseResults.isEmpty())
|
||||
augmentedTemplate.append("### Context:");
|
||||
for (const ResultInfo &info : m_results)
|
||||
for (const ResultInfo &info : m_databaseResults)
|
||||
augmentedTemplate.append(info.text);
|
||||
augmentedTemplate.append(prompt_template);
|
||||
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
void regenerateResponse();
|
||||
void resetResponse();
|
||||
void resetContext();
|
||||
QList<ResultInfo> results() const { return m_results; }
|
||||
QList<ResultInfo> databaseResults() const { return m_databaseResults; }
|
||||
|
||||
void stopGenerating() { m_stopGenerating = true; }
|
||||
|
||||
@ -115,7 +115,7 @@ protected:
|
||||
QThread m_llmThread;
|
||||
std::atomic<bool> m_stopGenerating;
|
||||
std::atomic<bool> m_shouldBeLoaded;
|
||||
QList<ResultInfo> m_results;
|
||||
QList<ResultInfo> m_databaseResults;
|
||||
bool m_isRecalc;
|
||||
bool m_isServer;
|
||||
bool m_isChatGPT;
|
||||
|
@ -331,7 +331,7 @@ QHttpServerResponse Server::handleCompletionRequest(const QHttpServerRequest &re
|
||||
QString echoedPrompt = actualPrompt;
|
||||
if (!echoedPrompt.endsWith("\n"))
|
||||
echoedPrompt += "\n";
|
||||
responses.append(qMakePair((echo ? QString("%1\n").arg(actualPrompt) : QString()) + response(), m_results));
|
||||
responses.append(qMakePair((echo ? QString("%1\n").arg(actualPrompt) : QString()) + response(), m_databaseResults));
|
||||
if (!promptTokens)
|
||||
promptTokens += m_promptTokens;
|
||||
responseTokens += m_promptResponseTokens - m_promptTokens;
|
||||
|
Loading…
Reference in New Issue
Block a user