activo 0.2.1 → 0.2.2
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/core/commands.d.ts +11 -0
- package/dist/core/commands.d.ts.map +1 -0
- package/dist/core/commands.js +90 -0
- package/dist/core/commands.js.map +1 -0
- package/dist/ui/App.d.ts.map +1 -1
- package/dist/ui/App.js +31 -2
- package/dist/ui/App.js.map +1 -1
- package/package.json +1 -1
- package/src/core/commands.ts +118 -0
- package/src/ui/App.tsx +38 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Config } from "./config.js";
|
|
2
|
+
export interface SlashCommandResult {
|
|
3
|
+
output?: string;
|
|
4
|
+
exit?: boolean;
|
|
5
|
+
clear?: boolean;
|
|
6
|
+
changeModel?: string;
|
|
7
|
+
showHelp?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function handleSlashCommand(input: string, config: Config): SlashCommandResult | null;
|
|
10
|
+
export declare function getAvailableCommands(): string[];
|
|
11
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/core/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA0B,MAAM,aAAa,CAAC;AAE7D,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAkFD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,kBAAkB,GAAG,IAAI,CAoB3B;AAED,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { saveConfig } from "./config.js";
|
|
2
|
+
const HELP_MESSAGE = `
|
|
3
|
+
ACTIVO - AI 코드 품질 분석 도구
|
|
4
|
+
|
|
5
|
+
[슬래시 커맨드]
|
|
6
|
+
/help 이 도움말 표시
|
|
7
|
+
/exit, /quit 종료
|
|
8
|
+
/clear 채팅 기록 삭제
|
|
9
|
+
/model <name> 모델 변경 (예: /model qwen2.5:7b)
|
|
10
|
+
/info 현재 설정 정보 표시
|
|
11
|
+
|
|
12
|
+
[단축키]
|
|
13
|
+
Enter 메시지 전송
|
|
14
|
+
ESC 진행 중 작업 취소
|
|
15
|
+
Ctrl+C x2 종료
|
|
16
|
+
|
|
17
|
+
[사용 예시]
|
|
18
|
+
"src 폴더 구조 보여줘"
|
|
19
|
+
"package.json 분석해줘"
|
|
20
|
+
"코드 품질 검사해줘"
|
|
21
|
+
"PDF를 마크다운으로 변환해줘"
|
|
22
|
+
`.trim();
|
|
23
|
+
const commandHandlers = {
|
|
24
|
+
help: () => ({
|
|
25
|
+
output: HELP_MESSAGE,
|
|
26
|
+
showHelp: true,
|
|
27
|
+
}),
|
|
28
|
+
exit: () => ({
|
|
29
|
+
exit: true,
|
|
30
|
+
output: "Goodbye!",
|
|
31
|
+
}),
|
|
32
|
+
quit: () => ({
|
|
33
|
+
exit: true,
|
|
34
|
+
output: "Goodbye!",
|
|
35
|
+
}),
|
|
36
|
+
clear: () => ({
|
|
37
|
+
clear: true,
|
|
38
|
+
output: "채팅 기록이 삭제되었습니다.",
|
|
39
|
+
}),
|
|
40
|
+
model: (args, config) => {
|
|
41
|
+
if (args.length === 0) {
|
|
42
|
+
return {
|
|
43
|
+
output: `현재 모델: ${config.ollama.model}\n\n사용법: /model <model_name>\n예시: /model qwen2.5:7b`,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const newModel = args[0];
|
|
47
|
+
config.ollama.model = newModel;
|
|
48
|
+
saveConfig(config);
|
|
49
|
+
return {
|
|
50
|
+
changeModel: newModel,
|
|
51
|
+
output: `모델이 "${newModel}"로 변경되었습니다.`,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
info: (args, config) => {
|
|
55
|
+
const info = `
|
|
56
|
+
[ACTIVO 정보]
|
|
57
|
+
버전: 0.2.1
|
|
58
|
+
|
|
59
|
+
[Ollama 설정]
|
|
60
|
+
URL: ${config.ollama.baseUrl}
|
|
61
|
+
모델: ${config.ollama.model}
|
|
62
|
+
컨텍스트: ${config.ollama.contextLength}
|
|
63
|
+
|
|
64
|
+
[표준 디렉토리]
|
|
65
|
+
${config.standards.directory}
|
|
66
|
+
`.trim();
|
|
67
|
+
return { output: info };
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
export function handleSlashCommand(input, config) {
|
|
71
|
+
// "/" 로 시작하지 않으면 null 반환
|
|
72
|
+
if (!input.startsWith("/")) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
// 파싱: "/" 제거 후 공백으로 분할
|
|
76
|
+
const trimmed = input.slice(1).trim();
|
|
77
|
+
const [command, ...args] = trimmed.split(/\s+/);
|
|
78
|
+
if (!command) {
|
|
79
|
+
return { output: "명령어를 입력하세요. /help 로 도움말을 확인하세요." };
|
|
80
|
+
}
|
|
81
|
+
const handler = commandHandlers[command.toLowerCase()];
|
|
82
|
+
if (handler) {
|
|
83
|
+
return handler(args, config);
|
|
84
|
+
}
|
|
85
|
+
return { output: `알 수 없는 명령어: /${command}\n/help 로 사용 가능한 명령어를 확인하세요.` };
|
|
86
|
+
}
|
|
87
|
+
export function getAvailableCommands() {
|
|
88
|
+
return Object.keys(commandHandlers);
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/core/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,UAAU,EAAE,MAAM,aAAa,CAAC;AAY7D,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;C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CAAC;CACF,CAAC;AAEF,MAAM,UAAU,kBAAkB,CAChC,KAAa,EACb,MAAc;IAEd,yBAAyB;IACzB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,uBAAuB;IACvB,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACtC,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEhD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,EAAE,MAAM,EAAE,iCAAiC,EAAE,CAAC;IACvD,CAAC;IAED,MAAM,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACvD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,gBAAgB,OAAO,8BAA8B,EAAE,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,OAAO,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AACtC,CAAC"}
|
package/dist/ui/App.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/ui/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/ui/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAS3C,UAAU,QAAQ;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAYD,wBAAgB,GAAG,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,GAAG,KAAK,CAAC,YAAY,CAsPnF"}
|
package/dist/ui/App.js
CHANGED
|
@@ -3,6 +3,7 @@ import { useState, useEffect, useCallback, useRef } from "react";
|
|
|
3
3
|
import { Box, Text, useApp, useInput } from "ink";
|
|
4
4
|
import { OllamaClient } from "../core/llm/ollama.js";
|
|
5
5
|
import { streamProcessMessage } from "../core/agent.js";
|
|
6
|
+
import { handleSlashCommand } from "../core/commands.js";
|
|
6
7
|
import { InputBox } from "./components/InputBox.js";
|
|
7
8
|
import { MessageList } from "./components/MessageList.js";
|
|
8
9
|
import { StatusBar } from "./components/StatusBar.js";
|
|
@@ -16,6 +17,7 @@ export function App({ initialPrompt, config, resume }) {
|
|
|
16
17
|
const [toolStatus, setToolStatus] = useState(null);
|
|
17
18
|
const [error, setError] = useState(null);
|
|
18
19
|
const [client] = useState(() => new OllamaClient(config.ollama));
|
|
20
|
+
const [currentModel, setCurrentModel] = useState(config.ollama.model);
|
|
19
21
|
const [exitPending, setExitPending] = useState(false);
|
|
20
22
|
const [cancelled, setCancelled] = useState(false);
|
|
21
23
|
const abortControllerRef = useRef(null);
|
|
@@ -72,8 +74,35 @@ export function App({ initialPrompt, config, resume }) {
|
|
|
72
74
|
if (!text.trim() || isProcessing)
|
|
73
75
|
return;
|
|
74
76
|
setInput("");
|
|
75
|
-
setIsProcessing(true);
|
|
76
77
|
setError(null);
|
|
78
|
+
// Handle slash commands first
|
|
79
|
+
if (text.startsWith("/")) {
|
|
80
|
+
const result = handleSlashCommand(text, config);
|
|
81
|
+
if (result) {
|
|
82
|
+
// Add command as user message
|
|
83
|
+
setMessages((prev) => [...prev, { role: "user", content: text }]);
|
|
84
|
+
if (result.exit) {
|
|
85
|
+
const exitMsg = { role: "assistant", content: result.output || "Goodbye!" };
|
|
86
|
+
setMessages((prev) => [...prev, exitMsg]);
|
|
87
|
+
setTimeout(() => exit(), 500);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (result.clear) {
|
|
91
|
+
setMessages([]);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (result.changeModel) {
|
|
95
|
+
setCurrentModel(result.changeModel);
|
|
96
|
+
client.setModel(result.changeModel);
|
|
97
|
+
}
|
|
98
|
+
if (result.output) {
|
|
99
|
+
const outputMsg = { role: "assistant", content: result.output };
|
|
100
|
+
setMessages((prev) => [...prev, outputMsg]);
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
setIsProcessing(true);
|
|
77
106
|
setCancelled(false);
|
|
78
107
|
// Create AbortController for this request
|
|
79
108
|
const abortController = new AbortController();
|
|
@@ -162,6 +191,6 @@ export function App({ initialPrompt, config, resume }) {
|
|
|
162
191
|
abortControllerRef.current = null;
|
|
163
192
|
}
|
|
164
193
|
}, [messages, client, config, isProcessing]);
|
|
165
|
-
return (_jsxs(Box, { flexDirection: "column", height: "100%", children: [_jsx(Box, { flexDirection: "column", flexGrow: 1, children: _jsx(MessageList, { messages: messages }) }), currentTool && (_jsx(ToolStatus, { tool: currentTool, status: toolStatus || "running" })), error && (_jsx(Box, { marginY: 1, children: _jsxs(Text, { color: "red", children: ["\u26A0 ", error] }) })), exitPending && (_jsx(Box, { marginY: 1, children: _jsx(Text, { color: "yellow", children: "Press Ctrl+C again to exit" }) })), _jsx(InputBox, { value: input, onChange: setInput, onSubmit: handleSubmit, isProcessing: isProcessing, placeholder: "Type your message..." }), _jsx(StatusBar, { model:
|
|
194
|
+
return (_jsxs(Box, { flexDirection: "column", height: "100%", children: [_jsx(Box, { flexDirection: "column", flexGrow: 1, children: _jsx(MessageList, { messages: messages }) }), currentTool && (_jsx(ToolStatus, { tool: currentTool, status: toolStatus || "running" })), error && (_jsx(Box, { marginY: 1, children: _jsxs(Text, { color: "red", children: ["\u26A0 ", error] }) })), exitPending && (_jsx(Box, { marginY: 1, children: _jsx(Text, { color: "yellow", children: "Press Ctrl+C again to exit" }) })), _jsx(InputBox, { value: input, onChange: setInput, onSubmit: handleSubmit, isProcessing: isProcessing, placeholder: "Type your message..." }), _jsx(StatusBar, { model: currentModel, isProcessing: isProcessing, messageCount: messages.length })] }));
|
|
166
195
|
}
|
|
167
196
|
//# sourceMappingURL=App.js.map
|
package/dist/ui/App.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.js","sourceRoot":"","sources":["../../src/ui/App.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAElD,OAAO,EAAE,YAAY,EAAe,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAc,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAkBxD,MAAM,UAAU,GAAG,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAY;IAC7D,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAY,EAAE,CAAC,CAAC;IACxD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACvC,MAAM,CAAC,YAAY,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AU,IAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,IAAI,SAAS,GAAI,CACnE,EAGA,KAAK,IAAI,CACR,KAAC,GAAG,IAAC,OAAO,EAAE,CAAC,YACb,MAAC,IAAI,IAAC,KAAK,EAAC,KAAK,wBAAI,KAAK,IAAQ,GAC9B,CACP,EAGA,WAAW,IAAI,CACd,KAAC,GAAG,IAAC,OAAO,EAAE,CAAC,YACb,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,2CAAkC,GAClD,CACP,EAGD,KAAC,QAAQ,IACP,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAC,sBAAsB,GAClC,EAGF,KAAC,SAAS,IACR,KAAK,EAAE,YAAY,EACnB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,QAAQ,CAAC,MAAM,GAC7B,IACE,CACP,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Config, loadConfig, saveConfig } from "./config.js";
|
|
2
|
+
|
|
3
|
+
export interface SlashCommandResult {
|
|
4
|
+
output?: string;
|
|
5
|
+
exit?: boolean;
|
|
6
|
+
clear?: boolean;
|
|
7
|
+
changeModel?: string;
|
|
8
|
+
showHelp?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type CommandHandler = (args: string[], config: Config) => SlashCommandResult;
|
|
12
|
+
|
|
13
|
+
const HELP_MESSAGE = `
|
|
14
|
+
ACTIVO - AI 코드 품질 분석 도구
|
|
15
|
+
|
|
16
|
+
[슬래시 커맨드]
|
|
17
|
+
/help 이 도움말 표시
|
|
18
|
+
/exit, /quit 종료
|
|
19
|
+
/clear 채팅 기록 삭제
|
|
20
|
+
/model <name> 모델 변경 (예: /model qwen2.5:7b)
|
|
21
|
+
/info 현재 설정 정보 표시
|
|
22
|
+
|
|
23
|
+
[단축키]
|
|
24
|
+
Enter 메시지 전송
|
|
25
|
+
ESC 진행 중 작업 취소
|
|
26
|
+
Ctrl+C x2 종료
|
|
27
|
+
|
|
28
|
+
[사용 예시]
|
|
29
|
+
"src 폴더 구조 보여줘"
|
|
30
|
+
"package.json 분석해줘"
|
|
31
|
+
"코드 품질 검사해줘"
|
|
32
|
+
"PDF를 마크다운으로 변환해줘"
|
|
33
|
+
`.trim();
|
|
34
|
+
|
|
35
|
+
const commandHandlers: Record<string, CommandHandler> = {
|
|
36
|
+
help: () => ({
|
|
37
|
+
output: HELP_MESSAGE,
|
|
38
|
+
showHelp: true,
|
|
39
|
+
}),
|
|
40
|
+
|
|
41
|
+
exit: () => ({
|
|
42
|
+
exit: true,
|
|
43
|
+
output: "Goodbye!",
|
|
44
|
+
}),
|
|
45
|
+
|
|
46
|
+
quit: () => ({
|
|
47
|
+
exit: true,
|
|
48
|
+
output: "Goodbye!",
|
|
49
|
+
}),
|
|
50
|
+
|
|
51
|
+
clear: () => ({
|
|
52
|
+
clear: true,
|
|
53
|
+
output: "채팅 기록이 삭제되었습니다.",
|
|
54
|
+
}),
|
|
55
|
+
|
|
56
|
+
model: (args, config) => {
|
|
57
|
+
if (args.length === 0) {
|
|
58
|
+
return {
|
|
59
|
+
output: `현재 모델: ${config.ollama.model}\n\n사용법: /model <model_name>\n예시: /model qwen2.5:7b`,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const newModel = args[0];
|
|
64
|
+
config.ollama.model = newModel;
|
|
65
|
+
saveConfig(config);
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
changeModel: newModel,
|
|
69
|
+
output: `모델이 "${newModel}"로 변경되었습니다.`,
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
info: (args, config) => {
|
|
74
|
+
const info = `
|
|
75
|
+
[ACTIVO 정보]
|
|
76
|
+
버전: 0.2.1
|
|
77
|
+
|
|
78
|
+
[Ollama 설정]
|
|
79
|
+
URL: ${config.ollama.baseUrl}
|
|
80
|
+
모델: ${config.ollama.model}
|
|
81
|
+
컨텍스트: ${config.ollama.contextLength}
|
|
82
|
+
|
|
83
|
+
[표준 디렉토리]
|
|
84
|
+
${config.standards.directory}
|
|
85
|
+
`.trim();
|
|
86
|
+
|
|
87
|
+
return { output: info };
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export function handleSlashCommand(
|
|
92
|
+
input: string,
|
|
93
|
+
config: Config
|
|
94
|
+
): SlashCommandResult | null {
|
|
95
|
+
// "/" 로 시작하지 않으면 null 반환
|
|
96
|
+
if (!input.startsWith("/")) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// 파싱: "/" 제거 후 공백으로 분할
|
|
101
|
+
const trimmed = input.slice(1).trim();
|
|
102
|
+
const [command, ...args] = trimmed.split(/\s+/);
|
|
103
|
+
|
|
104
|
+
if (!command) {
|
|
105
|
+
return { output: "명령어를 입력하세요. /help 로 도움말을 확인하세요." };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const handler = commandHandlers[command.toLowerCase()];
|
|
109
|
+
if (handler) {
|
|
110
|
+
return handler(args, config);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return { output: `알 수 없는 명령어: /${command}\n/help 로 사용 가능한 명령어를 확인하세요.` };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function getAvailableCommands(): string[] {
|
|
117
|
+
return Object.keys(commandHandlers);
|
|
118
|
+
}
|
package/src/ui/App.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { Box, Text, useApp, useInput } from "ink";
|
|
|
3
3
|
import { Config } from "../core/config.js";
|
|
4
4
|
import { OllamaClient, ChatMessage } from "../core/llm/ollama.js";
|
|
5
5
|
import { streamProcessMessage, AgentEvent } from "../core/agent.js";
|
|
6
|
+
import { handleSlashCommand } from "../core/commands.js";
|
|
6
7
|
import { InputBox } from "./components/InputBox.js";
|
|
7
8
|
import { MessageList } from "./components/MessageList.js";
|
|
8
9
|
import { StatusBar } from "./components/StatusBar.js";
|
|
@@ -33,6 +34,7 @@ export function App({ initialPrompt, config, resume }: AppProps): React.ReactEle
|
|
|
33
34
|
const [toolStatus, setToolStatus] = useState<"running" | "complete" | "error" | null>(null);
|
|
34
35
|
const [error, setError] = useState<string | null>(null);
|
|
35
36
|
const [client] = useState(() => new OllamaClient(config.ollama));
|
|
37
|
+
const [currentModel, setCurrentModel] = useState(config.ollama.model);
|
|
36
38
|
const [exitPending, setExitPending] = useState(false);
|
|
37
39
|
const [cancelled, setCancelled] = useState(false);
|
|
38
40
|
const abortControllerRef = useRef<AbortController | null>(null);
|
|
@@ -93,8 +95,42 @@ export function App({ initialPrompt, config, resume }: AppProps): React.ReactEle
|
|
|
93
95
|
if (!text.trim() || isProcessing) return;
|
|
94
96
|
|
|
95
97
|
setInput("");
|
|
96
|
-
setIsProcessing(true);
|
|
97
98
|
setError(null);
|
|
99
|
+
|
|
100
|
+
// Handle slash commands first
|
|
101
|
+
if (text.startsWith("/")) {
|
|
102
|
+
const result = handleSlashCommand(text, config);
|
|
103
|
+
if (result) {
|
|
104
|
+
// Add command as user message
|
|
105
|
+
setMessages((prev) => [...prev, { role: "user", content: text }]);
|
|
106
|
+
|
|
107
|
+
if (result.exit) {
|
|
108
|
+
const exitMsg: Message = { role: "assistant", content: result.output || "Goodbye!" };
|
|
109
|
+
setMessages((prev) => [...prev, exitMsg]);
|
|
110
|
+
setTimeout(() => exit(), 500);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (result.clear) {
|
|
115
|
+
setMessages([]);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (result.changeModel) {
|
|
120
|
+
setCurrentModel(result.changeModel);
|
|
121
|
+
client.setModel(result.changeModel);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (result.output) {
|
|
125
|
+
const outputMsg: Message = { role: "assistant", content: result.output };
|
|
126
|
+
setMessages((prev) => [...prev, outputMsg]);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
setIsProcessing(true);
|
|
98
134
|
setCancelled(false);
|
|
99
135
|
|
|
100
136
|
// Create AbortController for this request
|
|
@@ -229,7 +265,7 @@ export function App({ initialPrompt, config, resume }: AppProps): React.ReactEle
|
|
|
229
265
|
|
|
230
266
|
{/* Status Bar */}
|
|
231
267
|
<StatusBar
|
|
232
|
-
model={
|
|
268
|
+
model={currentModel}
|
|
233
269
|
isProcessing={isProcessing}
|
|
234
270
|
messageCount={messages.length}
|
|
235
271
|
/>
|