@nhonh/qabot 0.2.1 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nhonh/qabot",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "AI-powered universal QA automation tool. Import any project, AI analyzes and runs tests across all layers.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -9,7 +9,7 @@ export class AIEngine {
9
9
  constructor(config = {}) {
10
10
  this.provider = config.provider || "none";
11
11
  this.model =
12
- config.model || AI_PROVIDER_DEFAULTS[this.provider]?.model || "gpt-4o";
12
+ config.model ?? AI_PROVIDER_DEFAULTS[this.provider]?.model ?? "";
13
13
  this.apiKey = resolveApiKey(config);
14
14
  this.baseUrl =
15
15
  config.baseUrl || AI_PROVIDER_DEFAULTS[this.provider]?.baseUrl || "";
@@ -29,6 +29,7 @@ export class AIEngine {
29
29
  isAvailable() {
30
30
  if (this.provider === "none") return false;
31
31
  if (this.provider === "ollama") return true;
32
+ if (this.provider === "proxy") return !!this.baseUrl;
32
33
  return !!this.apiKey;
33
34
  }
34
35
 
@@ -184,21 +185,23 @@ export class AIEngine {
184
185
  async callProxy(prompt) {
185
186
  if (!this.baseUrl) {
186
187
  throw new Error(
187
- "Proxy provider requires baseUrl. Set ai.baseUrl in qabot.config.js",
188
+ "Proxy provider requires baseUrl. Set ai.baseUrl in qabot.config.json",
188
189
  );
189
190
  }
190
191
 
191
192
  const headers = this.buildAuthHeaders();
192
193
 
194
+ const body = {
195
+ messages: [{ role: "user", content: prompt }],
196
+ temperature: this.temperature,
197
+ max_tokens: this.maxTokens,
198
+ };
199
+ if (this.model) body.model = this.model;
200
+
193
201
  const res = await fetch(this.baseUrl, {
194
202
  method: "POST",
195
203
  headers,
196
- body: JSON.stringify({
197
- model: this.model,
198
- messages: [{ role: "user", content: prompt }],
199
- temperature: this.temperature,
200
- max_tokens: this.maxTokens,
201
- }),
204
+ body: JSON.stringify(body),
202
205
  });
203
206
  if (!res.ok) {
204
207
  const body = await res.text().catch(() => "");
@@ -147,7 +147,7 @@ async function interactiveSetup(projectDir, config, isEmpty) {
147
147
  ]);
148
148
 
149
149
  aiConfig.baseUrl = proxyAnswers.baseUrl;
150
- if (proxyAnswers.model) aiConfig.model = proxyAnswers.model;
150
+ aiConfig.model = proxyAnswers.model || "";
151
151
 
152
152
  if (proxyAnswers.authMethod === "bearer") {
153
153
  aiConfig.authHeader = "Authorization";
@@ -1,4 +1,4 @@
1
- export const VERSION = "0.2.1";
1
+ export const VERSION = "0.2.3";
2
2
  export const TOOL_NAME = "qabot";
3
3
 
4
4
  export const PROJECT_TYPES = [