ppagent 0.0.30 → 0.0.32
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 +6 -0
- package/dist/lib.d.ts +77 -29
- package/dist/lib.js +21 -19
- package/package.json +132 -127
package/README.md
CHANGED
package/dist/lib.d.ts
CHANGED
|
@@ -195,7 +195,6 @@ declare const config: {
|
|
|
195
195
|
publicForceAuth: boolean;
|
|
196
196
|
secretFile: string;
|
|
197
197
|
traceHttpRequest: boolean;
|
|
198
|
-
version: string;
|
|
199
198
|
npmRegistry: string;
|
|
200
199
|
npmTimeout: number;
|
|
201
200
|
serverCompress: boolean;
|
|
@@ -705,6 +704,10 @@ interface ISourceChatMessage {
|
|
|
705
704
|
* 自定义类型时的名称
|
|
706
705
|
*/
|
|
707
706
|
customType?: string;
|
|
707
|
+
/**
|
|
708
|
+
* 消息状态,仅用于标记大模型返回的消息。reasoning表示推理过程消息,content表示回复的消息。为空表示content。
|
|
709
|
+
*/
|
|
710
|
+
status?: "reasoning" | "content";
|
|
708
711
|
}
|
|
709
712
|
interface ISourceGroupChatMessage extends ISourceChatMessage {
|
|
710
713
|
groupInfo: ISourceUserInfo;
|
|
@@ -894,6 +897,12 @@ interface IBotOptions extends IInstanceCreateOptions {
|
|
|
894
897
|
systemPrompt?: string;
|
|
895
898
|
}
|
|
896
899
|
interface IMessageContentReceiver {
|
|
900
|
+
/**
|
|
901
|
+
* 推理过程
|
|
902
|
+
* @param text
|
|
903
|
+
* @returns
|
|
904
|
+
*/
|
|
905
|
+
onReasoning?: (text: string) => void;
|
|
897
906
|
/**
|
|
898
907
|
* 将后端的消息返回给前端。当完成时,如果支持历史消息,应该将此次消息的平台版本,即botMessage返回给agent
|
|
899
908
|
* @param content
|
|
@@ -1521,11 +1530,11 @@ declare class PPAgent extends Emittery {
|
|
|
1521
1530
|
folder: string | {
|
|
1522
1531
|
id: string;
|
|
1523
1532
|
name: string;
|
|
1524
|
-
parent: string | any;
|
|
1533
|
+
parent: string | /*elided*/ any;
|
|
1525
1534
|
};
|
|
1526
|
-
uploaded_by: string | any;
|
|
1535
|
+
uploaded_by: string | /*elided*/ any;
|
|
1527
1536
|
uploaded_on: "datetime";
|
|
1528
|
-
modified_by: string | any;
|
|
1537
|
+
modified_by: string | /*elided*/ any;
|
|
1529
1538
|
modified_on: "datetime";
|
|
1530
1539
|
charset: string | null;
|
|
1531
1540
|
filesize: string | null;
|
|
@@ -1549,31 +1558,37 @@ declare class PPAgent extends Emittery {
|
|
|
1549
1558
|
name: string;
|
|
1550
1559
|
icon: string;
|
|
1551
1560
|
description: string | null;
|
|
1552
|
-
parent: string | any;
|
|
1553
|
-
children: string[] | any[];
|
|
1561
|
+
parent: string | /*elided*/ any;
|
|
1562
|
+
children: string[] | /*elided*/ any[];
|
|
1554
1563
|
policies: string[] | {
|
|
1555
1564
|
id: string;
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1565
|
+
role: string | /*elided*/ any;
|
|
1566
|
+
user: string | /*elided*/ any;
|
|
1567
|
+
policy: string | {
|
|
1568
|
+
id: string;
|
|
1569
|
+
name: string;
|
|
1570
|
+
icon: string;
|
|
1571
|
+
description: string | null;
|
|
1572
|
+
ip_access: string | null;
|
|
1573
|
+
enforce_tfa: boolean;
|
|
1574
|
+
admin_access: boolean;
|
|
1575
|
+
app_access: boolean;
|
|
1576
|
+
permissions: number[] | {
|
|
1577
|
+
id: number;
|
|
1578
|
+
policy: string | /*elided*/ any;
|
|
1579
|
+
collection: string;
|
|
1580
|
+
action: string;
|
|
1581
|
+
permissions: Record<string, any> | null;
|
|
1582
|
+
validation: Record<string, any> | null;
|
|
1583
|
+
presets: Record<string, any> | null;
|
|
1584
|
+
fields: string[] | null;
|
|
1585
|
+
}[];
|
|
1586
|
+
users: string[] | /*elided*/ any[];
|
|
1587
|
+
roles: string[] | /*elided*/ any[];
|
|
1588
|
+
};
|
|
1589
|
+
sort: number;
|
|
1575
1590
|
}[];
|
|
1576
|
-
users: string[] | any[];
|
|
1591
|
+
users: string[] | /*elided*/ any[];
|
|
1577
1592
|
};
|
|
1578
1593
|
token: string | null;
|
|
1579
1594
|
last_access: "datetime" | null;
|
|
@@ -1598,7 +1613,7 @@ declare class PPAgent extends Emittery {
|
|
|
1598
1613
|
app_access: boolean;
|
|
1599
1614
|
permissions: number[] | {
|
|
1600
1615
|
id: number;
|
|
1601
|
-
policy: string | any;
|
|
1616
|
+
policy: string | /*elided*/ any;
|
|
1602
1617
|
collection: string;
|
|
1603
1618
|
action: string;
|
|
1604
1619
|
permissions: Record<string, any> | null;
|
|
@@ -1606,8 +1621,23 @@ declare class PPAgent extends Emittery {
|
|
|
1606
1621
|
presets: Record<string, any> | null;
|
|
1607
1622
|
fields: string[] | null;
|
|
1608
1623
|
}[];
|
|
1609
|
-
users: string[] | any[];
|
|
1610
|
-
roles: string[] |
|
|
1624
|
+
users: string[] | /*elided*/ any[];
|
|
1625
|
+
roles: string[] | {
|
|
1626
|
+
id: string;
|
|
1627
|
+
name: string;
|
|
1628
|
+
icon: string;
|
|
1629
|
+
description: string | null;
|
|
1630
|
+
parent: string | /*elided*/ any;
|
|
1631
|
+
children: string[] | /*elided*/ any[];
|
|
1632
|
+
policies: string[] | {
|
|
1633
|
+
id: string;
|
|
1634
|
+
role: string | /*elided*/ any;
|
|
1635
|
+
user: string | /*elided*/ any;
|
|
1636
|
+
policy: string | /*elided*/ any;
|
|
1637
|
+
sort: number;
|
|
1638
|
+
}[];
|
|
1639
|
+
users: string[] | /*elided*/ any[];
|
|
1640
|
+
}[];
|
|
1611
1641
|
}[];
|
|
1612
1642
|
};
|
|
1613
1643
|
get onlinePlugins(): MapIterator<IOnlinePluginInfo>;
|
|
@@ -1754,6 +1784,22 @@ interface IAgentOptions {
|
|
|
1754
1784
|
* 正在执行中的问答,执行的超时时间,默认60秒。超过的任务将不再等待,继续执行一个提问(不会被取消回调,有返回后仍然会发送)。
|
|
1755
1785
|
*/
|
|
1756
1786
|
timeoutInSeconds?: number;
|
|
1787
|
+
/**
|
|
1788
|
+
* 思考过程最大的拆分数量,默认为3。如果超过了,则最后一次性回复。避免被拆分的太零散,也能符合部分平台对回复数量的要求。
|
|
1789
|
+
*/
|
|
1790
|
+
maxReasoningSplitCount?: number;
|
|
1791
|
+
/**
|
|
1792
|
+
* 是否显示思考过程(仅对推理模型有效)
|
|
1793
|
+
*/
|
|
1794
|
+
sendReasoning?: boolean;
|
|
1795
|
+
/**
|
|
1796
|
+
* 思考部分内容的前缀,如 【思考中】
|
|
1797
|
+
*/
|
|
1798
|
+
reasoningPrefix?: string;
|
|
1799
|
+
/**
|
|
1800
|
+
* 回复内容的前缀,如 【回复】。仅对推理模型生效。正常对内容的修改可以通过添加技能完成
|
|
1801
|
+
*/
|
|
1802
|
+
contentPrefix?: string;
|
|
1757
1803
|
}
|
|
1758
1804
|
/**
|
|
1759
1805
|
* 一个智能体,用于连接source和bot。
|
|
@@ -1920,6 +1966,7 @@ declare abstract class BasicBot extends Emittery implements IBot {
|
|
|
1920
1966
|
protected checkCommand(text: string, chatId: string, data: IAgentChatEventData): boolean;
|
|
1921
1967
|
protected getLastInfo(chatId: string): Promise<ILastBotMessageInfo>;
|
|
1922
1968
|
protected abstract sendMessageBody(body: any, historyMessages: any[], cb: {
|
|
1969
|
+
onReasoning?: (text: string) => void;
|
|
1923
1970
|
onContent: (content: any, messageType: SourceChatMessageType) => void;
|
|
1924
1971
|
onError: (error: any) => void;
|
|
1925
1972
|
onCompleted: (conversationId: string, timeInSeconds: number) => void;
|
|
@@ -2083,6 +2130,7 @@ declare class OpenAIBot extends BasicBot {
|
|
|
2083
2130
|
protected getLatestChatTime(conversationId: string, chatId: string): Promise<number>;
|
|
2084
2131
|
protected deleteConversation(conversationId: string, chatId: string): Promise<any>;
|
|
2085
2132
|
protected sendMessageBody(body: OpenAI.ChatCompletionCreateParamsStreaming, historyMessages: any[], cb: {
|
|
2133
|
+
onReasoning?: (text: string) => void;
|
|
2086
2134
|
onContent: (content: any, messageType: SourceChatMessageType) => void;
|
|
2087
2135
|
onError: (error: any) => void;
|
|
2088
2136
|
/**
|