Merge branch 'main' of gitea.internetapi.cn:iod/page-assist

This commit is contained in:
zhaoweijie 2025-08-25 19:40:20 +08:00
commit c937694d8b
5 changed files with 42 additions and 41 deletions

View File

@ -48,6 +48,7 @@ export class IodDb {
return defaultIodConnectionConfig return defaultIodConnectionConfig
} }
IodDb.iodConnectionConfig = JSON.parse(val) IodDb.iodConnectionConfig = JSON.parse(val)
return IodDb.iodConnectionConfig
} catch (error) { } catch (error) {
console.warn('Failed to parse IOD connection config, using default:', error) console.warn('Failed to parse IOD connection config, using default:', error)
return defaultIodConnectionConfig return defaultIodConnectionConfig

View File

@ -19,39 +19,6 @@ export const qaPrompt = [
// title: "如何开发一个碳定价预测系统?", // title: "如何开发一个碳定价预测系统?",
// icon: <img src={EyeSvg} alt="Rocket" className="w-10 my-0" />, // icon: <img src={EyeSvg} alt="Rocket" className="w-10 my-0" />,
// }, // },
{
title: "新药临床研究如何提升实验安全性?",
icon: (
<Avatar
className="!bg-[#3581e3b3]"
shape="square"
size={40}
icon={<MedicineBottleFillIcon className="w-7" />}
/>
)
},
{
title: "人工智能技术如何加速新药申报和审批?",
icon: (
<Avatar
className="!bg-[#3581e3b3]"
shape="square"
size={40}
icon={<CheckIcon className="w-7" />}
/>
)
},
{
title: "如何研制与利妥昔单抗相似的新药?",
icon: (
<Avatar
className="!bg-[#3581e3b3]"
shape="square"
size={40}
icon={<NewBottleIcon className="w-7" />}
/>
)
},
{ {
title: "如何解决固态电池的成本和寿命难题?", title: "如何解决固态电池的成本和寿命难题?",
icon: ( icon: (
@ -84,6 +51,39 @@ export const qaPrompt = [
icon={<Ship1Icon className="w-7" />} icon={<Ship1Icon className="w-7" />}
/> />
) )
},
{
title: "新药临床研究如何提升实验安全性?",
icon: (
<Avatar
className="!bg-[#3581e3b3]"
shape="square"
size={40}
icon={<MedicineBottleFillIcon className="w-7" />}
/>
)
},
{
title: "人工智能技术如何加速新药申报和审批?",
icon: (
<Avatar
className="!bg-[#3581e3b3]"
shape="square"
size={40}
icon={<CheckIcon className="w-7" />}
/>
)
},
{
title: "如何研制与利妥昔单抗相似的新药?",
icon: (
<Avatar
className="!bg-[#3581e3b3]"
shape="square"
size={40}
icon={<NewBottleIcon className="w-7" />}
/>
)
} }
].map((item, index) => ({ ].map((item, index) => ({
...item, ...item,

View File

@ -21,9 +21,7 @@ const DEFAULT_RAG_QUESTION_PROMPT =
const DEFAUTL_RAG_SYSTEM_PROMPT = `You are a helpful AI assistant. Use the following pieces of context to answer the question at the end. If you don't know the answer, just say you don't know. DO NOT try to make up an answer. If the question is not related to the context, politely respond that you are tuned to only answer questions that are related to the context. {context} Question: {question} Helpful answer:` const DEFAUTL_RAG_SYSTEM_PROMPT = `You are a helpful AI assistant. Use the following pieces of context to answer the question at the end. If you don't know the answer, just say you don't know. DO NOT try to make up an answer. If the question is not related to the context, politely respond that you are tuned to only answer questions that are related to the context. {context} Question: {question} Helpful answer:`
const DEFAULT_WEBSEARCH_PROMPT = `你是一个中文AI助手当前日期和时间是 {current_date_time}。根据用户的问题,请筛选出<数联网搜索结果>中的相关信息,并结合<iod-search-results>中的数据、场景(项目)、人员团队等类型的相关信息, const DEFAULT_WEBSEARCH_PROMPT = `你是一个中文AI助手当前日期和时间是 {current_date_time}。在<数联网搜索结果> 中提供了来自数联网Internet of Data)的搜索结果。
<数联网搜索结果>
<数联网搜索结果> Internet of Data)
\`<result doId="{doId}" name="{title}" authors="{authors}" dataType="{paper,dataset or algorithm}" year="{year}" url="{url}" id="{id}">{abstract}</result>\` \`<result doId="{doId}" name="{title}" authors="{authors}" dataType="{paper,dataset or algorithm}" year="{year}" url="{url}" id="{id}">{abstract}</result>\`
\`doId\`\`name\` ,如果没有url则空着 : \`doId\`\`name\` ,如果没有url则空着 :
@ -34,8 +32,11 @@ const DEFAULT_WEBSEARCH_PROMPT = `你是一个中文AI助手当前日期和
<数联网搜索结果> <数联网搜索结果>
{iod_search_results} {iod_search_results}
</数联网搜索结果> </数联网搜索结果>
<数联网搜索结果><数联网搜索结果>
4 <数联网搜索结果>
使
4
` `
const DEFAULT_WEBSEARCH_PROMPT2 = `You are an AI assistant specialized in retrieving and analyzing academic papers from Neo4j graph database. const DEFAULT_WEBSEARCH_PROMPT2 = `You are an AI assistant specialized in retrieving and analyzing academic papers from Neo4j graph database.

View File

@ -36,7 +36,7 @@ export const iodConfigLocal = {
doBrowser: "http://127.0.0.1:21030/SCIDE/SCManager" doBrowser: "http://127.0.0.1:21030/SCIDE/SCManager"
} }
function inGrepList(str: string){ function inGrepList(str: string){
return "什么|问题|需要|合适|设计|考虑|合作|精度|传感器|最新|研究|药物|如何|解决|中的|难题|成本|寿命|提升".indexOf( return "什么|问题|需要|合适|设计|考虑|合作|精度|传感器|最新|研究|药物|如何|解决|中的|难题|成本|提升".indexOf(
str str
) != -1 ) != -1
} }

View File

@ -1,4 +1,5 @@
import { defineConfig } from "wxt" import { defineConfig } from "wxt"
import { defineRunnerConfig } from "wxt"
import react from "@vitejs/plugin-react" import react from "@vitejs/plugin-react"
import topLevelAwait from "vite-plugin-top-level-await" import topLevelAwait from "vite-plugin-top-level-await"
@ -8,7 +9,6 @@ const chromeMV3Permissions = [
"activeTab", "activeTab",
"scripting", "scripting",
"declarativeNetRequest", "declarativeNetRequest",
"action",
"unlimitedStorage", "unlimitedStorage",
"contextMenus", "contextMenus",
"tts", "tts",
@ -49,7 +49,6 @@ export default defineConfig({
process.env.TARGET === "firefox" ? "entries-firefox" : "entries", process.env.TARGET === "firefox" ? "entries-firefox" : "entries",
srcDir: "src", srcDir: "src",
outDir: "build", outDir: "build",
manifest: { manifest: {
version: "1.5.0", version: "1.5.0",
name: name: