mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-13 23:16:47 +00:00
TianliGPT
This commit is contained in:
@@ -185,6 +185,11 @@ const BLOG = {
|
||||
STARRY_SKY: process.env.NEXT_PUBLIC_STARRY_SKY || false, // 开关
|
||||
|
||||
// ********挂件组件相关********
|
||||
// AI 文章摘要生成 @see https://docs_s.tianli0.top/
|
||||
TianliGPT_CSS: process.env.NEXT_PUBLIC_TIANLI_GPT_CSS || 'https://cdn1.tianli0.top/gh/zhheo/Post-Abstract-AI@0.15.2/tianli_gpt.css',
|
||||
TianliGPT_JS: process.env.NEXT_PUBLIC_TIANLI_GPT_JS || 'https://cdn1.tianli0.top/gh/zhheo/Post-Abstract-AI@0.15.2/tianli_gpt.js',
|
||||
TianliGPT_KEY: process.env.NEXT_PUBLIC_TIANLI_GPT_KEY || '',
|
||||
|
||||
// Chatbase 是否显示chatbase机器人 https://www.chatbase.co/
|
||||
CHATBASE_ID: process.env.NEXT_PUBLIC_CHATBASE_ID || null,
|
||||
// WebwhizAI 机器人 @see https://github.com/webwhiz-ai/webwhiz
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import { loadExternalResource } from '@/lib/utils'
|
||||
// import { loadExternalResource } from '@/lib/utils'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
/**
|
||||
* Giscus评论 @see https://giscus.app/zh-CN
|
||||
* Contribute by @txs https://github.com/txs/NotionNext/commit/1bf7179d0af21fb433e4c7773504f244998678cb
|
||||
* Artalk 自托管评论系统 @see https://artalk.js.org/
|
||||
* @returns {JSX.Element}
|
||||
* @constructor
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,7 @@ import { siteConfig } from '@/lib/config'
|
||||
import dynamic from 'next/dynamic'
|
||||
import LA51 from './LA51'
|
||||
import WebWhiz from './Webwhiz'
|
||||
import TianLiGPT from './TianliGPT'
|
||||
|
||||
const TwikooCommentCounter = dynamic(() => import('@/components/TwikooCommentCounter'), { ssr: false })
|
||||
const DebugPanel = dynamic(() => import('@/components/DebugPanel'), { ssr: false })
|
||||
@@ -71,6 +72,7 @@ const ExternalPlugin = (props) => {
|
||||
const ANALYTICS_51LA_ID = siteConfig('ANALYTICS_51LA_ID')
|
||||
const ANALYTICS_51LA_CK = siteConfig('ANALYTICS_51LA_CK')
|
||||
const DIFY_CHATBOT_ENABLED = siteConfig('DIFY_CHATBOT_ENABLED')
|
||||
const TIANLI_KEY = siteConfig('TianliGPT_KEY')
|
||||
|
||||
if (DISABLE_PLUGIN) {
|
||||
return null
|
||||
@@ -98,6 +100,7 @@ const ExternalPlugin = (props) => {
|
||||
{!CAN_COPY && <DisableCopy />}
|
||||
{WEB_WHIZ_ENABLED && <WebWhiz />}
|
||||
{AD_WWADS_BLOCK_DETECT && <AdBlockDetect />}
|
||||
{TIANLI_KEY && <TianLiGPT/>}
|
||||
<VConsole />
|
||||
<LoadingProgress />
|
||||
<AosAnimation />
|
||||
|
||||
41
components/TianliGPT.js
Normal file
41
components/TianliGPT.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
/* eslint-disable camelcase */
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import { loadExternalResource } from '@/lib/utils'
|
||||
import { useEffect } from 'react'
|
||||
/**
|
||||
* TianliGpt AI文章摘要生成工具 @see https://docs_s.tianli0.top/
|
||||
* @returns {JSX.Element}
|
||||
* @constructor
|
||||
*/
|
||||
|
||||
const TianLiGPT = () => {
|
||||
const tianliKey = siteConfig('TianliGPT_KEY')
|
||||
const tianliCss = siteConfig('TianliGPT_CSS')
|
||||
const tianliJs = siteConfig('TianliGPT_JS')
|
||||
|
||||
useEffect(() => {
|
||||
initArtalk()
|
||||
}, [])
|
||||
|
||||
if (!tianliKey) {
|
||||
return null
|
||||
}
|
||||
|
||||
const initArtalk = async () => {
|
||||
console.log('loading tianliGPT', tianliKey, tianliCss, tianliJs)
|
||||
|
||||
if (!tianliKey) {
|
||||
return
|
||||
}
|
||||
await loadExternalResource(tianliCss, 'css')
|
||||
|
||||
window.tianliGPT_postSelector = '#notion-article';
|
||||
window.tianliGPT_key = 'f50e6b018a094fbb0d7c';
|
||||
|
||||
await loadExternalResource(tianliJs, 'js')
|
||||
}
|
||||
return <></>
|
||||
}
|
||||
|
||||
export default TianLiGPT
|
||||
Reference in New Issue
Block a user