Files
server-configs/siyuan/data/storage/petal/sy-f-misc/gpt.context-provider.custom.js
2026-02-13 22:24:27 +08:00

35 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 用户自定义的上下文提供器, 用于提供自定义的上下文内容
*
* @returns {CustomContextProvider} 返回一个符合 CustomContextProvider 接口的对象
*/
const customContextProvider = {
name: "CustomProvider",
displayTitle: "自定义上下文提供器",
description: "用户自定义的上下文提供器",
type: "input-area",
icon: "iconCode",
getContextItems: async (options) => {
// 您可以在这里实现自己的逻辑例如从外部API获取数据处理本地文件等
return [{
name: "自定义上下文",
description: "这是一个自定义的上下文示例",
content: options?.query || "这里是自定义上下文的内容"
}];
}
};
/**
* 加载自定义上下文提供器
* @param {CustomContextProvider[]} providers - 内置的 Context Provider
*/
const loadProviders = (providers) => {
// 请在这里添加你的自定义上下文提供器
// providers.push(customContextProvider); // 添加自定义的 Provider
// providers = providers.filter(p => p.name !== 'TextSearch'); // 去掉不想要的 Provider
return providers;
}
export default loadProviders;