ai-client-kit
Version:
一款 AI 集成套件,适配任意前端框架,兼容多种大模型、聊天面板、Function Calling、Agent、工作流等。
56 lines (55 loc) • 2 kB
TypeScript
/**
* Copyright 2025 Hughe5
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { Message } from '../utils/agent';
interface Elements {
root: ShadowRoot;
userInputContainer: HTMLElement;
userInput: HTMLTextAreaElement;
submitIcon: HTMLButtonElement;
stopIcon: HTMLButtonElement;
messagesContainer: HTMLElement;
createButton: HTMLButtonElement;
}
declare function cacheElements(root: ShadowRoot): Elements;
declare function getElements(): Elements;
declare class MessagesContainerRender {
#private;
createCopyButton(message: Message): Element | null;
createMessage(message: Message): HTMLDivElement;
updateMessageContent(messageElement: Element, content: string): void;
pushMessage: (message: Message | undefined) => void;
pushMessages: (messages: Message[]) => void;
pushLoadingMessage: () => void;
finishLoadingMessage: () => void;
updateLoadingMessageContent: (content: string) => void;
updateLoadingMessageReasoningContent: (content: string) => void;
clear(): void;
setPaddingBottom(): void;
}
declare const userInputRender: {
value: string;
clear(): void;
focus(): void;
};
declare const buttonRender: {
default(): void;
chatting(): void;
};
declare const alertRender: {
show(text: string): void;
};
declare const messagesContainerRender: MessagesContainerRender;
export { cacheElements, getElements, messagesContainerRender, userInputRender, buttonRender, alertRender, };