This commit is contained in:
Steve Nyemba 2025-03-27 22:51:57 -05:00
parent a0f4727a4a
commit 31071e2cea
3 changed files with 60 additions and 11 deletions

View File

@ -14,8 +14,8 @@
"llm":{
"prompt":{
"temperature":0.4,
"input_variables":["context","question"],
"template":"You ares medix-ai, and AI assistant! You only answer questions related healthcare and kidney transplant. Your answers are provided using simple english so non college educated people can understand. Decline to answer questions that aren't related to the context. Use the following context {context} to give a short answer (markdown format, spacing, line breaks, bullets) the following question: {question}"
"input_variables":["context","question","chat_history"],
"template":"You ares medix-ai, and AI assistant! You only answer questions related healthcare and kidney transplant. Your answers are provided using simple english so non college educated people can understand. Decline to answer questions that aren't related to the context. For healthcare related questions your answer will include a summary and should be JSON formatted. The JSON object should have two attributes answer and summary. Answers not related to healthcare should not be formatted in JSON.\nchat history:\n{chat_history}\n Use the following context: {context} to give a short answer. the following question: {question}"
},
"openai":"/home/steve/git/llm/data/llm-keys/zhijun-args.json"

View File

@ -0,0 +1,49 @@
async function cacheAudio(url) {
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const cache = await caches.open('audio-cache');
await cache.put(url, response.clone()); // Store a clone of the response
console.log(`Audio cached: ${url}`);
} catch (error) {
console.error(`Failed to cache audio: ${error}`);
}
}
async function getAudio(url) {
try {
const cache = await caches.open('audio-cache');
const cachedResponse = await cache.match(url);
if (cachedResponse) {
console.log(`Retrieving audio from cache: ${url}`);
return await cachedResponse.blob(); // Get the cached audio data
}
console.log(`Fetching audio from network: ${url}`);
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const blob = await response.blob();
await cache.put(url, response.clone()); // Update the cache
return blob;
} catch (error) {
console.error(`Failed to get audio: ${error}`);
}
}
// async function playCachedAudio(url) {
// const audioBlob = await getAudio(url);
// const audioUrl = URL.createObjectURL(audioBlob);
// const audio = new Audio(audioUrl);
// audio.onended = () => {
// URL.revokeObjectURL(audioUrl); // Clean up the URL object
// };
// audio.play();
// }

View File

@ -1,13 +1,13 @@
import cms
#
# register this in config.plugins: {"demo":["info"]}
import cms
#
# register this in config.plugins: {"demo":["info"]}
@cms.plugins(mimetype='application/json') :
def info (**_args):
_request= _args['request']
_config = _args['config']
return {"version":_config['system']['version'],'title':_config['layout']['header']['title']}
pass
@cms.plugins(mimetype='application/json') :
def info (**_args):
_request= _args['request']
_config = _args['config']
return {"version":_config['system']['version'],'title':_config['layout']['header']['title']}
pass