Skip to content

Commit

Permalink
Rename throwing head
Browse files Browse the repository at this point in the history
  • Loading branch information
enricoros committed Dec 30, 2024
1 parent 8584a56 commit ec9243b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/apps/chat/AppChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export function AppChat() {
if (!focusedPaneConversationId) return;
const cHandler = ConversationsManager.getHandler(focusedPaneConversationId);
if (!cHandler.isValid()) return;
const inputHistory = cHandler.historyViewHead('chat-beam-shortcut');
const inputHistory = cHandler.historyViewHeadOrThrow('chat-beam-shortcut');
if (!inputHistory.length) return;

// TODO: replace the Persona and Auto-Cache-hint in the history?
Expand Down
2 changes: 1 addition & 1 deletion src/apps/chat/components/ChatMessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function ChatMessageList(props: {
const handleMessageBeam = React.useCallback(async (messageId: DMessageId) => {
// Message option menu Beam
if (!conversationId || !props.conversationHandler || !props.conversationHandler.isValid()) return;
const inputHistory = props.conversationHandler.historyViewHead('chat-beam-message');
const inputHistory = props.conversationHandler.historyViewHeadOrThrow('chat-beam-message');
if (!inputHistory.length) return;

// TODO: replace the Persona and Auto-Cache-hint in the history?
Expand Down
4 changes: 2 additions & 2 deletions src/apps/chat/editors/_handleExecute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export async function _handleExecute(chatExecuteMode: ChatExecuteMode, conversat

const chatLLMId = getChatLLMId();
const cHandler = ConversationsManager.getHandler(conversationId);
const initialHistory = cHandler.historyViewHead('chat-execute-' + executeCallerNameDebug) as Readonly<DMessage[]>;
const initialHistory = cHandler.historyViewHeadOrThrow('handle-execute-' + executeCallerNameDebug) as Readonly<DMessage[]>;

// Update the system message from the active persona to the history
// NOTE: this does NOT call setMessages anymore (optimization). make sure to:
Expand Down Expand Up @@ -72,7 +72,7 @@ export async function _handleExecute(chatExecuteMode: ChatExecuteMode, conversat
return await runPersonaOnConversationHead(chatLLMId, conversationId);

case 'beam-content':
const updatedInputHistory = cHandler.historyViewHead('chat-beam-execute');
const updatedInputHistory = cHandler.historyViewHeadOrThrow('chat-beam-execute');
cHandler.beamInvoke(updatedInputHistory, [], null);
return true;

Expand Down
2 changes: 1 addition & 1 deletion src/apps/chat/editors/chat-persona.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function runPersonaOnConversationHead(

const cHandler = ConversationsManager.getHandler(conversationId);

const _history = cHandler.historyViewHead('runPersonaOnConversationHead') as Readonly<DMessage[]>;
const _history = cHandler.historyViewHeadOrThrow('runPersonaOnConversationHead') as Readonly<DMessage[]>;
if (_history.length === 0)
return false;

Expand Down
2 changes: 1 addition & 1 deletion src/common/chat-overlay/ConversationHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class ConversationHandler {
_chatStoreActions.historyTruncateToIncluded(this.conversationId, messageId, offset);
}

historyViewHead(scope: string): Readonly<DMessage[]> {
historyViewHeadOrThrow(scope: string): Readonly<DMessage[]> {
const messages = _chatStoreActions.historyView(this.conversationId);
if (messages === undefined)
throw new Error(`allMessages: Conversation not found, ${scope}`);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/aifn/digrams/DiagramsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function DiagramsModal(props: { config: DiagramConfig, onClose: () => voi
setAbortController(stepAbortController);
// cHandler.setAbortController(stepAbortController);

const reChatHistory = cHandler.historyViewHead('diagrams-modal');
const reChatHistory = cHandler.historyViewHeadOrThrow('diagrams-modal');
const { chatSystemInstruction } = splitSystemMessageFromHistory(reChatHistory);
if (!chatSystemInstruction)
return setErrorMessage('No System instruction in this conversation');
Expand Down

0 comments on commit ec9243b

Please sign in to comment.