670
671
/** Adds a chat to a session, sends its initial prompt, and returns the created channels. */
672
>
export async function applyCreateChatTool(accessor: ISessionServerToolAccessor, rawArgs: unknown, currentSession?: URI): Promise<ICreateChatResult> {
sessionServerTools.ts
673
>
const sessions = await accessor.listSessions();
674
>
const args = getCreateChatArgs(rawArgs, sessions, accessor.getModels(), currentSession);
675
>
const chatId = generateUuid();
676
>
const chat = URI.parse(buildChatUri(args.session.toString(), chatId));
677
>
await accessor.createChat(args.session, chat, { title: args.title, model: args.model });
678
>
await accessor.startPrompt(args.session, chat, args.prompt);
679
>
return { session: args.session.toString(), chat: chat.toString(), openLink: buildOpenSessionLinkUri(args.session, chatId) };
680
>
}
681
682
/** Builds the model-facing `create_chat` result. */