Latest stable branch includes sermon analysis endpoint, but not required for new installations
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
KJV_SERMON_DB="/home/tyler/kjv-api/sermon-analyzer/data/sermons.db"
|
||||
KJV_SERMON_DB="./data/sermons.db"
|
||||
# this does not do anything unless sermon_analyzer.py is running in tcp socket mode as a separate process
|
||||
KJV_SECRET_API_KEY="testing"
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
logs/*.log
|
||||
*__pycache__*
|
||||
@@ -744,6 +744,10 @@ def make_view(response_list=[]):
|
||||
response = jsonify(response_list)
|
||||
|
||||
|
||||
@app.get("/fe")
|
||||
def frontend():
|
||||
return send_file('kjv_fe.html')
|
||||
|
||||
@app.get("/search") # user-facing keyword search. To be moved to backend, possibly replaced with semantic search.
|
||||
def search():
|
||||
keywords = request.args.get("kw", None)
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
https://www.sqlite.org/fts5.html
|
||||
4.3.4. The Trigram Tokenizer
|
||||
|
||||
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
+68
-22
@@ -3,23 +3,83 @@
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
html{
|
||||
/* Dark Theme */
|
||||
body {
|
||||
background-color: #222;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Style the header */
|
||||
html {
|
||||
font-family: sans-serif;
|
||||
font-size: 14pt;
|
||||
font-size: 14.5pt;
|
||||
width: 768px;
|
||||
padding: 1px;
|
||||
margin-top: 15px;
|
||||
color: #fff; /* Text color */
|
||||
}
|
||||
|
||||
a {
|
||||
color: #007bff; /* Link color */
|
||||
}
|
||||
|
||||
.header {
|
||||
font-family: sans-serif;
|
||||
padding: 10px 16px;
|
||||
background: #333; /* Dark background */
|
||||
color: #fff; /* Text color */
|
||||
position: fixed;
|
||||
top: 5px;
|
||||
width: 768px;
|
||||
}
|
||||
a {
|
||||
color: #547720
|
||||
|
||||
input[type=text] {
|
||||
width: 75%;
|
||||
padding: 12px 20px;
|
||||
margin: 8px 0;
|
||||
box-sizing: border-box;
|
||||
text-align: left;
|
||||
font-size: 14.5pt;
|
||||
background-color: #333; /* Dark background */
|
||||
color: #fff; /* Text color */
|
||||
border: 1px solid #555; /* Border color */
|
||||
}
|
||||
|
||||
input[type=button], input[type=submit], input[type=reset] {
|
||||
font-family: sans-serif;
|
||||
background-color: #555; /* Dark button background */
|
||||
border: none;
|
||||
color: #fff; /* Button text color */
|
||||
padding: 16px 32px;
|
||||
text-decoration: none;
|
||||
margin: 4px 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
code {
|
||||
background-color: #222;
|
||||
color: #fff;
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.definition {
|
||||
padding: 8px;
|
||||
font-family: sans-serif;
|
||||
font-size: 14.5pt;
|
||||
width: 768px;
|
||||
padding: 1px;
|
||||
color: #fff; /* Text color */
|
||||
background-color: #222; /* Dark background */
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<h1>KJV API</h1>
|
||||
<p>KJV accessible via web calls</p>
|
||||
<h1>KJV API (Legacy edition)</h1>
|
||||
|
||||
<h2>Quick Search</h2>
|
||||
<form action="/find">
|
||||
<label for='kw'>Query</label><br>
|
||||
<label for='kw'>Keyword Search</label><br>
|
||||
<input type="text" name="kw"><br><br>
|
||||
<input type="hidden" name="view" value="rich"">
|
||||
<input type="submit">
|
||||
@@ -76,9 +136,6 @@ num=
|
||||
- Used only with /seq
|
||||
- You can get the "next # verses" in your sequence
|
||||
|
||||
|
||||
|
||||
|
||||
FEATURES
|
||||
========
|
||||
- King James Only. (No heretical commentaries or false Bibles)
|
||||
@@ -101,17 +158,6 @@ EXAMPLES
|
||||
api.tld/random
|
||||
api.tld/votd?view=rich
|
||||
api.tld/show?kw=john3:16,1john5:7&view=plain
|
||||
api.tld/search?kw=faith
|
||||
api.tld/search?kw=nimrod&view=rich
|
||||
api.tld/define?kw=faith&view=rich
|
||||
api.tld/define?kw=faith&view=rich
|
||||
api.tld/seq?getuid=true&start=2peter2:1
|
||||
api.tld/seq?uid=075a8496-9af7-4f44-84ec-ba3e7fa6de29&view=rich
|
||||
|
||||
INTEGRATION
|
||||
===========
|
||||
If you want to put the verse of the day into your website, you can use the following example php:
|
||||
echo curl_exec(curl_init('https://api.1611.social/votd?view=plain'));
|
||||
|
||||
BUGS
|
||||
====
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
# run from current directory only
|
||||
FILE=app.py
|
||||
if test -f "$FILE"; then
|
||||
uwsgi_python3 --http-socket 0.0.0.0:1612 --wsgi-file app.py --callable app --pyargv "-vvv" --stats 0.0.0.0:9192
|
||||
uwsgi_python310 --http-socket 0.0.0.0:1612 --wsgi-file app.py --callable app --pyargv "-vvv" --stats 0.0.0.0:9192
|
||||
else
|
||||
cd /opt/kjv-api
|
||||
echo "WARNING: RUNNING FROM /opt/kjv-api"
|
||||
uwsgi_python3 --http-socket 0.0.0.0:1612 --wsgi-file /opt/kjv-api/app.py --callable app --pyargv "-vvv"
|
||||
uwsgi_python310 --http-socket 0.0.0.0:1612 --wsgi-file /opt/kjv-api/app.py --callable app --pyargv "-vvv"
|
||||
fi
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
#!/bin/sh
|
||||
cd /opt/kjv-api
|
||||
uwsgi_python3 --http-socket :1611 --wsgi-file /opt/kjv-api/app.py --callable app --stats 127.0.0.1:9191
|
||||
uwsgi_python312 --http-socket :1611 --wsgi-file /opt/kjv-api/app.py --callable app --stats 127.0.0.1:9191
|
||||
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Search</title>
|
||||
<style>
|
||||
#search-box {
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#results {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#results li {
|
||||
margin-bottom: 10px;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Bible Semantic Search</h1>
|
||||
<p>This is NOT a keyword search. This means searching single words will not have the results you expect. For that, use the normal keyword search at <a href='/'>api.1611.social</a></p>
|
||||
<p>Use a sentence like "The Lord will kill his enemies without mercy" - you are supposed to search an idea, not individual words.</p>
|
||||
<h3>Recent searches:</h3>
|
||||
<ul id="last-searched"></ul>
|
||||
<input type="text" id="search-box" placeholder="The lord god is a man of war, just in all his dealings">
|
||||
<button id="search-button">Search</button>
|
||||
<ul id="results"></ul>
|
||||
|
||||
<script>
|
||||
const searchButton = document.getElementById('search-button');
|
||||
const searchBox = document.getElementById('search-box');
|
||||
const resultsList = document.getElementById('results');
|
||||
const lastSearched = document.getElementById('last-searched');
|
||||
|
||||
window.addEventListener('DOMContentLoaded', async () => {
|
||||
const lastSearchedURL = `https://api.1611.social/natural`;
|
||||
const data = {
|
||||
token: 'testing',
|
||||
query: '__last_searched__'
|
||||
};
|
||||
const response = await fetch(lastSearchedURL, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
if (response.ok) {
|
||||
const results = await response.json();
|
||||
lastSearched.innerHTML = ''; // Clear previous results
|
||||
|
||||
results.forEach(result => {
|
||||
const listItem = document.createElement('li');
|
||||
listItem.innerHTML = `
|
||||
${result.query}<br>
|
||||
`;
|
||||
lastSearched.appendChild(listItem);
|
||||
});
|
||||
} else {
|
||||
console.error('Error fetching data:', response.statusText);
|
||||
}
|
||||
});
|
||||
|
||||
searchButton.addEventListener('click', async () => {
|
||||
const query = searchBox.value;
|
||||
if (query.length >= 100){
|
||||
alert("Query too long");
|
||||
return;}
|
||||
const url = `https://api.1611.social/natural`; // Replace with your actual URL
|
||||
|
||||
const data = {
|
||||
token: 'testing',
|
||||
query: query
|
||||
};
|
||||
|
||||
const response = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const results = await response.json();
|
||||
resultsList.innerHTML = ''; // Clear previous results
|
||||
|
||||
results.forEach(result => {
|
||||
const listItem = document.createElement('li');
|
||||
const uriRef = encodeURIComponent(result.ref);
|
||||
listItem.innerHTML = `
|
||||
<strong>Verse ID:</strong> ${result.verse_id}<br>
|
||||
<strong>Text:</strong> ${result.text}<br>
|
||||
<strong>Ref:</strong> <a href=/find?kw=${uriRef}>${result.ref}</a><br>
|
||||
<strong>Score:</strong> ${result.score}
|
||||
`;
|
||||
resultsList.appendChild(listItem);
|
||||
});
|
||||
} else {
|
||||
console.error('Error fetching data:', response.statusText);
|
||||
alert('An error occurred while searching. Please try again later.');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
+35
-20
@@ -1,55 +1,70 @@
|
||||
<style>
|
||||
/* Style the header */
|
||||
/* Dark Theme */
|
||||
|
||||
.responses{
|
||||
body {
|
||||
background-color: #222;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Style the header */
|
||||
.responses {
|
||||
font-family: sans-serif;
|
||||
font-size: 14.5pt;
|
||||
width: 768px;
|
||||
padding: 1px;
|
||||
margin-top: 100px;
|
||||
color: #fff; /* Text color */
|
||||
width: auto;
|
||||
max-width: 100%; /* Ensure it doesn't exceed the container width */
|
||||
white-space: pre-wrap; /* Allow word wrapping */
|
||||
}
|
||||
a {
|
||||
color: #547720
|
||||
}
|
||||
|
||||
|
||||
a {
|
||||
color: #007bff; /* Link color */
|
||||
}
|
||||
|
||||
.header {
|
||||
font-family: sans-serif;
|
||||
padding: 10px 16px;
|
||||
background: #dbd5d5;
|
||||
color: #1a1919;
|
||||
background: #333; /* Dark background */
|
||||
color: #fff; /* Text color */
|
||||
position: fixed;
|
||||
top: 5px;
|
||||
width: 768px;
|
||||
}
|
||||
width: 98vw;
|
||||
max-width: 100%; /* Ensure it doesn't exceed the container width */
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
input[type=text] {
|
||||
input[type=text] {
|
||||
width: 75%;
|
||||
padding: 12px 20px;
|
||||
margin: 8px 0;
|
||||
box-sizing: border-box;
|
||||
text-align: left;
|
||||
font-size: 14.5pt;
|
||||
}
|
||||
background-color: #333; /* Dark background */
|
||||
color: #fff; /* Text color */
|
||||
border: 1px solid #555; /* Border color */
|
||||
}
|
||||
|
||||
input[type=button], input[type=submit], input[type=reset] {
|
||||
input[type=button], input[type=submit], input[type=reset] {
|
||||
font-family: sans-serif;
|
||||
background-color: #afcdc2;
|
||||
background-color: #555; /* Dark button background */
|
||||
border: none;
|
||||
color: rgb(0, 0, 0);
|
||||
color: #fff; /* Button text color */
|
||||
padding: 16px 32px;
|
||||
text-decoration: none;
|
||||
margin: 4px 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
/* Page content */
|
||||
.definition {
|
||||
.definition {
|
||||
padding: 8px;
|
||||
font-family: sans-serif;
|
||||
font-size: 14.5pt;
|
||||
width: 768px;
|
||||
padding: 1px;
|
||||
}
|
||||
</style>
|
||||
color: #fff; /* Text color */
|
||||
background-color: #222; /* Dark background */
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
<style>
|
||||
/* Dark Theme */
|
||||
|
||||
body {
|
||||
background-color: #222;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Style the header */
|
||||
.responses {
|
||||
font-family: sans-serif;
|
||||
font-size: 14.5pt;
|
||||
width: 768px;
|
||||
padding: 1px;
|
||||
margin-top: 100px;
|
||||
color: #fff; /* Text color */
|
||||
}
|
||||
|
||||
a {
|
||||
color: #007bff; /* Link color */
|
||||
}
|
||||
|
||||
.header {
|
||||
font-family: sans-serif;
|
||||
padding: 10px 16px;
|
||||
background: #333; /* Dark background */
|
||||
color: #fff; /* Text color */
|
||||
position: fixed;
|
||||
top: 5px;
|
||||
width: 768px;
|
||||
}
|
||||
|
||||
input[type=text] {
|
||||
width: 75%;
|
||||
padding: 12px 20px;
|
||||
margin: 8px 0;
|
||||
box-sizing: border-box;
|
||||
text-align: left;
|
||||
font-size: 14.5pt;
|
||||
background-color: #333; /* Dark background */
|
||||
color: #fff; /* Text color */
|
||||
border: 1px solid #555; /* Border color */
|
||||
}
|
||||
|
||||
input[type=button], input[type=submit], input[type=reset] {
|
||||
font-family: sans-serif;
|
||||
background-color: #555; /* Dark button background */
|
||||
border: none;
|
||||
color: #fff; /* Button text color */
|
||||
padding: 16px 32px;
|
||||
text-decoration: none;
|
||||
margin: 4px 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.definition {
|
||||
padding: 8px;
|
||||
font-family: sans-serif;
|
||||
font-size: 14.5pt;
|
||||
width: 768px;
|
||||
padding: 1px;
|
||||
color: #fff; /* Text color */
|
||||
background-color: #222; /* Dark background */
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,55 @@
|
||||
<style>
|
||||
/* Style the header */
|
||||
|
||||
.responses{
|
||||
font-family: sans-serif;
|
||||
font-size: 14.5pt;
|
||||
width: 768px;
|
||||
padding: 1px;
|
||||
margin-top: 100px;
|
||||
}
|
||||
a {
|
||||
color: #547720
|
||||
}
|
||||
|
||||
|
||||
|
||||
.header {
|
||||
font-family: sans-serif;
|
||||
padding: 10px 16px;
|
||||
background: #dbd5d5;
|
||||
color: #1a1919;
|
||||
position: fixed;
|
||||
top: 5px;
|
||||
width: 768px;
|
||||
}
|
||||
|
||||
input[type=text] {
|
||||
width: 75%;
|
||||
padding: 12px 20px;
|
||||
margin: 8px 0;
|
||||
box-sizing: border-box;
|
||||
text-align: left;
|
||||
font-size: 14.5pt;
|
||||
}
|
||||
|
||||
input[type=button], input[type=submit], input[type=reset] {
|
||||
font-family: sans-serif;
|
||||
background-color: #afcdc2;
|
||||
border: none;
|
||||
color: rgb(0, 0, 0);
|
||||
padding: 16px 32px;
|
||||
text-decoration: none;
|
||||
margin: 4px 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Page content */
|
||||
.definition {
|
||||
padding: 8px;
|
||||
font-family: sans-serif;
|
||||
font-size: 14.5pt;
|
||||
width: 768px;
|
||||
padding: 1px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user