ai-client-kit
Version:
适用于任意前端框架的 AI 集成套件,支持多模型接入、聊天面板、Function Calling 等。
74 lines (73 loc) • 2.64 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 { ModelOption } from '../store/model-store';
import { Message, Session } from '../store/session-store';
interface Elements {
root: ShadowRoot;
userInputContainer: HTMLElement;
userInput: HTMLTextAreaElement;
submitIcon: HTMLButtonElement;
stopIcon: HTMLButtonElement;
messagesContainer: HTMLElement;
createButton: HTMLButtonElement;
historyButton: HTMLButtonElement;
historyPopup: HTMLElement;
historyPopupContent: HTMLElement;
historyPopupClose: HTMLButtonElement;
modelSelect: HTMLSelectElement;
}
export declare function cacheElements(root: ShadowRoot): Elements;
export declare function getElements(): Elements;
export declare const messagesContainerRender: {
_templates: {
copyButton: HTMLTemplateElement | null;
initCopyButton(): HTMLTemplateElement;
};
createCopyButton(message: Message): Element | null;
createMessage(message: Message): HTMLDivElement;
addUserMessage(message: Message): void;
replaceLoading(message: Message): void;
addLoading(): void;
hasLoading(): boolean;
removeLoading(): void;
clear(): void;
displaySession(session: Session): void;
};
export declare const userInputRender: {
value: string;
clear(): void;
focus(): void;
toggleReadOnly(value: boolean): void;
};
export declare const buttonRender: {
default(): void;
chatting(): void;
};
export declare const historyRender: {
createHistoryItem(session: Session, activeTime: number | null, getSessionTitle: (session: Session) => string): string;
displayHistory(sessions: Session[], activeTime: number | null, getSessionTitle: (session: Session) => string): void;
openPopup(sessions: Session[], activeTime: number | null, getSessionTitle: (session: Session) => string): void;
closePopup(): void;
updateActiveItem(time: number): void;
};
export declare const alertRender: {
show(text: string): void;
};
export declare const modelRender: {
init(): void;
select(option: ModelOption): void;
};
export {};