Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,8 @@ function pageFunction(context) {
|
|
13 |
const $ = context.jQuery;
|
14 |
const data = {
|
15 |
title: $('title').text(),
|
16 |
-
content: $('body').text()
|
|
|
17 |
};
|
18 |
return data;
|
19 |
}
|
@@ -32,7 +33,7 @@ def fetch_website_content(website_url):
|
|
32 |
|
33 |
# Fetch and index website content
|
34 |
content = fetch_website_content("https://python.langchain.com/en/latest/")
|
35 |
-
documents = [Document(page_content=item["content"] or "", metadata={"source":
|
36 |
index = VectorstoreIndexCreator().from_loaders([documents])
|
37 |
|
38 |
# Function for the Gradio UI
|
|
|
13 |
const $ = context.jQuery;
|
14 |
const data = {
|
15 |
title: $('title').text(),
|
16 |
+
content: $('body').text(),
|
17 |
+
url: context.request.url
|
18 |
};
|
19 |
return data;
|
20 |
}
|
|
|
33 |
|
34 |
# Fetch and index website content
|
35 |
content = fetch_website_content("https://python.langchain.com/en/latest/")
|
36 |
+
documents = [Document(page_content=item["content"] or "", metadata={"source": item.get("url", "Unknown URL")}) for item in content]
|
37 |
index = VectorstoreIndexCreator().from_loaders([documents])
|
38 |
|
39 |
# Function for the Gradio UI
|