log errors from headless mode if fatal
This commit is contained in:
parent
e1985fe830
commit
9f1e7293f4
6 changed files with 9 additions and 38 deletions
|
|
@ -3,6 +3,7 @@ import { ChatCompletionMessageParam } from "openai/resources.mjs";
|
|||
import * as readlineSync from "readline-sync";
|
||||
import { CONTINUE_ASCII_ART } from "../asciiArt.js";
|
||||
import { configureLogger } from "../logger.js";
|
||||
import * as logging from "../logging.js";
|
||||
import { loadSession, saveSession } from "../session.js";
|
||||
import { initializeServices } from "../services/index.js";
|
||||
import { serviceContainer } from "../services/ServiceContainer.js";
|
||||
|
|
@ -138,6 +139,9 @@ async function runHeadlessMode(
|
|||
export async function chat(prompt?: string, options: ChatOptions = {}) {
|
||||
// Configure logger based on headless mode
|
||||
configureLogger(options.headless ?? false);
|
||||
|
||||
// Configure headless-aware logging system
|
||||
logging.configureLogger({ headless: options.headless ?? false });
|
||||
|
||||
try {
|
||||
// Record session start
|
||||
|
|
@ -157,10 +161,11 @@ export async function chat(prompt?: string, options: ChatOptions = {}) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Run headless mode with old initialization pattern
|
||||
// Run headless mode
|
||||
await runHeadlessMode(prompt, options);
|
||||
} catch (error: any) {
|
||||
logger.error(chalk.red(`Fatal error: ${formatError(error)}`));
|
||||
// Use headless-aware error logging to ensure fatal errors are shown in headless mode
|
||||
logging.error(chalk.red(`Fatal error: ${formatError(error)}`));
|
||||
process.exit(1);
|
||||
} finally {
|
||||
// Stop active time tracking
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
import React from "react";
|
||||
import { render } from "ink-testing-library";
|
||||
import type { ChatCompletionMessageParam } from "openai/resources/index.js";
|
||||
import type { BaseLlmApi } from "@continuedev/openai-adapters";
|
||||
import type { AssistantUnrolled } from "@continuedev/config-yaml";
|
||||
import TUIChat from "./TUIChat.js";
|
||||
import type { MCPService } from "../mcp.js";
|
||||
import { jest } from "@jest/globals";
|
||||
|
||||
// Skip these tests for now - they require complex mocking setup
|
||||
describe.skip("TUIChat - Advanced Component Tests", () => {
|
||||
it("placeholder test", () => {
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
});
|
||||
|
|
@ -4,7 +4,6 @@ import "./__tests__/TUIChat.messages.test.js";
|
|||
import "./__tests__/TUIChat.input.test.js";
|
||||
import "./__tests__/TUIChat.fileSearch.test.js";
|
||||
import "./__tests__/TUIChat.slashCommands.test.js";
|
||||
import "./TUIChat.advanced.test.js";
|
||||
|
||||
// Add a dummy test to satisfy Jest
|
||||
describe("TUIChat Test Suite", () => {
|
||||
|
|
|
|||
|
|
@ -135,10 +135,7 @@ const TUIChat: React.FC<TUIChatProps> = ({
|
|||
showOrganizationSelector,
|
||||
} = useOrganizationSelector({
|
||||
configPath,
|
||||
onAssistantChange: (newAssistant, newModel, newLlmApi, newMcpService) => {
|
||||
// These will be updated automatically by the service system
|
||||
// We just need to trigger a reload which will cause services to update
|
||||
},
|
||||
onAssistantChange: (newAssistant, newModel, newLlmApi, newMcpService) => {},
|
||||
onMessage: (message) => {
|
||||
setMessages((prev) => [...prev, message]);
|
||||
},
|
||||
|
|
@ -152,10 +149,7 @@ const TUIChat: React.FC<TUIChatProps> = ({
|
|||
showConfigSelectorUI,
|
||||
} = useConfigSelector({
|
||||
configPath,
|
||||
onAssistantChange: (newAssistant, newModel, newLlmApi, newMcpService) => {
|
||||
// These will be updated automatically by the service system
|
||||
// We just need to trigger a reload which will cause services to update
|
||||
},
|
||||
onAssistantChange: (newAssistant, newModel, newLlmApi, newMcpService) => {},
|
||||
onMessage: (message) => {
|
||||
setMessages((prev) => [...prev, message]);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
// This file has been removed - functionality merged into TUIChat.messages.test.tsx
|
||||
describe('placeholder', () => {
|
||||
it('exists', () => {
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
// This file has been removed - tests migrated to TUIChat.messages.test.tsx
|
||||
describe('placeholder', () => {
|
||||
it('exists', () => {
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue