1
This commit is contained in:
@@ -42,6 +42,10 @@ function getRuntimeSessionIdFromContext(context: StoryGenerationContext) {
|
||||
return context.runtimeSessionId?.trim() || undefined;
|
||||
}
|
||||
|
||||
function getRuntimeSnapshotFromContext(context: StoryGenerationContext) {
|
||||
return context.runtimeSnapshot;
|
||||
}
|
||||
|
||||
async function requestPlainText(
|
||||
url: string,
|
||||
payload: unknown,
|
||||
@@ -240,9 +244,11 @@ export async function generateCharacterPanelChatSuggestions(
|
||||
targetStatus: CharacterChatTargetStatus,
|
||||
) {
|
||||
const sessionId = getRuntimeSessionIdFromContext(context);
|
||||
const snapshot = getRuntimeSnapshotFromContext(context);
|
||||
const payload = sessionId
|
||||
? ({
|
||||
sessionId,
|
||||
...(snapshot ? { snapshot } : {}),
|
||||
targetCharacter,
|
||||
conversationHistory,
|
||||
conversationSummary,
|
||||
@@ -278,9 +284,11 @@ export async function generateCharacterPanelChatSummary(
|
||||
targetStatus: CharacterChatTargetStatus,
|
||||
) {
|
||||
const sessionId = getRuntimeSessionIdFromContext(context);
|
||||
const snapshot = getRuntimeSnapshotFromContext(context);
|
||||
const payload = sessionId
|
||||
? ({
|
||||
sessionId,
|
||||
...(snapshot ? { snapshot } : {}),
|
||||
targetCharacter,
|
||||
conversationHistory,
|
||||
previousSummary,
|
||||
@@ -318,9 +326,11 @@ export async function streamCharacterPanelChatReply(
|
||||
options: TextStreamOptions = {},
|
||||
) {
|
||||
const sessionId = getRuntimeSessionIdFromContext(context);
|
||||
const snapshot = getRuntimeSnapshotFromContext(context);
|
||||
const payload = sessionId
|
||||
? ({
|
||||
sessionId,
|
||||
...(snapshot ? { snapshot } : {}),
|
||||
targetCharacter,
|
||||
conversationHistory,
|
||||
conversationSummary,
|
||||
@@ -359,9 +369,11 @@ export async function streamNpcChatDialogue(
|
||||
options: TextStreamOptions = {},
|
||||
) {
|
||||
const sessionId = getRuntimeSessionIdFromContext(context);
|
||||
const snapshot = getRuntimeSnapshotFromContext(context);
|
||||
const payload = sessionId
|
||||
? ({
|
||||
sessionId,
|
||||
...(snapshot ? { snapshot } : {}),
|
||||
encounter,
|
||||
topic,
|
||||
resultSummary,
|
||||
@@ -411,6 +423,7 @@ export async function streamNpcChatTurn(
|
||||
} = {},
|
||||
) {
|
||||
const sessionId = getRuntimeSessionIdFromContext(context);
|
||||
const snapshot = getRuntimeSnapshotFromContext(context);
|
||||
const commonChatPayload = {
|
||||
encounter,
|
||||
conversationHistory: conversationHistory ?? [],
|
||||
@@ -429,15 +442,18 @@ export async function streamNpcChatTurn(
|
||||
chatDirective: options.chatDirective
|
||||
? {
|
||||
...options.chatDirective,
|
||||
functionOptions: options.chatDirective.functionOptions?.map((item) => ({
|
||||
...item,
|
||||
})),
|
||||
functionOptions: options.chatDirective.functionOptions?.map(
|
||||
(item) => ({
|
||||
...item,
|
||||
}),
|
||||
),
|
||||
}
|
||||
: null,
|
||||
};
|
||||
const payload = sessionId
|
||||
? ({
|
||||
sessionId,
|
||||
...(snapshot ? { snapshot } : {}),
|
||||
...commonChatPayload,
|
||||
} satisfies NpcChatTurnRequest)
|
||||
: ({
|
||||
@@ -548,9 +564,11 @@ export async function streamNpcRecruitDialogue(
|
||||
options: TextStreamOptions = {},
|
||||
) {
|
||||
const sessionId = getRuntimeSessionIdFromContext(context);
|
||||
const snapshot = getRuntimeSnapshotFromContext(context);
|
||||
const payload = sessionId
|
||||
? ({
|
||||
sessionId,
|
||||
...(snapshot ? { snapshot } : {}),
|
||||
encounter,
|
||||
invitationText,
|
||||
recruitSummary,
|
||||
|
||||
Reference in New Issue
Block a user