Skip to content
Merged
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 → src/consts.ts
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
/**
* Default base URL for StackOne API
*/
export const DEFAULT_BASE_URL = 'https://api.stackone.com';
Comment on lines +1 to +4

CopilotAIDec 9, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new file is named consts.ts, but there's already an existing constants.ts file in the same directory (containing DEFAULT_HYBRID_ALPHA). For consistency, consider either:

  1. Adding DEFAULT_BASE_URL to the existing constants.ts file instead of creating a new consts.ts file, or
  2. Renaming this file to match the existing constants.ts naming convention

This would maintain a consistent naming pattern across the codebase.

Suggested change
/**
*DefaultbaseURLforStackOneAPI
*/
exportconstDEFAULT_BASE_URL='https://api.stackone.com';

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply the first solution


/**
* Default weight for BM25 in hybrid BM25 + TF-IDF search.
*
Expand Down
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, DEFAULT_HYBRID_ALPHA } from './consts';
export { BaseTool, StackOneTool, Tools } from './tool';
export { createFeedbackTool } from './tools/feedback';
export { StackOneAPIError, StackOneError } from './utils/errors';
Expand Down
2 changes: 1 addition & 1 deletion src/tool.ts
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import * as orama from '@orama/orama';
import type { ChatCompletionFunctionTool } from 'openai/resources/chat/completions';
import { DEFAULT_HYBRID_ALPHA } from './constants';
import { DEFAULT_HYBRID_ALPHA } from './consts';
import { RequestBuilder } from './modules/requestBuilder';
import type {
AISDKToolDefinition,
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 '../consts';
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 '../consts';
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
Loading