mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 16:17:57 +01:00
Only update the chroma database when necessary
This commit is contained in:
parent
5a4bd3918c
commit
6afba065a1
@ -64,7 +64,6 @@ class SentenceTransformerEmbedder(Embedder):
|
|||||||
|
|
||||||
embedder = SentenceTransformerEmbedder()
|
embedder = SentenceTransformerEmbedder()
|
||||||
collector = ChromaCollector(embedder)
|
collector = ChromaCollector(embedder)
|
||||||
global_data = ''
|
|
||||||
|
|
||||||
|
|
||||||
def feed_data_into_collector(corpus):
|
def feed_data_into_collector(corpus):
|
||||||
@ -86,7 +85,6 @@ def input_modifier(string):
|
|||||||
user_input = ''
|
user_input = ''
|
||||||
|
|
||||||
# Get the 5 most similar chunks
|
# Get the 5 most similar chunks
|
||||||
feed_data_into_collector(global_data)
|
|
||||||
results = collector.get(user_input, n_results=5)
|
results = collector.get(user_input, n_results=5)
|
||||||
|
|
||||||
# Make the replacements
|
# Make the replacements
|
||||||
@ -141,5 +139,5 @@ def ui():
|
|||||||
last_updated = gr.Markdown()
|
last_updated = gr.Markdown()
|
||||||
|
|
||||||
update.click(
|
update.click(
|
||||||
lambda x: globals().update(global_data=x), data_input, None).then(
|
feed_data_into_collector, data_input, None).then(
|
||||||
lambda: "Last updated on " + str(datetime.datetime.now()), None, last_updated, show_progress=False)
|
lambda: "Last updated on " + str(datetime.datetime.now()), None, last_updated, show_progress=False)
|
||||||
|
Loading…
Reference in New Issue
Block a user