forked from tangly1024/NotionNext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TianliGPT.js
41 lines (33 loc) · 959 Bytes
/
TianliGPT.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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 = tianliKey;
await loadExternalResource(tianliJs, 'js')
}
return <></>
}
export default TianLiGPT