@team-semicolon/semo-cli 4.0.1 → 4.0.3
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/database.js +2 -3
- package/dist/index.js +16 -11
- package/dist/kb.d.ts +2 -2
- package/dist/kb.js +11 -11
- package/package.json +1 -1
package/dist/database.js
CHANGED
|
@@ -45,12 +45,11 @@ function buildDbConfig() {
|
|
|
45
45
|
idleTimeoutMillis: 30000,
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
// PostgreSQL Pool (싱글톤)
|
|
48
|
+
// PostgreSQL Pool (싱글톤) — 최초 getPool() 호출 시점에 config 평가
|
|
50
49
|
let pool = null;
|
|
51
50
|
function getPool() {
|
|
52
51
|
if (!pool) {
|
|
53
|
-
pool = new pg_1.Pool(
|
|
52
|
+
pool = new pg_1.Pool(buildDbConfig());
|
|
54
53
|
}
|
|
55
54
|
return pool;
|
|
56
55
|
}
|
package/dist/index.js
CHANGED
|
@@ -1193,15 +1193,20 @@ function verifyInstallation(cwd, installedExtensions = []) {
|
|
|
1193
1193
|
if (fs.existsSync(claudeAgentsDir)) {
|
|
1194
1194
|
for (const agent of expectedAgents) {
|
|
1195
1195
|
const linkPath = path.join(claudeAgentsDir, agent);
|
|
1196
|
-
|
|
1197
|
-
if (
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1196
|
+
try {
|
|
1197
|
+
if (fs.existsSync(linkPath) || fs.lstatSync(linkPath).isSymbolicLink()) {
|
|
1198
|
+
if (isSymlinkValid(linkPath)) {
|
|
1199
|
+
result.stats.agents.linked++;
|
|
1200
|
+
}
|
|
1201
|
+
else {
|
|
1202
|
+
result.stats.agents.broken++;
|
|
1203
|
+
result.warnings.push(`깨진 링크: .claude/agents/${agent}`);
|
|
1204
|
+
}
|
|
1203
1205
|
}
|
|
1204
1206
|
}
|
|
1207
|
+
catch {
|
|
1208
|
+
// path doesn't exist at all — skip
|
|
1209
|
+
}
|
|
1205
1210
|
}
|
|
1206
1211
|
}
|
|
1207
1212
|
}
|
|
@@ -2644,14 +2649,14 @@ kbCmd
|
|
|
2644
2649
|
});
|
|
2645
2650
|
kbCmd
|
|
2646
2651
|
.command("embed")
|
|
2647
|
-
.description("기존 KB 항목에 임베딩 벡터 생성 (
|
|
2652
|
+
.description("기존 KB 항목에 임베딩 벡터 생성 (OPENAI_API_KEY 필요)")
|
|
2648
2653
|
.option("--bot <name>", "봇 KB도 임베딩", detectBotId())
|
|
2649
2654
|
.option("--domain <name>", "도메인 필터")
|
|
2650
2655
|
.option("--force", "이미 임베딩된 항목도 재생성")
|
|
2651
2656
|
.action(async (options) => {
|
|
2652
|
-
if (!process.env.
|
|
2653
|
-
console.log(chalk_1.default.red("❌
|
|
2654
|
-
console.log(chalk_1.default.gray(" export
|
|
2657
|
+
if (!process.env.OPENAI_API_KEY) {
|
|
2658
|
+
console.log(chalk_1.default.red("❌ OPENAI_API_KEY 환경변수가 설정되지 않았습니다."));
|
|
2659
|
+
console.log(chalk_1.default.gray(" export OPENAI_API_KEY='sk-...'"));
|
|
2655
2660
|
process.exit(1);
|
|
2656
2661
|
}
|
|
2657
2662
|
const spinner = (0, ora_1.default)("임베딩 대상 조회 중...").start();
|
package/dist/kb.d.ts
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { Pool } from "pg";
|
|
11
11
|
/**
|
|
12
|
-
* Generate embedding vector for text using OpenAI API
|
|
12
|
+
* Generate embedding vector for text using OpenAI Embeddings API
|
|
13
13
|
* Requires OPENAI_API_KEY environment variable
|
|
14
14
|
*/
|
|
15
15
|
export declare function generateEmbedding(text: string): Promise<number[] | null>;
|
|
16
16
|
/**
|
|
17
|
-
* Generate embeddings for multiple texts (
|
|
17
|
+
* Generate embeddings for multiple texts (OpenAI는 단건 처리, 순차 호출)
|
|
18
18
|
*/
|
|
19
19
|
export declare function generateEmbeddings(texts: string[]): Promise<(number[] | null)[]>;
|
|
20
20
|
export interface KBEntry {
|
package/dist/kb.js
CHANGED
|
@@ -59,18 +59,18 @@ const path = __importStar(require("path"));
|
|
|
59
59
|
// ============================================================
|
|
60
60
|
// Embedding
|
|
61
61
|
// ============================================================
|
|
62
|
-
const EMBEDDING_MODEL = "
|
|
63
|
-
const EMBEDDING_DIMENSIONS = 1024;
|
|
62
|
+
const EMBEDDING_MODEL = "text-embedding-3-small";
|
|
63
|
+
const EMBEDDING_DIMENSIONS = 1024; // DB vector(1024) 유지 — OpenAI dimensions 파라미터로 축소
|
|
64
64
|
/**
|
|
65
|
-
* Generate embedding vector for text using OpenAI API
|
|
65
|
+
* Generate embedding vector for text using OpenAI Embeddings API
|
|
66
66
|
* Requires OPENAI_API_KEY environment variable
|
|
67
67
|
*/
|
|
68
68
|
async function generateEmbedding(text) {
|
|
69
|
-
const apiKey = process.env.
|
|
69
|
+
const apiKey = process.env.OPENAI_API_KEY;
|
|
70
70
|
if (!apiKey)
|
|
71
71
|
return null;
|
|
72
72
|
try {
|
|
73
|
-
const response = await fetch("https://api.
|
|
73
|
+
const response = await fetch("https://api.openai.com/v1/embeddings", {
|
|
74
74
|
method: "POST",
|
|
75
75
|
headers: {
|
|
76
76
|
"Authorization": `Bearer ${apiKey}`,
|
|
@@ -78,7 +78,7 @@ async function generateEmbedding(text) {
|
|
|
78
78
|
},
|
|
79
79
|
body: JSON.stringify({
|
|
80
80
|
model: EMBEDDING_MODEL,
|
|
81
|
-
input: text.substring(0, 8000),
|
|
81
|
+
input: text.substring(0, 8000),
|
|
82
82
|
dimensions: EMBEDDING_DIMENSIONS,
|
|
83
83
|
}),
|
|
84
84
|
});
|
|
@@ -96,14 +96,14 @@ async function generateEmbedding(text) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
|
-
* Generate embeddings for multiple texts (
|
|
99
|
+
* Generate embeddings for multiple texts (OpenAI는 단건 처리, 순차 호출)
|
|
100
100
|
*/
|
|
101
101
|
async function generateEmbeddings(texts) {
|
|
102
|
-
const apiKey = process.env.
|
|
102
|
+
const apiKey = process.env.OPENAI_API_KEY;
|
|
103
103
|
if (!apiKey)
|
|
104
104
|
return texts.map(() => null);
|
|
105
105
|
try {
|
|
106
|
-
const response = await fetch("https://api.
|
|
106
|
+
const response = await fetch("https://api.openai.com/v1/embeddings", {
|
|
107
107
|
method: "POST",
|
|
108
108
|
headers: {
|
|
109
109
|
"Authorization": `Bearer ${apiKey}`,
|
|
@@ -111,8 +111,8 @@ async function generateEmbeddings(texts) {
|
|
|
111
111
|
},
|
|
112
112
|
body: JSON.stringify({
|
|
113
113
|
model: EMBEDDING_MODEL,
|
|
114
|
-
input: texts.map(t => t.substring(0,
|
|
115
|
-
|
|
114
|
+
input: texts.map(t => t.substring(0, 8000)),
|
|
115
|
+
dimensions: EMBEDDING_DIMENSIONS,
|
|
116
116
|
}),
|
|
117
117
|
});
|
|
118
118
|
if (!response.ok)
|