@optima-chat/optima-agent 0.1.24 → 0.1.25
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/dist/bin/optima.js +1 -1
- package/dist/src/ui/App.js +1 -1
- package/dist/src/ui/components/MessageList.d.ts +1 -0
- package/dist/src/ui/components/MessageList.d.ts.map +1 -1
- package/dist/src/ui/components/MessageList.js +15 -5
- package/dist/src/ui/components/MessageList.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/optima.js
CHANGED
|
@@ -3,7 +3,7 @@ import { parseArgs } from "node:util";
|
|
|
3
3
|
import { OptimaAgent } from "../src/index.js";
|
|
4
4
|
import { startInteractiveMode } from "../src/ui/index.js";
|
|
5
5
|
import { startServer } from "../src/server/index.js";
|
|
6
|
-
const VERSION = "0.1.
|
|
6
|
+
const VERSION = "0.1.25";
|
|
7
7
|
function printHelp() {
|
|
8
8
|
console.log(`
|
|
9
9
|
Optima Agent - 电商运营 AI 助手
|
package/dist/src/ui/App.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useState, useCallback, useRef } from "react";
|
|
|
3
3
|
import { Box, useApp, useInput } from "ink";
|
|
4
4
|
import { Header, Composer, MessageList, StatusBar, Spinner, } from "./components/index.js";
|
|
5
5
|
import { OptimaAgent } from "../agent.js";
|
|
6
|
-
const VERSION = "0.1.
|
|
6
|
+
const VERSION = "0.1.25";
|
|
7
7
|
export function App({ cwd }) {
|
|
8
8
|
const { exit } = useApp();
|
|
9
9
|
const [input, setInput] = useState("");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../../src/ui/components/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../../src/ui/components/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAW,WAAW,EAAE,MAAM,cAAc,CAAC;AAEpD,UAAU,gBAAgB;IACxB,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,WAAW,8CA6BtB,CAAC"}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo } from "react";
|
|
3
|
-
import { Box } from "ink";
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { Box, Text } from "ink";
|
|
4
4
|
import { Message } from "./Message.js";
|
|
5
|
-
export const MessageList = memo(function MessageList({ messages }) {
|
|
6
|
-
|
|
5
|
+
export const MessageList = memo(function MessageList({ messages, maxVisible = 10 }) {
|
|
6
|
+
// 只显示最近的消息,避免内容超出屏幕导致闪烁
|
|
7
|
+
const { visibleMessages, hiddenCount } = useMemo(() => {
|
|
8
|
+
if (messages.length <= maxVisible) {
|
|
9
|
+
return { visibleMessages: messages, hiddenCount: 0 };
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
visibleMessages: messages.slice(-maxVisible),
|
|
13
|
+
hiddenCount: messages.length - maxVisible,
|
|
14
|
+
};
|
|
15
|
+
}, [messages, maxVisible]);
|
|
16
|
+
return (_jsxs(Box, { flexDirection: "column", flexGrow: 1, children: [hiddenCount > 0 && (_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: "gray", italic: true, children: ["... ", hiddenCount, " \u6761\u5386\u53F2\u6D88\u606F\u5DF2\u9690\u85CF (\u4F7F\u7528 /clear \u6E05\u7A7A)"] }) })), visibleMessages.map((msg, index) => (_jsx(Message, { message: msg }, messages.length - maxVisible + index)))] }));
|
|
7
17
|
});
|
|
8
18
|
//# sourceMappingURL=MessageList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageList.js","sourceRoot":"","sources":["../../../../src/ui/components/MessageList.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageList.js","sourceRoot":"","sources":["../../../../src/ui/components/MessageList.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,OAAO,EAAe,MAAM,cAAc,CAAC;AAOpD,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,WAAW,CAAC,EACnD,QAAQ,EACR,UAAU,GAAG,EAAE,EACE;IACjB,wBAAwB;IACxB,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE;QACpD,IAAI,QAAQ,CAAC,MAAM,IAAI,UAAU,EAAE,CAAC;YAClC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;QACvD,CAAC;QACD,OAAO;YACL,eAAe,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;YAC5C,WAAW,EAAE,QAAQ,CAAC,MAAM,GAAG,UAAU;SAC1C,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAE3B,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,aACpC,WAAW,GAAG,CAAC,IAAI,CAClB,KAAC,GAAG,IAAC,YAAY,EAAE,CAAC,YAClB,MAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,MAAM,2BAClB,WAAW,4FACX,GACH,CACP,EACA,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CACnC,KAAC,OAAO,IAA4C,OAAO,EAAE,GAAG,IAAlD,QAAQ,CAAC,MAAM,GAAG,UAAU,GAAG,KAAK,CAAkB,CACrE,CAAC,IACE,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|