parent
a88b4232a0
commit
2379fd5970
|
@ -428,6 +428,7 @@ export function initDefaultSlashCommands() {
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'ask',
|
name: 'ask',
|
||||||
callback: askCharacter,
|
callback: askCharacter,
|
||||||
|
returns: 'the generated text',
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
SlashCommandNamedArgument.fromProps({
|
SlashCommandNamedArgument.fromProps({
|
||||||
name: 'name',
|
name: 'name',
|
||||||
|
@ -2535,22 +2536,25 @@ async function askCharacter(args, text) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let askResult = '';
|
||||||
|
|
||||||
// Run generate and restore previous character
|
// Run generate and restore previous character
|
||||||
try {
|
try {
|
||||||
toastr.info(`Asking ${character.name} something...`);
|
toastr.info(`Asking ${character.name} something...`);
|
||||||
await Generate('ask_command');
|
askResult = await Generate('ask_command');
|
||||||
await saveChatConditional();
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error running /ask command', error);
|
console.error('Error running /ask command', error);
|
||||||
} finally {
|
} finally {
|
||||||
restoreCharacter();
|
restoreCharacter();
|
||||||
|
|
||||||
if (this_chid !== prevChId) {
|
if (this_chid === prevChId) {
|
||||||
|
await saveChatConditional();
|
||||||
|
} else {
|
||||||
toastr.error('It is strongly recommended to reload the page.', 'Something went wrong');
|
toastr.error('It is strongly recommended to reload the page.', 'Something went wrong');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return askResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function hideMessageCallback(_, arg) {
|
async function hideMessageCallback(_, arg) {
|
||||||
|
|
Loading…
Reference in New Issue