first version: dvm that provides users to block from reports of input pubkeys

This commit is contained in:
Believethehype
2024-04-02 18:24:49 +02:00
parent 1f4f7cd5ac
commit dfd79bfe59
5 changed files with 257 additions and 16 deletions

View File

@@ -1,5 +1,6 @@
import json
import os
import re
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface, process_venv
from nostr_dvm.utils.admin_utils import AdminConfig
@@ -106,7 +107,9 @@ class TextSummarizationHuggingChat(DVMTaskInterface):
try:
chatbot = hugchat.ChatBot(cookies=cookies.get_dict()) # or cookie_path="usercookies/<email>.json"
query_result = chatbot.query("Summarize the following notes: " + options["prompt"])
text = re.sub(r'^https?:\/\/.*[\r\n]*', '', str(options["prompt"]), flags=re.MULTILINE)
query_result = chatbot.query("Summarize the following notes: " + text[:3500])
print(query_result["text"]) # or query_result.text or query_result["text"]
return str(query_result["text"]).lstrip()