@lexicallayer/cli 0.1.4 → 0.1.5
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/index.js +37 -1
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -95,8 +95,44 @@ async function calibrate() {
|
|
|
95
95
|
const verifyRes = await requestJSON(`${ENGINE_BASE_URL}/api/session/verify/${sessionId}`);
|
|
96
96
|
if (verifyRes?.session?.approved) {
|
|
97
97
|
approved = true;
|
|
98
|
+
const adapterFile = verifyRes.session.adapter_filename || "user_steered_rank16.safetensors";
|
|
98
99
|
log("\n\x1b[32m✓ Başarılı! Kullanıcı Studio üzerinden ağırlıkları onayladı ve kilitledi.\x1b[0m");
|
|
99
|
-
log(`Bağlanan Adaptör: \x1b[36m${
|
|
100
|
+
log(`Bağlanan Adaptör: \x1b[36m${adapterFile}\x1b[0m`);
|
|
101
|
+
|
|
102
|
+
// Generate a ready-to-use Agent Layer file directly in the developer's project
|
|
103
|
+
const fs = require("fs");
|
|
104
|
+
const path = require("path");
|
|
105
|
+
const targetDir = path.join(process.cwd(), ".lexicallayer");
|
|
106
|
+
|
|
107
|
+
if (!fs.existsSync(targetDir)) {
|
|
108
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const agentLayerCode = `// Otomatik Üretilen LexicalLayer Agent Katmanı
|
|
112
|
+
const { LexicalLayer } = require("@lexicallayer/sdk");
|
|
113
|
+
|
|
114
|
+
const layer = new LexicalLayer({
|
|
115
|
+
agentName: "${sessionPayload.agent_name}",
|
|
116
|
+
adapterFile: "${adapterFile}"
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Bu fonksiyonu agent'ınızın OpenAI/Claude/LangChain client'ına sarın:
|
|
121
|
+
* const steeredOpenAI = wrapAgentWithUserStyle(openai);
|
|
122
|
+
*/
|
|
123
|
+
function wrapAgentWithUserStyle(agentClient) {
|
|
124
|
+
return layer.wrapOpenAI(agentClient);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
module.exports = { layer, wrapAgentWithUserStyle };
|
|
128
|
+
`;
|
|
129
|
+
fs.writeFileSync(path.join(targetDir, "layer.js"), agentLayerCode, "utf-8");
|
|
130
|
+
|
|
131
|
+
console.log(`\n\x1b[35m[LexicalLayer Entegrasyonu Tamamlandı]\x1b[0m`);
|
|
132
|
+
console.log(`📂 Projenize katman dosyası eklendi: \x1b[33m.lexicallayer/layer.js\x1b[0m`);
|
|
133
|
+
console.log(`\n\x1b[32mAgent'ınızda Kullanmak İçin Tek Satır:\x1b[0m`);
|
|
134
|
+
console.log(`\x1b[36mconst { wrapAgentWithUserStyle } = require("./.lexicallayer/layer");\x1b[0m`);
|
|
135
|
+
console.log(`\x1b[36mconst myAgent = wrapAgentWithUserStyle(openai);\x1b[0m\n`);
|
|
100
136
|
log("\x1b[32mAgent'ınız artık kullanıcının özgün üslubu ve ağırlıkları ile çalışmaya hazır!\x1b[0m");
|
|
101
137
|
process.exit(0);
|
|
102
138
|
}
|