Update src/api/agent.py
Browse files- src/api/agent.py +67 -74
src/api/agent.py
CHANGED
|
@@ -1847,40 +1847,38 @@ def _ai_tools_footer(context):
|
|
| 1847 |
KU = "https://khalifa.idm.oclc.org/login?url="
|
| 1848 |
|
| 1849 |
platforms = [
|
| 1850 |
-
("PRIMO Library Discovery", primo_url,
|
| 1851 |
-
|
| 1852 |
-
("
|
| 1853 |
-
|
| 1854 |
-
("LeapSpace",
|
| 1855 |
-
"https://www.sciencedirect.com/leapspace?query=" + ai_q,
|
| 1856 |
-
"https://www.sciencedirect.com/favicon.ico"),
|
| 1857 |
-
("Scopus AI",
|
| 1858 |
-
"https://www-scopus-com.khalifa.idm.oclc.org/pages/ai?query=" + ai_q,
|
| 1859 |
-
"https://www.scopus.com/favicon.ico"),
|
| 1860 |
("EBSCO Research AI",
|
| 1861 |
"https://research-ebsco-com.khalifa.idm.oclc.org/c/yst6t2/search/results?q=" + ai_q
|
| 1862 |
-
+ "&autocorrect=y&expanders=concept&limiters=None&searchMode=enhanced&searchSegment=all-results",
|
| 1863 |
-
|
| 1864 |
-
("
|
| 1865 |
-
|
| 1866 |
-
"https://consensus.app/favicon.ico"),
|
| 1867 |
-
("Semantic Scholar",
|
| 1868 |
-
"https://www.semanticscholar.org/search?q=" + ai_q + "&sort=relevance",
|
| 1869 |
-
"https://www.semanticscholar.org/favicon.ico"),
|
| 1870 |
-
("Perplexity",
|
| 1871 |
-
"https://www.perplexity.ai/search?q=" + ai_q,
|
| 1872 |
-
"https://www.perplexity.ai/favicon.ico"),
|
| 1873 |
]
|
| 1874 |
if is_med and pubmed_url:
|
| 1875 |
-
platforms.append(("PubMed", pubmed_url
|
| 1876 |
-
|
| 1877 |
-
|
| 1878 |
-
|
| 1879 |
-
|
| 1880 |
-
|
| 1881 |
-
|
| 1882 |
-
|
| 1883 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1884 |
style = (
|
| 1885 |
'display:inline-flex;align-items:center;gap:7px;'
|
| 1886 |
'padding:8px 14px;border-radius:10px;text-decoration:none;'
|
|
@@ -1888,7 +1886,7 @@ def _ai_tools_footer(context):
|
|
| 1888 |
'background:#fff;border:1.5px solid #d1d5db;'
|
| 1889 |
'transition:box-shadow .2s;width:100%;box-sizing:border-box'
|
| 1890 |
)
|
| 1891 |
-
return '<a href="' + url + '" target="_blank" style="' + style + '">' +
|
| 1892 |
|
| 1893 |
btn_rows = ""
|
| 1894 |
for k in range(0, len(platforms), 2):
|
|
@@ -1936,85 +1934,80 @@ def _ai_tools_footer(context):
|
|
| 1936 |
|
| 1937 |
all_lower = ((context.ai_tool_query or "") + " " + (context.topic or "")).lower()
|
| 1938 |
|
| 1939 |
-
def _db_row(name, url, desc, favicon):
|
| 1940 |
-
img = (
|
| 1941 |
-
'<img src="' + favicon + '" width="16" height="16" '
|
| 1942 |
-
'style="border-radius:3px;flex-shrink:0" '
|
| 1943 |
-
'onerror="this.style.display=\'none\'" />'
|
| 1944 |
-
)
|
| 1945 |
return (
|
| 1946 |
'<div style="display:flex;align-items:center;gap:8px;'
|
| 1947 |
'padding:7px 0;border-bottom:1px solid #f3f4f6">'
|
| 1948 |
-
+
|
| 1949 |
'<div><a href="' + url + '" target="_blank" '
|
| 1950 |
'style="font-size:.8rem;font-weight:700;color:#003366;text-decoration:none">'
|
| 1951 |
+ name + '</a>'
|
| 1952 |
-
'<span style="font-size:.73rem;color:#6b7280">
|
| 1953 |
'</div>'
|
| 1954 |
)
|
| 1955 |
|
| 1956 |
if any(k in all_lower for k in ["medicine","medical","clinical","nursing","pharmacy","health","pubmed","embase","cinahl","cochrane","uptodate"]):
|
| 1957 |
db_subject = "Medicine & Health Sciences"
|
| 1958 |
dbs = [
|
| 1959 |
-
("PubMed@KU","http://www.ncbi.nlm.nih.gov/pubmed/?otool=iaekustlib","Core biomedical literature"
|
| 1960 |
-
("Embase",KU+"https://www.embase.com","Biomedical, drugs, devices, clinical medicine"
|
| 1961 |
-
("CINAHL Ultimate",KU+"https://search.ebscohost.com/login.aspx?authtype=ip,uid&profile=ehost&defaultdb=cul","Nursing and allied health"
|
| 1962 |
-
("Cochrane Library",KU+"https://www.cochranelibrary.com","Systematic reviews and evidence-based medicine"
|
| 1963 |
-
("UpToDate",KU+"https://www.uptodate.com","Point-of-care clinical decision support"
|
| 1964 |
]
|
| 1965 |
elif any(k in all_lower for k in ["machine learning","deep learning","artificial intelligence","neural network","computer science","software","algorithm","cybersecurity","robotics","nlp"]):
|
| 1966 |
db_subject = "Computer Science & AI"
|
| 1967 |
dbs = [
|
| 1968 |
-
("IEEE Xplore",KU+"https://ieeexplore.ieee.org","Core CS, AI, electronics and systems"
|
| 1969 |
-
("ACM Digital Library",KU+"https://dl.acm.org","Computer science journals, proceedings and books"
|
| 1970 |
-
("ScienceDirect",KU+"https://www.sciencedirect.com","Full text across CS and applied computing"
|
| 1971 |
-
("Scopus",KU+"https://www.scopus.com","Discovery and citation tracking"
|
| 1972 |
-
("Web of Science",KU+"https://www.webofscience.com","Citation index"
|
| 1973 |
]
|
| 1974 |
elif any(k in all_lower for k in ["climate","global warming","environment","sustainability","ecology","carbon","emission","renewable","sea level","maldives","island"]):
|
| 1975 |
db_subject = "Environment & Climate"
|
| 1976 |
dbs = [
|
| 1977 |
-
("ScienceDirect",KU+"https://www.sciencedirect.com","Full text across science, environment and engineering"
|
| 1978 |
-
("Scopus",KU+"https://www.scopus.com","Broad discovery and citation tracking"
|
| 1979 |
-
("Web of Science",KU+"https://www.webofscience.com","High-impact journal coverage and citation index"
|
| 1980 |
-
("SpringerLink",KU+"https://link.springer.com","Springer journals and books"
|
| 1981 |
]
|
| 1982 |
elif any(k in all_lower for k in ["engineering","mechanical","civil","electrical","aerospace","structural","petroleum","chemical","materials"]):
|
| 1983 |
db_subject = "Engineering"
|
| 1984 |
dbs = [
|
| 1985 |
-
("IEEE Xplore",KU+"https://ieeexplore.ieee.org","Electrical, electronics and systems engineering"
|
| 1986 |
-
("ScienceDirect",KU+"https://www.sciencedirect.com","Full text across engineering disciplines"
|
| 1987 |
-
("Knovel",KU+"https://app.knovel.com","Engineering handbooks and reference data"
|
| 1988 |
-
("Scopus",KU+"https://www.scopus.com","Discovery and citation tracking"
|
| 1989 |
-
("Web of Science",KU+"https://www.webofscience.com","Citation index"
|
| 1990 |
]
|
| 1991 |
elif any(k in all_lower for k in ["business","management","finance","economics","leadership","marketing","strategy","entrepreneurship"]):
|
| 1992 |
db_subject = "Business & Management"
|
| 1993 |
dbs = [
|
| 1994 |
-
("Business Source Complete",KU+"https://search.ebscohost.com","Core business and management literature"
|
| 1995 |
-
("Emerald Insight",KU+"https://www.emerald.com/insight","Management, strategy and leadership"
|
| 1996 |
-
("Scopus",KU+"https://www.scopus.com","Broad discovery and citation tracking"
|
| 1997 |
-
("ScienceDirect",KU+"https://www.sciencedirect.com","Business and social sciences full text"
|
| 1998 |
]
|
| 1999 |
elif any(k in all_lower for k in ["physics","chemistry","quantum","nuclear","materials science","nanotechnology","optics"]):
|
| 2000 |
db_subject = "Physics, Chemistry & Materials"
|
| 2001 |
dbs = [
|
| 2002 |
-
("ScienceDirect",KU+"https://www.sciencedirect.com","Full text across physical sciences"
|
| 2003 |
-
("ACS Publications",KU+"https://pubs.acs.org","Core chemistry and chemical engineering"
|
| 2004 |
-
("APS Journals",KU+"https://journals.aps.org","American Physical Society core physics journals"
|
| 2005 |
-
("Scopus",KU+"https://www.scopus.com","Discovery and citation tracking"
|
| 2006 |
-
("Web of Science",KU+"https://www.webofscience.com","Citation index"
|
| 2007 |
]
|
| 2008 |
else:
|
| 2009 |
db_subject = "General"
|
| 2010 |
dbs = [
|
| 2011 |
-
("EBSCO",KU+"https://search.ebscohost.com","Multidisciplinary full text"
|
| 2012 |
-
("ScienceDirect",KU+"https://www.sciencedirect.com","Science, engineering and medicine"
|
| 2013 |
-
("SpringerLink",KU+"https://link.springer.com","Journals and books across all disciplines"
|
| 2014 |
-
("Taylor & Francis",KU+"https://www.tandfonline.com","Humanities, social sciences and STEM"
|
| 2015 |
-
("Emerald Insight",KU+"https://www.emerald.com/insight","Management and social sciences"
|
| 2016 |
-
("Scopus",KU+"https://www.scopus.com","Citation discovery, all disciplines"
|
| 2017 |
-
("Web of Science",KU+"https://www.webofscience.com","Citation index, all disciplines"
|
| 2018 |
]
|
| 2019 |
|
| 2020 |
dbs_html_rows = ""
|
|
|
|
| 1847 |
KU = "https://khalifa.idm.oclc.org/login?url="
|
| 1848 |
|
| 1849 |
platforms = [
|
| 1850 |
+
("PRIMO Library Discovery", primo_url),
|
| 1851 |
+
("PRIMO AI Assistant", primo_ai),
|
| 1852 |
+
("LeapSpace", "https://www.sciencedirect.com/leapspace?query=" + ai_q),
|
| 1853 |
+
("Scopus AI", "https://www-scopus-com.khalifa.idm.oclc.org/pages/ai?query=" + ai_q),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1854 |
("EBSCO Research AI",
|
| 1855 |
"https://research-ebsco-com.khalifa.idm.oclc.org/c/yst6t2/search/results?q=" + ai_q
|
| 1856 |
+
+ "&autocorrect=y&expanders=concept&limiters=None&searchMode=enhanced&searchSegment=all-results"),
|
| 1857 |
+
("Consensus", "https://consensus.app/results/?q=" + ai_q),
|
| 1858 |
+
("Semantic Scholar", "https://www.semanticscholar.org/search?q=" + ai_q + "&sort=relevance"),
|
| 1859 |
+
("Perplexity", "https://www.perplexity.ai/search?q=" + ai_q),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1860 |
]
|
| 1861 |
if is_med and pubmed_url:
|
| 1862 |
+
platforms.append(("PubMed", pubmed_url))
|
| 1863 |
+
|
| 1864 |
+
_BEE = (
|
| 1865 |
+
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" style="flex-shrink:0">'
|
| 1866 |
+
'<ellipse cx="4.5" cy="6" rx="3.5" ry="2" fill="#c7d9f0" opacity=".9"/>'
|
| 1867 |
+
'<ellipse cx="11.5" cy="6" rx="3.5" ry="2" fill="#c7d9f0" opacity=".9"/>'
|
| 1868 |
+
'<ellipse cx="8" cy="9.5" rx="4" ry="5" fill="#F5A623"/>'
|
| 1869 |
+
'<rect x="4.2" y="8" width="7.6" height="1.5" rx=".5" fill="#3d2000" opacity=".7"/>'
|
| 1870 |
+
'<rect x="4.2" y="10.5" width="7.6" height="1.5" rx=".5" fill="#3d2000" opacity=".7"/>'
|
| 1871 |
+
'<circle cx="8" cy="4.5" r="2.5" fill="#F5A623"/>'
|
| 1872 |
+
'<circle cx="7" cy="4.2" r=".5" fill="#1a1a2e"/>'
|
| 1873 |
+
'<circle cx="9" cy="4.2" r=".5" fill="#1a1a2e"/>'
|
| 1874 |
+
'<line x1="7" y1="2.2" x2="5.5" y2="1" stroke="#3d2000" stroke-width=".8" stroke-linecap="round"/>'
|
| 1875 |
+
'<line x1="9" y1="2.2" x2="10.5" y2="1" stroke="#3d2000" stroke-width=".8" stroke-linecap="round"/>'
|
| 1876 |
+
'<circle cx="5.5" cy="1" r=".6" fill="#3d2000"/>'
|
| 1877 |
+
'<circle cx="10.5" cy="1" r=".6" fill="#3d2000"/>'
|
| 1878 |
+
'</svg>'
|
| 1879 |
+
)
|
| 1880 |
+
|
| 1881 |
+
def _btn(label, url, favicon=None):
|
| 1882 |
style = (
|
| 1883 |
'display:inline-flex;align-items:center;gap:7px;'
|
| 1884 |
'padding:8px 14px;border-radius:10px;text-decoration:none;'
|
|
|
|
| 1886 |
'background:#fff;border:1.5px solid #d1d5db;'
|
| 1887 |
'transition:box-shadow .2s;width:100%;box-sizing:border-box'
|
| 1888 |
)
|
| 1889 |
+
return '<a href="' + url + '" target="_blank" style="' + style + '">' + _BEE + label + '</a>'
|
| 1890 |
|
| 1891 |
btn_rows = ""
|
| 1892 |
for k in range(0, len(platforms), 2):
|
|
|
|
| 1934 |
|
| 1935 |
all_lower = ((context.ai_tool_query or "") + " " + (context.topic or "")).lower()
|
| 1936 |
|
| 1937 |
+
def _db_row(name, url, desc, favicon=None):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1938 |
return (
|
| 1939 |
'<div style="display:flex;align-items:center;gap:8px;'
|
| 1940 |
'padding:7px 0;border-bottom:1px solid #f3f4f6">'
|
| 1941 |
+
+ _BEE +
|
| 1942 |
'<div><a href="' + url + '" target="_blank" '
|
| 1943 |
'style="font-size:.8rem;font-weight:700;color:#003366;text-decoration:none">'
|
| 1944 |
+ name + '</a>'
|
| 1945 |
+
'<span style="font-size:.73rem;color:#6b7280"> — ' + desc + '</span></div>'
|
| 1946 |
'</div>'
|
| 1947 |
)
|
| 1948 |
|
| 1949 |
if any(k in all_lower for k in ["medicine","medical","clinical","nursing","pharmacy","health","pubmed","embase","cinahl","cochrane","uptodate"]):
|
| 1950 |
db_subject = "Medicine & Health Sciences"
|
| 1951 |
dbs = [
|
| 1952 |
+
("PubMed@KU","http://www.ncbi.nlm.nih.gov/pubmed/?otool=iaekustlib","Core biomedical literature"),
|
| 1953 |
+
("Embase",KU+"https://www.embase.com","Biomedical, drugs, devices, clinical medicine"),
|
| 1954 |
+
("CINAHL Ultimate",KU+"https://search.ebscohost.com/login.aspx?authtype=ip,uid&profile=ehost&defaultdb=cul","Nursing and allied health"),
|
| 1955 |
+
("Cochrane Library",KU+"https://www.cochranelibrary.com","Systematic reviews and evidence-based medicine"),
|
| 1956 |
+
("UpToDate",KU+"https://www.uptodate.com","Point-of-care clinical decision support"),
|
| 1957 |
]
|
| 1958 |
elif any(k in all_lower for k in ["machine learning","deep learning","artificial intelligence","neural network","computer science","software","algorithm","cybersecurity","robotics","nlp"]):
|
| 1959 |
db_subject = "Computer Science & AI"
|
| 1960 |
dbs = [
|
| 1961 |
+
("IEEE Xplore",KU+"https://ieeexplore.ieee.org","Core CS, AI, electronics and systems"),
|
| 1962 |
+
("ACM Digital Library",KU+"https://dl.acm.org","Computer science journals, proceedings and books"),
|
| 1963 |
+
("ScienceDirect",KU+"https://www.sciencedirect.com","Full text across CS and applied computing"),
|
| 1964 |
+
("Scopus",KU+"https://www.scopus.com","Discovery and citation tracking"),
|
| 1965 |
+
("Web of Science",KU+"https://www.webofscience.com","Citation index"),
|
| 1966 |
]
|
| 1967 |
elif any(k in all_lower for k in ["climate","global warming","environment","sustainability","ecology","carbon","emission","renewable","sea level","maldives","island"]):
|
| 1968 |
db_subject = "Environment & Climate"
|
| 1969 |
dbs = [
|
| 1970 |
+
("ScienceDirect",KU+"https://www.sciencedirect.com","Full text across science, environment and engineering"),
|
| 1971 |
+
("Scopus",KU+"https://www.scopus.com","Broad discovery and citation tracking"),
|
| 1972 |
+
("Web of Science",KU+"https://www.webofscience.com","High-impact journal coverage and citation index"),
|
| 1973 |
+
("SpringerLink",KU+"https://link.springer.com","Springer journals and books"),
|
| 1974 |
]
|
| 1975 |
elif any(k in all_lower for k in ["engineering","mechanical","civil","electrical","aerospace","structural","petroleum","chemical","materials"]):
|
| 1976 |
db_subject = "Engineering"
|
| 1977 |
dbs = [
|
| 1978 |
+
("IEEE Xplore",KU+"https://ieeexplore.ieee.org","Electrical, electronics and systems engineering"),
|
| 1979 |
+
("ScienceDirect",KU+"https://www.sciencedirect.com","Full text across engineering disciplines"),
|
| 1980 |
+
("Knovel",KU+"https://app.knovel.com","Engineering handbooks and reference data"),
|
| 1981 |
+
("Scopus",KU+"https://www.scopus.com","Discovery and citation tracking"),
|
| 1982 |
+
("Web of Science",KU+"https://www.webofscience.com","Citation index"),
|
| 1983 |
]
|
| 1984 |
elif any(k in all_lower for k in ["business","management","finance","economics","leadership","marketing","strategy","entrepreneurship"]):
|
| 1985 |
db_subject = "Business & Management"
|
| 1986 |
dbs = [
|
| 1987 |
+
("Business Source Complete",KU+"https://search.ebscohost.com","Core business and management literature"),
|
| 1988 |
+
("Emerald Insight",KU+"https://www.emerald.com/insight","Management, strategy and leadership"),
|
| 1989 |
+
("Scopus",KU+"https://www.scopus.com","Broad discovery and citation tracking"),
|
| 1990 |
+
("ScienceDirect",KU+"https://www.sciencedirect.com","Business and social sciences full text"),
|
| 1991 |
]
|
| 1992 |
elif any(k in all_lower for k in ["physics","chemistry","quantum","nuclear","materials science","nanotechnology","optics"]):
|
| 1993 |
db_subject = "Physics, Chemistry & Materials"
|
| 1994 |
dbs = [
|
| 1995 |
+
("ScienceDirect",KU+"https://www.sciencedirect.com","Full text across physical sciences"),
|
| 1996 |
+
("ACS Publications",KU+"https://pubs.acs.org","Core chemistry and chemical engineering"),
|
| 1997 |
+
("APS Journals",KU+"https://journals.aps.org","American Physical Society core physics journals"),
|
| 1998 |
+
("Scopus",KU+"https://www.scopus.com","Discovery and citation tracking"),
|
| 1999 |
+
("Web of Science",KU+"https://www.webofscience.com","Citation index"),
|
| 2000 |
]
|
| 2001 |
else:
|
| 2002 |
db_subject = "General"
|
| 2003 |
dbs = [
|
| 2004 |
+
("EBSCO",KU+"https://search.ebscohost.com","Multidisciplinary full text"),
|
| 2005 |
+
("ScienceDirect",KU+"https://www.sciencedirect.com","Science, engineering and medicine"),
|
| 2006 |
+
("SpringerLink",KU+"https://link.springer.com","Journals and books across all disciplines"),
|
| 2007 |
+
("Taylor & Francis",KU+"https://www.tandfonline.com","Humanities, social sciences and STEM"),
|
| 2008 |
+
("Emerald Insight",KU+"https://www.emerald.com/insight","Management and social sciences"),
|
| 2009 |
+
("Scopus",KU+"https://www.scopus.com","Citation discovery, all disciplines"),
|
| 2010 |
+
("Web of Science",KU+"https://www.webofscience.com","Citation index, all disciplines"),
|
| 2011 |
]
|
| 2012 |
|
| 2013 |
dbs_html_rows = ""
|