@make-u-free/migi 0.3.5 → 0.3.6
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/bin/migi.js +13 -9
- package/package.json +1 -1
package/bin/migi.js
CHANGED
|
@@ -66,16 +66,18 @@ console.log(chalk.dim(' /exit 終了\n'))
|
|
|
66
66
|
|
|
67
67
|
const agent = new MigiAgent({ context, promptFn, apiKey, model, name: agentName, userName, teamsWebhookUrl })
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
function sep() { return chalk.dim('─'.repeat(process.stdout.columns || 80)) }
|
|
70
70
|
|
|
71
|
-
// ----
|
|
71
|
+
// ---- 複数行入力(空行で送信)----
|
|
72
72
|
async function readMultiLine() {
|
|
73
73
|
const lines = []
|
|
74
|
-
process.stdout.write(chalk.dim(' Enter で改行 / 空行で送信\n'))
|
|
75
74
|
return new Promise((resolve) => {
|
|
76
75
|
const onLine = (line) => {
|
|
77
76
|
if (line === '' && lines.length > 0) {
|
|
78
77
|
rl.removeListener('line', onLine)
|
|
78
|
+
// 入力ボックス下辺 + 欄外ステータス
|
|
79
|
+
console.log(sep())
|
|
80
|
+
console.log(chalk.dim(` ✦ ${model} · Enterで改行 / 空行で送信`))
|
|
79
81
|
resolve(lines.join('\n'))
|
|
80
82
|
} else {
|
|
81
83
|
lines.push(line)
|
|
@@ -89,8 +91,10 @@ async function readMultiLine() {
|
|
|
89
91
|
|
|
90
92
|
// ---- メインループ ----
|
|
91
93
|
async function prompt() {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
// 入力ボックス上辺
|
|
95
|
+
console.log('\n' + sep())
|
|
96
|
+
console.log(chalk.bold.cyan(` ${userName || 'あなた'}`))
|
|
97
|
+
console.log(sep())
|
|
94
98
|
|
|
95
99
|
const input = (await readMultiLine()).trim()
|
|
96
100
|
if (!input) return prompt()
|
|
@@ -135,9 +139,9 @@ async function prompt() {
|
|
|
135
139
|
if (parsed) {
|
|
136
140
|
const skill = resolveSkill(parsed.name, process.cwd())
|
|
137
141
|
if (skill) {
|
|
138
|
-
console.log('\n' +
|
|
142
|
+
console.log('\n' + sep())
|
|
139
143
|
console.log(chalk.bold.cyan(` ${agentName}`) + chalk.dim(` [スキル: ${parsed.name}]`))
|
|
140
|
-
console.log(
|
|
144
|
+
console.log(sep())
|
|
141
145
|
const expanded = expandSkill(skill.content, parsed.args)
|
|
142
146
|
try {
|
|
143
147
|
const reply = await agent.chat(expanded)
|
|
@@ -154,9 +158,9 @@ async function prompt() {
|
|
|
154
158
|
}
|
|
155
159
|
|
|
156
160
|
// --- 通常チャット ---
|
|
157
|
-
console.log('\n' +
|
|
161
|
+
console.log('\n' + sep())
|
|
158
162
|
console.log(chalk.bold.cyan(` ${agentName}`))
|
|
159
|
-
console.log(
|
|
163
|
+
console.log(sep())
|
|
160
164
|
try {
|
|
161
165
|
const reply = await agent.chat(input)
|
|
162
166
|
console.log('\n' + reply + '\n')
|