Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/constants.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,3 +8,8 @@
* - Higher values favour TF-IDF scoring (better semantic matching)
*/
export const DEFAULT_HYBRID_ALPHA = 0.2;

/**
* Default base URL for StackOne API
*/
export const DEFAULT_BASE_URL = 'https://api.stackone.com';
1 change: 1 addition & 0 deletions src/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@
* StackOne AI Node.js SDK
*/

export { DEFAULT_BASE_URL } from './constants';
export { BaseTool, StackOneTool, Tools } from './tool';
export { createFeedbackTool } from './tools/feedback';
export { StackOneAPIError, StackOneError } from './utils/errors';
Expand Down
5 changes: 3 additions & 2 deletions src/tools/feedback.ts
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
import { z } from 'zod';
import { DEFAULT_BASE_URL } from '../constants';
import { BaseTool } from '../tool';
import type { ExecuteConfig, ExecuteOptions, JsonDict, ToolParameters } from '../types';
import { StackOneError } from '../utils/errors';
Expand DownExpand Up@@ -39,7 +40,7 @@ const feedbackInputSchema = z.object({
export function createFeedbackTool(
apiKey?: string,
accountId?: string,
baseUrl = 'https://api.stackone.com'
baseUrl = DEFAULT_BASE_URL
): BaseTool {
const options: FeedbackToolOptions = {
apiKey,
Expand DownExpand Up@@ -102,7 +103,7 @@ export function createFeedbackTool(
}

const tool = new BaseTool(name, description, parameters, executeConfig, authHeaders);
const resolvedBaseUrl = options.baseUrl || 'https://api.stackone.com';
const resolvedBaseUrl = options.baseUrl ?? DEFAULT_BASE_URL;

tool.execute = async function (
this: BaseTool,
Expand Down
3 changes: 2 additions & 1 deletion src/toolsets/stackone.ts
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
import { DEFAULT_BASE_URL } from '../constants';
import { type StackOneTool, Tools } from '../tool';
import { createFeedbackTool } from '../tools/feedback';
import { type BaseToolSetConfig, ToolSet, ToolSetConfigError } from './base';
Expand DownExpand Up@@ -94,7 +95,7 @@ export class StackOneToolSet extends ToolSet {

// Initialise base class
super({
baseUrl: config?.baseUrl,
baseUrl: config?.baseUrl ?? process.env.STACKONE_BASE_URL ?? DEFAULT_BASE_URL,
authentication,
headers,
});
Expand Down