qqsl-agent 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/assets/images/card/copy.png +0 -0
- package/assets/images/card/refresh.png +0 -0
- package/assets/images/card/share.png +0 -0
- package/assets/images/card/think-finish.png +0 -0
- package/assets/images/input/relate.png +0 -0
- package/assets/images/input/send-gray.png +0 -0
- package/assets/images/input/send.png +0 -0
- package/assets/images/input/toggle-model.png +0 -0
- package/assets/images/logo.png +0 -0
- package/assets/images/sidebar/collapse.png +0 -0
- package/assets/images/sidebar/delete.png +0 -0
- package/assets/images/sidebar/expand.png +0 -0
- package/assets/images/sidebar/history-chat.png +0 -0
- package/assets/images/sidebar/new-chat.png +0 -0
- package/assets/images/sidebar/time.png +0 -0
- package/assets/styles/index.css +1 -0
- package/chat/chat-input/chat-input.component.d.ts +46 -0
- package/chat/chat-messages/chat-messages.component.d.ts +33 -0
- package/chat/chat-sidebar/chat-sidebar.component.d.ts +20 -0
- package/chat/chat-sidebar/history-group/history-group.component.d.ts +18 -0
- package/chat/chat.component.d.ts +34 -0
- package/chat/chat.module.d.ts +28 -0
- package/chat/components/pagination/pagination.component.d.ts +14 -0
- package/chat/index.d.ts +5 -0
- package/chat/models/conversation.model.d.ts +20 -0
- package/chat/models/knowledge-list.model.d.ts +8 -0
- package/chat/models/message.model.d.ts +41 -0
- package/chat/models/model-list.model.d.ts +9 -0
- package/chat/models/send-message.model.d.ts +33 -0
- package/chat/pipes/markdown.pipe.d.ts +8 -0
- package/chat/public-api.d.ts +2 -0
- package/chat/services/http.service.d.ts +13 -0
- package/chat/services/http2.service.d.ts +45 -0
- package/chat/services/markdown-stream.service.d.ts +10 -0
- package/chat/services/sse.service.d.ts +28 -0
- package/chat/store/store.service.d.ts +17 -0
- package/esm2020/chat/chat-input/chat-input.component.mjs +151 -0
- package/esm2020/chat/chat-messages/chat-messages.component.mjs +110 -0
- package/esm2020/chat/chat-sidebar/chat-sidebar.component.mjs +118 -0
- package/esm2020/chat/chat-sidebar/history-group/history-group.component.mjs +124 -0
- package/esm2020/chat/chat.component.mjs +138 -0
- package/esm2020/chat/chat.module.mjs +98 -0
- package/esm2020/chat/components/pagination/pagination.component.mjs +91 -0
- package/esm2020/chat/models/conversation.model.mjs +2 -0
- package/esm2020/chat/models/knowledge-list.model.mjs +2 -0
- package/esm2020/chat/models/message.model.mjs +35 -0
- package/esm2020/chat/models/model-list.model.mjs +2 -0
- package/esm2020/chat/models/send-message.model.mjs +2 -0
- package/esm2020/chat/pipes/markdown.pipe.mjs +24 -0
- package/esm2020/chat/public-api.mjs +3 -0
- package/esm2020/chat/qqsl-agent-chat.mjs +5 -0
- package/esm2020/chat/services/http.service.mjs +68 -0
- package/esm2020/chat/services/http2.service.mjs +101 -0
- package/esm2020/chat/services/markdown-stream.service.mjs +137 -0
- package/esm2020/chat/services/sse.service.mjs +107 -0
- package/esm2020/chat/store/store.service.mjs +38 -0
- package/esm2020/public-api.mjs +5 -0
- package/esm2020/qqsl-agent.mjs +5 -0
- package/fesm2015/qqsl-agent-chat.mjs +1255 -0
- package/fesm2015/qqsl-agent-chat.mjs.map +1 -0
- package/fesm2015/qqsl-agent.mjs +9 -0
- package/fesm2015/qqsl-agent.mjs.map +1 -0
- package/fesm2020/qqsl-agent-chat.mjs +1248 -0
- package/fesm2020/qqsl-agent-chat.mjs.map +1 -0
- package/fesm2020/qqsl-agent.mjs +9 -0
- package/fesm2020/qqsl-agent.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/package.json +45 -0
- package/public-api.d.ts +2 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# AiAgent
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.2.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Run `ng generate component component-name --project ai-agent` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ai-agent`.
|
|
8
|
+
> Note: Don't forget to add `--project ai-agent` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
+
|
|
10
|
+
## Build
|
|
11
|
+
|
|
12
|
+
Run `ng build ai-agent` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
+
|
|
14
|
+
## Publishing
|
|
15
|
+
|
|
16
|
+
After building your library with `ng build ai-agent`, go to the dist folder `cd dist/ai-agent` and run `npm publish`.
|
|
17
|
+
|
|
18
|
+
## Running unit tests
|
|
19
|
+
|
|
20
|
+
Run `ng test ai-agent` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
+
|
|
22
|
+
## Further help
|
|
23
|
+
|
|
24
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "highlight.js/styles/atom-one-light.css";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { EventEmitter, ElementRef, OnInit } from '@angular/core';
|
|
2
|
+
import { IModel, IModelList } from '../models/model-list.model';
|
|
3
|
+
import { IKnowledgeList } from '../models/knowledge-list.model';
|
|
4
|
+
import { ISendMessage } from '../models/send-message.model';
|
|
5
|
+
import { Message } from '../models/message.model';
|
|
6
|
+
import { SseService } from '../services/sse.service';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare class ChatInputComponent implements OnInit {
|
|
9
|
+
editor: ElementRef<HTMLDivElement>;
|
|
10
|
+
chatInputWrapper: ElementRef<HTMLDivElement>;
|
|
11
|
+
messages: Message[];
|
|
12
|
+
sendMessage: EventEmitter<{
|
|
13
|
+
message: ISendMessage;
|
|
14
|
+
isRegenerate: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
messageChange: EventEmitter<string>;
|
|
17
|
+
enter: EventEmitter<string>;
|
|
18
|
+
paste: EventEmitter<Event>;
|
|
19
|
+
private httpService;
|
|
20
|
+
private storeService;
|
|
21
|
+
sseService: SseService;
|
|
22
|
+
isEmpty: boolean;
|
|
23
|
+
currentModel: IModel | null;
|
|
24
|
+
currentKnowledge: string[];
|
|
25
|
+
modelList: IModelList;
|
|
26
|
+
knowledgeList: IKnowledgeList;
|
|
27
|
+
modelPopoverVisible: boolean;
|
|
28
|
+
knowledgePopoverVisible: boolean;
|
|
29
|
+
deepThink: boolean;
|
|
30
|
+
ngOnInit(): void;
|
|
31
|
+
getModelList(): void;
|
|
32
|
+
getKnowledgeList(): void;
|
|
33
|
+
modelVisibleChange(value: boolean): void;
|
|
34
|
+
knowledgeVisibleChange(value: boolean): void;
|
|
35
|
+
knowledgeSelectChange(value: string[]): void;
|
|
36
|
+
toggleDeepThink(): void;
|
|
37
|
+
private updateEmptyState;
|
|
38
|
+
handleInput(): void;
|
|
39
|
+
handleEnter(event: Event): void;
|
|
40
|
+
handlePaste(event: ClipboardEvent): void;
|
|
41
|
+
clearInput(): void;
|
|
42
|
+
regenerateSend(msg: Message): void;
|
|
43
|
+
send(): void;
|
|
44
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChatInputComponent, never>;
|
|
45
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ChatInputComponent, "ngx-chat-input", never, { "messages": "messages"; }, { "sendMessage": "sendMessage"; "messageChange": "messageChange"; "enter": "enter"; "paste": "paste"; }, never, never, false, never>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ElementRef, AfterViewChecked, AfterViewInit, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { Message } from '../models/message.model';
|
|
3
|
+
import { SafeHtml } from '@angular/platform-browser';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class ChatMessagesComponent implements AfterViewChecked, AfterViewInit, OnChanges {
|
|
6
|
+
messages: Message[];
|
|
7
|
+
messagesContainer: ElementRef;
|
|
8
|
+
/**
|
|
9
|
+
* 重新生成回答
|
|
10
|
+
*/
|
|
11
|
+
regenerateAnswer: EventEmitter<Message>;
|
|
12
|
+
private md;
|
|
13
|
+
private sseService;
|
|
14
|
+
private sanitizer;
|
|
15
|
+
private msg;
|
|
16
|
+
isLoading: boolean;
|
|
17
|
+
inputHeight: number;
|
|
18
|
+
renderedHtml: SafeHtml;
|
|
19
|
+
private accumulatedMarkdown;
|
|
20
|
+
ngAfterViewInit(): void;
|
|
21
|
+
ngAfterViewChecked(): void;
|
|
22
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
23
|
+
scrollToBottom(): void;
|
|
24
|
+
copyContent(text: string): void;
|
|
25
|
+
onPageChange(num: number, msg: Message): void;
|
|
26
|
+
/**
|
|
27
|
+
* 重新生成多个回答
|
|
28
|
+
*/
|
|
29
|
+
regenerate(msg: Message): void;
|
|
30
|
+
private renderCompleteBlocks;
|
|
31
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChatMessagesComponent, never>;
|
|
32
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ChatMessagesComponent, "ngx-chat-messages", never, { "messages": "messages"; }, { "regenerateAnswer": "regenerateAnswer"; }, never, never, false, never>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import { Conversation, ConversationGroup } from '../models/conversation.model';
|
|
3
|
+
import { HistoryGroupComponent } from './history-group/history-group.component';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class ChatSidebarComponent implements OnInit {
|
|
6
|
+
historyGroupRef: HistoryGroupComponent;
|
|
7
|
+
private http;
|
|
8
|
+
private storeService;
|
|
9
|
+
isCollapsed: boolean;
|
|
10
|
+
historyGroups: ConversationGroup[];
|
|
11
|
+
ngOnInit(): void;
|
|
12
|
+
getHistory(needSelectFirst?: boolean): void;
|
|
13
|
+
refresh(conversationICode: string): void;
|
|
14
|
+
selectConversation(conversation: Conversation | null): void;
|
|
15
|
+
toggleSidebar(): void;
|
|
16
|
+
openNewChat(): void;
|
|
17
|
+
groupByFriendlyTime(dataList: Conversation[]): ConversationGroup[];
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChatSidebarComponent, never>;
|
|
19
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ChatSidebarComponent, "ngx-chat-sidebar", never, {}, {}, never, never, false, never>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { ConversationGroup, Conversation } from '../../models/conversation.model';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class HistoryGroupComponent {
|
|
5
|
+
group: ConversationGroup;
|
|
6
|
+
select: EventEmitter<Conversation | null>;
|
|
7
|
+
refresh: EventEmitter<string>;
|
|
8
|
+
currentSelected: Conversation | null;
|
|
9
|
+
private storeService;
|
|
10
|
+
private modalService;
|
|
11
|
+
private msg;
|
|
12
|
+
private http;
|
|
13
|
+
toggleExpand(): void;
|
|
14
|
+
selectConversation(item: Conversation | null): void;
|
|
15
|
+
deleteConversation(e: Event, item: Conversation): void;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HistoryGroupComponent, never>;
|
|
17
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<HistoryGroupComponent, "history-group", never, { "group": "group"; }, { "select": "select"; "refresh": "refresh"; }, never, never, false, never>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AfterViewInit, OnInit } from '@angular/core';
|
|
2
|
+
import { ISendMessage } from './models/send-message.model';
|
|
3
|
+
import { ChatMessagesComponent } from './chat-messages/chat-messages.component';
|
|
4
|
+
import { ChatSidebarComponent } from './chat-sidebar/chat-sidebar.component';
|
|
5
|
+
import { Message } from './models/message.model';
|
|
6
|
+
import { ChatInputComponent } from './chat-input/chat-input.component';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare class NgxAgentChatComponent implements OnInit, AfterViewInit {
|
|
9
|
+
/**
|
|
10
|
+
* 接口baseUrl配置
|
|
11
|
+
*/
|
|
12
|
+
baseUrl: string;
|
|
13
|
+
token: string;
|
|
14
|
+
chatSidebarRef: ChatSidebarComponent;
|
|
15
|
+
chatMessagesRef: ChatMessagesComponent;
|
|
16
|
+
chatInputRef: ChatInputComponent;
|
|
17
|
+
private md;
|
|
18
|
+
private httpService;
|
|
19
|
+
private sseService;
|
|
20
|
+
private storeService;
|
|
21
|
+
private sanitizer;
|
|
22
|
+
private ngZone;
|
|
23
|
+
private resizeObserver;
|
|
24
|
+
messages: Message[];
|
|
25
|
+
ngOnInit(): void;
|
|
26
|
+
ngAfterViewInit(): void;
|
|
27
|
+
regenerateAnswer(msg: Message): void;
|
|
28
|
+
onSendMessage(event: {
|
|
29
|
+
message: ISendMessage;
|
|
30
|
+
isRegenerate: boolean;
|
|
31
|
+
}): void;
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxAgentChatComponent, never>;
|
|
33
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NgxAgentChatComponent, "ngx-agent-chat", never, { "baseUrl": "baseUrl"; "token": "token"; }, {}, never, never, false, never>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./chat.component";
|
|
3
|
+
import * as i2 from "./chat-input/chat-input.component";
|
|
4
|
+
import * as i3 from "./chat-messages/chat-messages.component";
|
|
5
|
+
import * as i4 from "./chat-sidebar/chat-sidebar.component";
|
|
6
|
+
import * as i5 from "./components/pagination/pagination.component";
|
|
7
|
+
import * as i6 from "./chat-sidebar/history-group/history-group.component";
|
|
8
|
+
import * as i7 from "@angular/common";
|
|
9
|
+
import * as i8 from "ng-zorro-antd/avatar";
|
|
10
|
+
import * as i9 from "ng-zorro-antd/spin";
|
|
11
|
+
import * as i10 from "ng-zorro-antd/tag";
|
|
12
|
+
import * as i11 from "ng-zorro-antd/input";
|
|
13
|
+
import * as i12 from "ng-zorro-antd/button";
|
|
14
|
+
import * as i13 from "ng-zorro-antd/list";
|
|
15
|
+
import * as i14 from "ng-zorro-antd/slider";
|
|
16
|
+
import * as i15 from "ng-zorro-antd/layout";
|
|
17
|
+
import * as i16 from "ng-zorro-antd/popover";
|
|
18
|
+
import * as i17 from "ng-zorro-antd/radio";
|
|
19
|
+
import * as i18 from "ng-zorro-antd/checkbox";
|
|
20
|
+
import * as i19 from "ng-zorro-antd/icon";
|
|
21
|
+
import * as i20 from "ng-zorro-antd/pagination";
|
|
22
|
+
import * as i21 from "@angular/forms";
|
|
23
|
+
import * as i22 from "./pipes/markdown.pipe";
|
|
24
|
+
export declare class AgentChatModule {
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AgentChatModule, never>;
|
|
26
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<AgentChatModule, [typeof i1.NgxAgentChatComponent, typeof i2.ChatInputComponent, typeof i3.ChatMessagesComponent, typeof i4.ChatSidebarComponent, typeof i5.SimplePaginationComponent, typeof i6.HistoryGroupComponent], [typeof i7.CommonModule, typeof i8.NzAvatarModule, typeof i9.NzSpinModule, typeof i10.NzTagModule, typeof i11.NzInputModule, typeof i12.NzButtonModule, typeof i13.NzListModule, typeof i14.NzSliderModule, typeof i15.NzLayoutModule, typeof i16.NzPopoverModule, typeof i17.NzRadioModule, typeof i18.NzCheckboxModule, typeof i19.NzIconModule, typeof i20.NzPaginationModule, typeof i21.FormsModule, typeof i22.MarkdownPipe], [typeof i1.NgxAgentChatComponent]>;
|
|
27
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<AgentChatModule>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class SimplePaginationComponent {
|
|
4
|
+
/** 当前页码 */
|
|
5
|
+
current: number;
|
|
6
|
+
/** 总页数 */
|
|
7
|
+
total: number;
|
|
8
|
+
/** 当页码改变时触发 */
|
|
9
|
+
pageChange: EventEmitter<number>;
|
|
10
|
+
onPrev(): void;
|
|
11
|
+
onNext(): void;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SimplePaginationComponent, never>;
|
|
13
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SimplePaginationComponent, "ngx-simple-pagination", never, { "current": "current"; "total": "total"; }, { "pageChange": "pageChange"; }, never, never, false, never>;
|
|
14
|
+
}
|
package/chat/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface Conversation {
|
|
2
|
+
/**
|
|
3
|
+
* 会话唯一编码
|
|
4
|
+
*/
|
|
5
|
+
iCode: string;
|
|
6
|
+
/**
|
|
7
|
+
* 会话名称
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* 会话时间(最新)
|
|
12
|
+
*/
|
|
13
|
+
time?: number;
|
|
14
|
+
isActive?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface ConversationGroup {
|
|
17
|
+
dateLabel: string;
|
|
18
|
+
expanded: boolean;
|
|
19
|
+
items: Conversation[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface Message {
|
|
2
|
+
iCode: string;
|
|
3
|
+
/**
|
|
4
|
+
* 提问内容
|
|
5
|
+
*/
|
|
6
|
+
question: string;
|
|
7
|
+
/**
|
|
8
|
+
* 提问时间
|
|
9
|
+
*/
|
|
10
|
+
time?: number;
|
|
11
|
+
/**
|
|
12
|
+
* 回答列表
|
|
13
|
+
*/
|
|
14
|
+
answers: Answer[];
|
|
15
|
+
/**
|
|
16
|
+
* 当前显示的回答index
|
|
17
|
+
*/
|
|
18
|
+
answerIndex: number;
|
|
19
|
+
/**
|
|
20
|
+
* 当前显示的回答
|
|
21
|
+
*/
|
|
22
|
+
currentAnswer?: Answer;
|
|
23
|
+
}
|
|
24
|
+
export interface Answer {
|
|
25
|
+
/**
|
|
26
|
+
* 回答唯一编码
|
|
27
|
+
*/
|
|
28
|
+
iCode: string;
|
|
29
|
+
/**
|
|
30
|
+
* 思考内容
|
|
31
|
+
*/
|
|
32
|
+
think: string;
|
|
33
|
+
/**
|
|
34
|
+
* 回答主体内容
|
|
35
|
+
*/
|
|
36
|
+
content: string;
|
|
37
|
+
/**
|
|
38
|
+
* 思考是否展开
|
|
39
|
+
*/
|
|
40
|
+
thinkExpand?: boolean;
|
|
41
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 人工提问参数
|
|
3
|
+
*/
|
|
4
|
+
export interface ISendMessage {
|
|
5
|
+
/**
|
|
6
|
+
* 会话唯一编码
|
|
7
|
+
*/
|
|
8
|
+
conversation?: string;
|
|
9
|
+
/**
|
|
10
|
+
* 问题唯一编码(重新生成回答必填)
|
|
11
|
+
*/
|
|
12
|
+
questionICode?: string;
|
|
13
|
+
/**
|
|
14
|
+
* 模型唯一编码
|
|
15
|
+
*/
|
|
16
|
+
model: string;
|
|
17
|
+
/**
|
|
18
|
+
* 是否需要深度思考
|
|
19
|
+
*/
|
|
20
|
+
think: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* 问题内容
|
|
23
|
+
*/
|
|
24
|
+
question: string;
|
|
25
|
+
/**
|
|
26
|
+
* 是否管理知识库
|
|
27
|
+
*/
|
|
28
|
+
knowledge: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* 关联的知识库
|
|
31
|
+
*/
|
|
32
|
+
knowledgeList: string[];
|
|
33
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PipeTransform } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class MarkdownPipe implements PipeTransform {
|
|
4
|
+
private md;
|
|
5
|
+
transform(value: any): any;
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MarkdownPipe, never>;
|
|
7
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<MarkdownPipe, "markdown", true>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { StoreService } from '../store/store.service';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class HttpService {
|
|
6
|
+
private http;
|
|
7
|
+
private storeService;
|
|
8
|
+
constructor(http: HttpClient, storeService: StoreService);
|
|
9
|
+
get(url: string, paramObj?: any): Observable<any>;
|
|
10
|
+
post(url: string, body: any, options?: any): Observable<any>;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HttpService, never>;
|
|
12
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<HttpService>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export interface ApiResponse<T = any> {
|
|
4
|
+
code: number;
|
|
5
|
+
msg: string;
|
|
6
|
+
data: T;
|
|
7
|
+
}
|
|
8
|
+
export declare class HttpService {
|
|
9
|
+
private http;
|
|
10
|
+
private storeService;
|
|
11
|
+
private readonly BASE_URL;
|
|
12
|
+
/**
|
|
13
|
+
* 统一获取 Headers
|
|
14
|
+
*/
|
|
15
|
+
private getHeaders;
|
|
16
|
+
/**
|
|
17
|
+
* GET 请求
|
|
18
|
+
*/
|
|
19
|
+
get<T>(url: string, params?: any): Observable<T>;
|
|
20
|
+
/**
|
|
21
|
+
* POST 请求
|
|
22
|
+
*/
|
|
23
|
+
post<T>(url: string, body: any): Observable<T>;
|
|
24
|
+
/**
|
|
25
|
+
* PUT 请求
|
|
26
|
+
*/
|
|
27
|
+
put<T>(url: string, body: any): Observable<T>;
|
|
28
|
+
/**
|
|
29
|
+
* DELETE 请求
|
|
30
|
+
* 兼容支持:既支持 URL 参数,也支持 Body
|
|
31
|
+
*/
|
|
32
|
+
delete<T>(url: string, params?: any, body?: any): Observable<T>;
|
|
33
|
+
/**
|
|
34
|
+
* 统一处理 URL
|
|
35
|
+
* 比如自动拼接 BaseUrl,或者处理斜杠
|
|
36
|
+
*/
|
|
37
|
+
private formatUrl;
|
|
38
|
+
/**
|
|
39
|
+
* 统一清洗参数
|
|
40
|
+
* 过滤掉 null 和 undefined,防止传给后端 "null" 字符串
|
|
41
|
+
*/
|
|
42
|
+
private resolveParams;
|
|
43
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HttpService, never>;
|
|
44
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<HttpService>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class MarkdownStreamService {
|
|
3
|
+
private marked;
|
|
4
|
+
constructor();
|
|
5
|
+
renderIncremental(markdown: string): string;
|
|
6
|
+
private completeCodeBlocks;
|
|
7
|
+
private escapeHtml;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MarkdownStreamService, never>;
|
|
9
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MarkdownStreamService>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BehaviorSubject } from 'rxjs';
|
|
2
|
+
import { ISendMessage } from '../models/send-message.model';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export interface ConversationICodeObj {
|
|
5
|
+
conversation: string;
|
|
6
|
+
question: string;
|
|
7
|
+
answer: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class SseService {
|
|
10
|
+
private storeService;
|
|
11
|
+
private conversationICodeSource;
|
|
12
|
+
conversationICode$: import("rxjs").Observable<ConversationICodeObj | null>;
|
|
13
|
+
private thinkingSource;
|
|
14
|
+
thinking$: import("rxjs").Observable<string>;
|
|
15
|
+
private messageSource;
|
|
16
|
+
currentMessage$: import("rxjs").Observable<string>;
|
|
17
|
+
private deltaSource;
|
|
18
|
+
delta$: import("rxjs").Observable<string>;
|
|
19
|
+
loadingSource: BehaviorSubject<boolean>;
|
|
20
|
+
loading$: import("rxjs").Observable<boolean>;
|
|
21
|
+
private fullThinking;
|
|
22
|
+
private fullMessage;
|
|
23
|
+
streamChat(body: ISendMessage): Promise<void>;
|
|
24
|
+
private controller;
|
|
25
|
+
cancel(): void;
|
|
26
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SseService, never>;
|
|
27
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SseService>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Conversation } from '../models/conversation.model';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class StoreService {
|
|
4
|
+
private token;
|
|
5
|
+
private baseUrl;
|
|
6
|
+
private conversationICode?;
|
|
7
|
+
private currentConversationSource;
|
|
8
|
+
currentConversation$: import("rxjs").Observable<Conversation | null>;
|
|
9
|
+
setToken(token: string): void;
|
|
10
|
+
getToken(): string;
|
|
11
|
+
setBaseUrl(url: string): void;
|
|
12
|
+
getBaseUrl(): string;
|
|
13
|
+
setCurrentConversation(conversation: Conversation | null): void;
|
|
14
|
+
getConversationICode(): string | undefined;
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StoreService, never>;
|
|
16
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<StoreService>;
|
|
17
|
+
}
|