s9n-devops-agent 2.0.18-dev.4 → 2.0.18-dev.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/agent-chat.js +17 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "s9n-devops-agent",
3
- "version": "2.0.18-dev.4",
3
+ "version": "2.0.18-dev.5",
4
4
  "description": "CS_DevOpsAgent - Intelligent Git Automation System with multi-agent support and session management",
5
5
  "type": "module",
6
6
  "main": "src/cs-devops-agent-worker.js",
package/src/agent-chat.js CHANGED
@@ -51,9 +51,14 @@ const CONFIG = {
51
51
 
52
52
  class SmartAssistant {
53
53
  constructor() {
54
- this.groq = new Groq({
55
- apiKey: process.env.GROQ_API_KEY || process.env.OPENAI_API_KEY
56
- });
54
+ // Initialize Groq client lazily or with null if key is missing
55
+ const apiKey = process.env.GROQ_API_KEY || process.env.OPENAI_API_KEY;
56
+
57
+ if (apiKey) {
58
+ this.groq = new Groq({ apiKey });
59
+ } else {
60
+ this.groq = null; // Will be initialized in start()
61
+ }
57
62
 
58
63
  this.history = [];
59
64
  this.repoRoot = process.cwd();
@@ -125,8 +130,16 @@ When you want to perform an action, use the available tools.`;
125
130
  * Initialize the chat session
126
131
  */
127
132
  async start() {
133
+ // Ensure Groq client is initialized
134
+ if (!this.groq) {
135
+ const apiKey = credentialsManager.getGroqApiKey();
136
+ if (apiKey) {
137
+ this.groq = new Groq({ apiKey });
138
+ }
139
+ }
140
+
128
141
  // Check for Groq API Key
129
- if (!credentialsManager.hasGroqApiKey()) {
142
+ if (!this.groq && !credentialsManager.hasGroqApiKey()) {
130
143
  console.log('\n' + '='.repeat(60));
131
144
  console.log(`${CONFIG.colors.yellow}⚠️ GROQ API KEY MISSING${CONFIG.colors.reset}`);
132
145
  console.log('='.repeat(60));