From f4e5b103f782be211f6c7a57c97d965c8a0d8beb Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 7 Nov 2024 17:05:56 -0800 Subject: [PATCH 1/2] prevent duplicate code blocks --- gui/src/components/mainInput/TipTapEditor.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index 01ee8dea6..49fe9d547 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -700,9 +700,11 @@ function TipTapEditor(props: TipTapEditorProps) { ); const rangeStr = `(${rif.range.start.line + 1}-${rif.range.end.line + 1 })`; + + const itemName = `${basename} ${rangeStr}`; const item: ContextItemWithId = { content: rif.contents, - name: `${basename} ${rangeStr}`, + name: itemName, // Description is passed on to the LLM to give more context on file path description: `${relativePath} ${rangeStr}`, id: { @@ -717,6 +719,9 @@ function TipTapEditor(props: TipTapEditorProps) { let index = 0; for (const el of editor.getJSON().content) { + if (el.attrs?.item?.name === itemName) { + return; // Prevent duplicate code blocks + } if (el.type === "codeBlock") { index += 2; } else { From 52caeda487c3a1da5696a79423fc60d4362b5f74 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Fri, 8 Nov 2024 09:09:46 -0800 Subject: [PATCH 2/2] lmstudio embeddings p1 --- core/index.d.ts | 1 + core/indexing/embeddings/LMStudio.ts | 13 +++++++++++++ .../customize/model-providers/more/textgenwebui.md | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 core/indexing/embeddings/LMStudio.ts diff --git a/core/index.d.ts b/core/index.d.ts index ef8b7c128..1c14820af 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -834,6 +834,7 @@ export type EmbeddingsProviderName = | "ollama" | "openai" | "cohere" + | "lmstudio" | "free-trial" | "gemini" | "continue-proxy" diff --git a/core/indexing/embeddings/LMStudio.ts b/core/indexing/embeddings/LMStudio.ts new file mode 100644 index 000000000..af5e390fb --- /dev/null +++ b/core/indexing/embeddings/LMStudio.ts @@ -0,0 +1,13 @@ +import { EmbeddingsProviderName, EmbedOptions } from "../.."; +import OpenAIEmbeddingsProvider from "./OpenAIEmbeddingsProvider"; + +class LMStudioEmbeddingsProvider extends OpenAIEmbeddingsProvider { + static providerName: EmbeddingsProviderName = "lmstudio"; + + static defaultOptions: Partial | undefined = { + apiBase: "http://localhost:1234/v1", + model: "BAAI/bge-en-icl", + }; +} + +export default LMStudioEmbeddingsProvider; \ No newline at end of file diff --git a/docs/docs/customize/model-providers/more/textgenwebui.md b/docs/docs/customize/model-providers/more/textgenwebui.md index 9abf2b9e8..723079735 100644 --- a/docs/docs/customize/model-providers/more/textgenwebui.md +++ b/docs/docs/customize/model-providers/more/textgenwebui.md @@ -8,7 +8,7 @@ TextGenWebUI is a comprehensive, open-source language model UI and local server. { "title": "Text Generation WebUI", "provider": "text-gen-webui", - "apiBase": "http://localhost:5000", + "apiBase": "http://localhost:5000/v1", "model": "MODEL_NAME" } ]