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