gufett0 commited on
Commit
d1a1a8f
·
1 Parent(s): 7282ada

added introductory prompt

Browse files
Files changed (1) hide show
  1. backend.py +5 -5
backend.py CHANGED
@@ -66,8 +66,8 @@ def build_index(path: str):
66
  # Build the vector store index from the nodes
67
  index = VectorStoreIndex(nodes)
68
 
69
- storage_context = StorageContext.from_defaults()
70
- index.storage_context.persist(persist_dir=PERSIST_DIR)
71
 
72
  return index
73
 
@@ -79,7 +79,7 @@ def handle_query(query_str: str,
79
 
80
  conversation: List[ChatMessage] = []
81
  for user, assistant in chat_history:
82
- conversation.extend([
83
  ChatMessage(role=MessageRole.USER, content=user),
84
  ChatMessage(role=MessageRole.ASSISTANT, content=assistant),
85
  ]
@@ -105,10 +105,10 @@ def handle_query(query_str: str,
105
 
106
  else:
107
 
108
- index = build_index(matched_path)
109
  #storage_context = StorageContext.from_defaults(persist_dir=PERSIST_DIR)
110
  #index = load_index_from_storage(storage_context)
111
- gr.Info("index costruito sulla base dello storage db")
112
 
113
  try:
114
 
 
66
  # Build the vector store index from the nodes
67
  index = VectorStoreIndex(nodes)
68
 
69
+ #storage_context = StorageContext.from_defaults()
70
+ #index.storage_context.persist(persist_dir=PERSIST_DIR)
71
 
72
  return index
73
 
 
79
 
80
  conversation: List[ChatMessage] = []
81
  for user, assistant in chat_history:
82
+ conversation.append([
83
  ChatMessage(role=MessageRole.USER, content=user),
84
  ChatMessage(role=MessageRole.ASSISTANT, content=assistant),
85
  ]
 
105
 
106
  else:
107
 
108
+ #index = build_index(matched_path)
109
  #storage_context = StorageContext.from_defaults(persist_dir=PERSIST_DIR)
110
  #index = load_index_from_storage(storage_context)
111
+ gr.Info("index is true")
112
 
113
  try:
114