fix: adjust waiting message
This commit is contained in:
parent
c8945adb85
commit
454df15545
1 changed files with 5 additions and 9 deletions
|
|
@ -3,7 +3,7 @@ import { Box, Text, useApp } from "ink";
|
||||||
import { ChatCompletionMessageParam } from "openai/resources.mjs";
|
import { ChatCompletionMessageParam } from "openai/resources.mjs";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { handleSlashCommands } from "../slashCommands.js";
|
import { handleSlashCommands } from "../slashCommands.js";
|
||||||
import { streamChatResponse, StreamCallbacks } from "../streamChatResponse.js";
|
import { StreamCallbacks, streamChatResponse } from "../streamChatResponse.js";
|
||||||
import UserInput from "./UserInput.js";
|
import UserInput from "./UserInput.js";
|
||||||
|
|
||||||
interface TUIChatProps {
|
interface TUIChatProps {
|
||||||
|
|
@ -112,10 +112,7 @@ const TUIChat: React.FC<TUIChatProps> = ({
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
onToolResult: (result: string) => {
|
onToolResult: (result: string) => {
|
||||||
setMessages((prev) => [
|
setMessages((prev) => [...prev, { role: "system", content: result }]);
|
||||||
...prev,
|
|
||||||
{ role: "system", content: result },
|
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
onToolError: (error: string) => {
|
onToolError: (error: string) => {
|
||||||
setMessages((prev) => [
|
setMessages((prev) => [
|
||||||
|
|
@ -155,7 +152,6 @@ const TUIChat: React.FC<TUIChatProps> = ({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const renderMessage = (message: DisplayMessage, index: number) => {
|
const renderMessage = (message: DisplayMessage, index: number) => {
|
||||||
const isUser = message.role === "user";
|
const isUser = message.role === "user";
|
||||||
const isSystem = message.role === "system";
|
const isSystem = message.role === "system";
|
||||||
|
|
@ -193,10 +189,10 @@ const TUIChat: React.FC<TUIChatProps> = ({
|
||||||
{/* Status */}
|
{/* Status */}
|
||||||
{isWaitingForResponse && (
|
{isWaitingForResponse && (
|
||||||
<Box paddingX={1}>
|
<Box paddingX={1}>
|
||||||
<Text color="yellow">Waiting for response...</Text>
|
<Text color="gray">esc to interrupt</Text>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Input area - always at bottom */}
|
{/* Input area - always at bottom */}
|
||||||
<UserInput
|
<UserInput
|
||||||
onSubmit={handleUserMessage}
|
onSubmit={handleUserMessage}
|
||||||
|
|
@ -208,4 +204,4 @@ const TUIChat: React.FC<TUIChatProps> = ({
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default TUIChat;
|
export default TUIChat;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue