diff --git a/README.md b/README.md index b44b611..bf59997 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,10 @@ No, the extension does not collect any user data or analytics.
+## Disclaimer + +This extension does not provide financial, medical, or social advice. This information, including but not limited to, text, graphics, images and other material found through this extension are for informational purposes only. No material found through this extension is intended to be a substitute for professional financial, medical, or social advice, strategies, diagnosis, treatment, or feedback. You agree, acknowledge, and alone assume the sole responsibility of evaluating the merits and risks associated with the use of any information or other content found through this extension before making any decisions based on such information. Always seek the advice of trained financial advisors, physicians, healthcare providers, or representatives with any questions you may have regarding financial, medical, and social conditions. Never disregard professional advice or delay in seeking it because of something you have read through this extension. + ## Contributing Contributions are welcome! Please submit pull requests to the `dev` branch. diff --git a/build/webchatgpt-3.1.6-chrome.zip b/build/webchatgpt-3.1.6-chrome.zip index c63cd40..cfb90c7 100644 Binary files a/build/webchatgpt-3.1.6-chrome.zip and b/build/webchatgpt-3.1.6-chrome.zip differ diff --git a/build/webchatgpt-3.1.6-firefox.zip b/build/webchatgpt-3.1.6-firefox.zip index b27c49d..232fefc 100644 Binary files a/build/webchatgpt-3.1.6-firefox.zip and b/build/webchatgpt-3.1.6-firefox.zip differ diff --git a/src/components/toolbar.tsx b/src/components/toolbar.tsx index 73e8733..8c973ab 100644 --- a/src/components/toolbar.tsx +++ b/src/components/toolbar.tsx @@ -4,6 +4,7 @@ import { icons } from 'src/util/icons' import { getSavedPrompts, Prompt } from 'src/util/promptManager' import { getUserConfig, updateUserConfig } from 'src/util/userConfig' import timePeriodOptions from 'src/util/timePeriodOptions.json' +import filterTypeOptions from 'src/util/filterTypeOptions.json' import regionOptions from 'src/util/regionOptions.json' import Browser from 'webextension-polyfill' import Dropdown from './dropdown' @@ -25,6 +26,7 @@ function Toolbar( const [numResults, setNumResults] = useState(3) const [timePeriod, setTimePeriod] = useState('') const [region, setRegion] = useState('wt-wt') + const [filterType, setFilterType] = useState('All') const [promptUUID, setPromptUUID] = useState('') const [prompts, setPrompts] = useState([]) @@ -34,6 +36,7 @@ function Toolbar( setNumResults(userConfig.numWebResults) setTimePeriod(userConfig.timePeriod) setRegion(userConfig.region) + setFilterType(userConfig.filterType) setPromptUUID(userConfig.promptUUID) setLocaleLanguage(userConfig.language) @@ -110,6 +113,11 @@ function Toolbar( updateUserConfig({ promptUUID: uuid }) } + const handleFilterTypeChange = (e: { target: { value: string } }) => { + setFilterType(e.target.value) + updateUserConfig({ filterType: e.target.value }) + } + const removeFocusFromCurrentElement = () => (document.activeElement as HTMLElement)?.blur() @@ -148,6 +156,10 @@ function Toolbar( value={region} onChange={handleRegionChange} options={regionOptions} /> + query.replace(/\/page:(\S+)\s+/g, '').replace(/\/site:(\S+)\s+/g, '') -export const compilePrompt = async (results: SearchResult[], query: string) => { +export const compilePrompt = async (results: SearchResult[], query: string, filterType: string) => { const currentPrompt = await getCurrentPrompt() - const formattedResults = formatWebResults(results) + const formattedResults = formatWebResults(results, filterType) const currentDate = new Date().toLocaleDateString() const prompt = replaceVariables(currentPrompt.text, { '{web_results}': formattedResults, @@ -26,11 +26,17 @@ export const compilePrompt = async (results: SearchResult[], query: string) => { return prompt } -const formatWebResults = (results: SearchResult[]) => { +const formatWebResults = (results: SearchResult[], filterType: string) => { if (results.length === 0) { return "No results found.\n" } - + if (filterType === "Med") { + results = results.filter(result => (result.url.includes("mayoclinic.org") || result.url.includes("medlineplus.gov") || result.url.includes("merckmanuals.com") || result.url.includes("pubmed.ncbi.nlm.nih.gov") || result.url.includes("webmd.com") || result.url.includes("nih.gov") || result.url.includes("womenshealth.gov") || result.url.includes("healthline.com") || result.url.includes("uptodate.com") || result.url.includes("diabetes.org") || result.url.includes("familydoctor.org") || result.url.includes("heart.org") || result.url.includes("fda.gov") || result.url.includes("medscape.com") || result.url.includes("cdc.gov") || result.url.includes("examine.com") || result.url.includes("nhs.uk") || result.url.includes("thefreedictionary.com") || result.url.includes("bestpractice.bmj.com") || result.url.includes("nejm.org") || result.url.includes("samhsa.gov") || result.url.includes("cancer.gov") || result.url.includes("nice.org.uk") || result.url.includes("journals.plos.org") || result.url.includes("apa.org") || result.url.includes("cochranelibrary.com"))); // New code to check for credibility + } else if (filterType === "Gov") { + results = results.filter(result => (result.url.includes(".gov"))); // New code to check for credibility + } else if (filterType === "Res") { + results = results.filter(result => (result.url.includes("doi") || result.url.includes("sciencedirect.com") || result.url.includes("academic.oup.com") || result.url.includes("journal") || result.url.includes("article") || result.url.includes("abstract") || result.url.includes("publication") || result.url.includes("mdpi.com"))); // New code to check for credibility + } let counter = 1 return results.reduce((acc, result): string => acc += `[${counter++}] "${result.body}"\nURL: ${result.url}\n\n`, "") } diff --git a/src/util/userConfig.ts b/src/util/userConfig.ts index d7ef6eb..e81ee8d 100644 --- a/src/util/userConfig.ts +++ b/src/util/userConfig.ts @@ -8,6 +8,7 @@ const defaultConfig = { webAccess: true, region: 'wt-wt', timePeriod: '', + filterType: 'All', language: getSystemLanguage(), promptUUID: 'default', }