MP: bifurcate generate-text

This commit is contained in:
Enrico Ros
2024-06-25 01:42:32 -07:00
parent 46887d1d9f
commit 18ef40f6f4
5 changed files with 18 additions and 3 deletions
+1
View File
@@ -57,6 +57,7 @@ export const CHAT_NOVEL_TITLE = 'Chat';
*/
export type ChatModeId =
| 'generate-text'
| 'generate-text-v1'
| 'generate-text-beam'
| 'append-user'
| 'generate-image'
@@ -19,6 +19,11 @@ const ChatModeItems: { [key in ChatModeId]: ChatModeDescription } = {
description: 'Persona replies',
canAttach: true,
},
'generate-text-v1': {
label: 'Chat (1.16)',
description: 'Persona replies (stable)',
canAttach: true,
},
'generate-text-beam': {
label: 'Beam', // Best of, Auto-Prime, Top Pick, Select Best
description: 'Combine multiple models', // Smarter: combine...
@@ -148,7 +148,7 @@ export function Composer(props: {
// composer-overlay: for the reply-to state, comes from the conversation overlay
const { replyToGenerateText } = useChatOverlayStore(conversationOverlayStore, useShallow(store => ({
replyToGenerateText: chatModeId === 'generate-text' ? store.replyToText?.trim() || null : null,
replyToGenerateText: (chatModeId === 'generate-text' || chatModeId === 'generate-text-v1') ? store.replyToText?.trim() || null : null,
})));
// don't load URLs if the user is typing a command or there's no capability
@@ -546,7 +546,7 @@ export function Composer(props: {
}, [attachAppendDataTransfer, eatDragEvent, setComposeText]);
const isText = chatModeId === 'generate-text';
const isText = chatModeId === 'generate-text' || chatModeId === 'generate-text-v1';
const isTextBeam = chatModeId === 'generate-text-beam';
const isAppend = chatModeId === 'append-user';
const isReAct = chatModeId === 'generate-react';
+3
View File
@@ -73,6 +73,9 @@ export async function _handleExecute(chatModeId: ChatModeId, conversationId: DCo
case 'generate-text':
return await runAssistantUpdatingState(conversationId, cHandler.viewHistory('generate-text'), chatLLMId, getUXLabsHighPerformance() ? 0 : getInstantAppChatPanesCount());
case 'generate-text-v1':
return await runAssistantUpdatingState(conversationId, cHandler.viewHistory('generate-text-v1'), chatLLMId, getUXLabsHighPerformance() ? 0 : getInstantAppChatPanesCount());
case 'generate-text-beam':
cHandler.beamInvoke(cHandler.viewHistory('generate-text-beam'), [], null);
return true;
+7 -1
View File
@@ -14,7 +14,12 @@ import { ChatAutoSpeakType, getChatAutoAI } from '../store-app-chat';
/**
* The main "chat" function. TODO: this is here so we can soon move it to the data model.
*/
export async function runAssistantUpdatingState(conversationId: string, history: Readonly<DMessage[]>, assistantLlmId: DLLMId, parallelViewCount: number) {
export async function runAssistantUpdatingState(
conversationId: string,
history: Readonly<DMessage[]>,
assistantLlmId: DLLMId,
parallelViewCount: number,
) {
const cHandler = ConversationsManager.getHandler(conversationId);
// ai follow-up operations (fire/forget)
@@ -67,6 +72,7 @@ export async function runAssistantUpdatingState(conversationId: string, history:
return messageStatus.outcome === 'success';
}
type StreamMessageOutcome = 'success' | 'aborted' | 'errored';
type StreamMessageStatus = { outcome: StreamMessageOutcome, errorMessage?: string };
type StreamMessageUpdate = Pick<DMessage, 'fragments' | 'originLLM' | 'pendingIncomplete'>;