PageSourceSearch

https://www.22.cn/content/js/ai.js

js 22.cn collected 2026-10-03 22:40:28 UTC 3,044 bytes, 60 lines download raw bytes

1const uiCss = document.createElement('link');
2uiCss.setAttribute('rel', 'stylesheet');
3uiCss.setAttribute('href', 'https://uploadfile.ltdcdn.com/css/chat_index.css');
4uiCss.setAttribute('crossorigin', true);
5document.head.appendChild(uiCss);
6
7const uiScript = document.createElement('script');
8uiScript.setAttribute('src', 'https://g.alicdn.com/aliyun-documentation/web-chatbot-ui/0.0.24/index.js');
9uiScript.setAttribute('crossorigin', true);
10uiScript.setAttribute('type', "module");
11document.head.appendChild(uiScript);
12
13
14const uiStyle = document.createElement('style');
15uiStyle.innerHTML = `:root{--webchat-toolbar-background-color:#1464E4;--webchat-toolbar-text-color:#FFF;}.webchat-container{z-index:99999999999;bottom:10px;right:10px;}.webchat-bubble-tip{z-index:99999999999;bottom:70px;right:20px;}.webchat-container,#webChat-dialog{z-index:99999999999;}`;
16document.head.appendChild(uiStyle);
17
18
19window.CHATBOT_CONFIG = {
20    endpoint: "https://ai.saaas.com/chat", // 可以替换为 https://{your-fc-http-trigger-domain}/chat
21    displayByDefault: false, // 默认不显示 AI 助手对话框
22    title: '爱名网AI智能体', // 自定义 AI 助手标题
23    draggable: true, // 是否开启拖拽
24    aiChatOptions: { // 自定义取值参考:https://docs.nlkit.com/nlux/reference/ui/ai-chat#conversation-options
25        conversationOptions: { // 自定义取值参考:https://docs.nlkit.com/nlux/reference/ui/ai-chat#conversation-options
26            conversationStarters: [
27                { prompt: '如何注册域名' },
28                { prompt: '推荐几个域名' },
29                { prompt: '爱名网介绍' },
30            ]
31        },
32        displayOptions: { // 自定义取值参考:https://docs.nlkit.com/nlux/reference/ui/ai-chat#display-options
33            height: 600,
34            // width: 400,
35        },
36        personaOptions: { // 自定义取值参考:https://docs.nlkit.com/nlux/reference/ui/ai-chat#chat-personas
37            assistant: {
38                name: '你好,我是 爱名网AI 助手',
39                // AI 助手的图标
40                avatar: 'https://img.alicdn.com/imgextra/i2/O1CN01Pda9nq1YDV0mnZ31H_!!6000000003025-54-tps-120-120.apng',
41                tagline: '您可以尝试点击下方的快捷入口开启体验!',
42            }
43        },
44        messageOptions: { // 自定义取值参考:https://docs.nlkit.com/nlux/reference/ui/ai-chat#message-options
45            waitTimeBeforeStreamCompletion: 'never'
46        }
47    },
48    dataProcessor: {
49        /**
50        * 在向后端大模型应用发起请求前改写 Prompt。
51        * 比如可以用于总结网页场景,在发送前将网页内容包含在内,同时避免在前端显示这些内容。
52        * @param {string} prompt - 用户输入的 Prompt
53        * @param {string}  - 改写后的 Prompt
54        */
55        rewritePrompt(prompt) {
56            prompt = "website_id:4598 " + prompt;
57            return prompt;
58        }
59    }
60};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.