mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-10 17:00:11 +01:00
[FIX] Document pinning does not count in query mode (#1250)
* if document is pinned, do not give queryRefusalResponse message * forgot embed.js patch --------- Co-authored-by: timothycarambat <rambat1010@gmail.com>
This commit is contained in:
parent
244ce2e307
commit
d02013fd71
@ -131,7 +131,11 @@ async function streamChatWithForEmbed(
|
||||
|
||||
// If in query mode and no sources are found, do not
|
||||
// let the LLM try to hallucinate a response or use general knowledge
|
||||
if (chatMode === "query" && sources.length === 0) {
|
||||
if (
|
||||
chatMode === "query" &&
|
||||
sources.length === 0 &&
|
||||
pinnedDocIdentifiers.length === 0
|
||||
) {
|
||||
writeResponseChunk(response, {
|
||||
id: uuid,
|
||||
type: "textResponse",
|
||||
|
@ -140,9 +140,13 @@ async function chatWithWorkspace(
|
||||
contextTexts = [...contextTexts, ...vectorSearchResults.contextTexts];
|
||||
sources = [...sources, ...vectorSearchResults.sources];
|
||||
|
||||
// If in query mode and no sources are found, do not
|
||||
// If in query mode and no sources are found from the vector search and no pinned documents, do not
|
||||
// let the LLM try to hallucinate a response or use general knowledge and exit early
|
||||
if (chatMode === "query" && sources.length === 0) {
|
||||
if (
|
||||
chatMode === "query" &&
|
||||
vectorSearchResults.sources.length === 0 &&
|
||||
pinnedDocIdentifiers.length === 0
|
||||
) {
|
||||
return {
|
||||
id: uuid,
|
||||
type: "textResponse",
|
||||
|
@ -160,9 +160,13 @@ async function streamChatWithWorkspace(
|
||||
contextTexts = [...contextTexts, ...vectorSearchResults.contextTexts];
|
||||
sources = [...sources, ...vectorSearchResults.sources];
|
||||
|
||||
// If in query mode and no sources are found, do not
|
||||
// If in query mode and no sources are found from the vector search and no pinned documents, do not
|
||||
// let the LLM try to hallucinate a response or use general knowledge and exit early
|
||||
if (chatMode === "query" && sources.length === 0) {
|
||||
if (
|
||||
chatMode === "query" &&
|
||||
sources.length === 0 &&
|
||||
pinnedDocIdentifiers.length === 0
|
||||
) {
|
||||
writeResponseChunk(response, {
|
||||
id: uuid,
|
||||
type: "textResponse",
|
||||
|
Loading…
Reference in New Issue
Block a user