From b510634e11ae9f13c00fedef82da2b97fc2c5c33 Mon Sep 17 00:00:00 2001 From: Ian Calvert Date: Wed, 17 Jan 2024 13:45:08 +0000 Subject: [PATCH 01/12] Support adding titles to chats --- packages/ai-bot/README.md | 15 +- packages/ai-bot/helpers.ts | 62 ++++++ packages/ai-bot/main.ts | 133 ++++++++---- packages/ai-bot/tests/chat-titling-test.ts | 233 +++++++++++++++++++++ 4 files changed, 405 insertions(+), 38 deletions(-) create mode 100644 packages/ai-bot/tests/chat-titling-test.ts diff --git a/packages/ai-bot/README.md b/packages/ai-bot/README.md index 933aa5650e..e334c69f56 100644 --- a/packages/ai-bot/README.md +++ b/packages/ai-bot/README.md @@ -37,17 +37,26 @@ Once logged in, create a room and invite the aibot - it should join automaticall It will be able to see any cards shared in the chat and can respond using GPT4 if you ask for content modifications (as a start, try 'can you create some sample data for this?'). The response should stream back and give you several options, these get applied as patches to the shared card if it is in your stack. -You can deliberately trigger a specific patch by sending a message that starts `debugpatch:` and has the JSON patch you want returned. For example: +### Debugging + +You can deliberately trigger a specific patch by sending a message that starts `debug:patch:` and has the JSON patch you want returned. For example: ``` -debugpatch:{"firstName": "David"} +debug:patch:{"firstName": "David"} ``` This will return a patch with the ID of the last card you uploaded. This does not hit GPT4 and is useful for testing the integration of the two components without waiting for streaming responses. +You can set a room name with `debug:title:set:` + +``` +debug:title:set:My Room +``` + +And you can trigger room naming with `debug:title:create` on its own. + ## Testing ### Unit tests Run `pnpm test` - diff --git a/packages/ai-bot/helpers.ts b/packages/ai-bot/helpers.ts index 28d7ae4022..97fb71af03 100644 --- a/packages/ai-bot/helpers.ts +++ b/packages/ai-bot/helpers.ts @@ -144,6 +144,68 @@ export function getFunctions(history: IRoomEvent[], aiBotUserId: string) { } } +export function shouldSetRoomTitle( + rawEventLog: IRoomEvent[], + aiBotUserId: string, +) { + // If the room title has been set already, we don't want to set it again + let nameEvents = rawEventLog.filter((event) => event.type === 'm.room.name'); + if (nameEvents.length > 1) { + return false; + } + + // If there has been a command sent, + // we should be at a stage where we can set the room title + let patchEvents = rawEventLog.filter( + (event) => event.content.msgtype === 'org.boxel.command', + ); + + if (patchEvents.length > 0) { + return true; + } + + // If there has been a 5 user messages we should still set the room title + let userEvents = rawEventLog.filter( + (event) => event.sender !== aiBotUserId && event.type === 'm.room.message', + ); + if (userEvents.length >= 5) { + return true; + } + + return false; +} + +export function getStartOfConversation( + history: IRoomEvent[], + aiBotUserId: string, + maxLength = 2000, +) { + /** + * Get just the start of the conversation + * useful for summarising while limiting the context + */ + let messages: OpenAIPromptMessage[] = []; + let totalLength = 0; + for (let event of history) { + let body = event.content.body; + if (body && totalLength + body.length <= maxLength) { + if (event.sender === aiBotUserId) { + messages.push({ + role: 'assistant', + content: body, + }); + } else { + messages.push({ + role: 'user', + content: body, + }); + } + totalLength += body.length; + } + } + return messages; +} + export function getModifyPrompt( history: IRoomEvent[], aiBotUserId: string, diff --git a/packages/ai-bot/main.ts b/packages/ai-bot/main.ts index 17d2ad25b9..4eea6b2b81 100644 --- a/packages/ai-bot/main.ts +++ b/packages/ai-bot/main.ts @@ -16,6 +16,8 @@ import { getModifyPrompt, cleanContent, getFunctions, + getStartOfConversation, + shouldSetRoomTitle, } from './helpers'; import { OpenAIError } from 'openai/error'; @@ -141,6 +143,83 @@ async function sendError( } } +async function setTitle( + client: MatrixClient, + room: Room, + history: IRoomEvent[], + userId: string, +) { + let startOfConversation = [ + { + role: 'system', + content: `You are a chat titling system, you must read the conversation and return a suggested title of no more than six words. + Do NOT say talk or discussion or discussing or chat or chatting, this is implied by the context. + Explain the general actions and user intent`, + }, + ...getStartOfConversation(history, userId), + ]; + startOfConversation.push({ + role: 'user', + content: 'Create a short title for this chat, limited to 6 words.', + }); + try { + let result = await openai.chat.completions.create( + { + model: 'gpt-3.5-turbo-1106', + messages: startOfConversation, + stream: false, + }, + { + maxRetries: 5, + }, + ); + let title = result.choices[0].message.content || 'no title'; + // strip leading and trailing quotes + title = title.replace(/^"(.*)"$/, '$1'); + log.info('Setting room title to', title); + return await client.setRoomName(room.roomId, title); + } catch (error) { + return await sendError(client, room, error); + } +} + +async function handleDebugCommands(eventBody, client, room, history, userId) { + // Explicitly set the room name + if (eventBody.startsWith('debug:title:set:')) { + return await client.setRoomName( + room.roomId, + eventBody.split('debug:title:set:')[1], + ); + } + // Use GPT to set the room title + else if (eventBody.startsWith('debug:title:create')) { + return await setTitle(client, room, history, userId); + } else if (eventBody.startsWith('debug:patch:')) { + let patchMessage = eventBody.split('debug:patch:')[1]; + // If there's a card attached, we need to split it off to parse the json + patchMessage = patchMessage.split('(Card')[0]; + let attributes = {}; + try { + attributes = JSON.parse(patchMessage); + } catch (error) { + await sendMessage( + client, + room, + 'Error parsing your debug patch as JSON: ' + patchMessage, + initialMessage.event_id, + ); + } + let command = { + type: 'patch', + id: getLastUploadedCardID(history), + patch: { + attributes: attributes, + }, + }; + return await sendOption(client, room, command); + } +} + (async () => { const matrixUrl = process.env.MATRIX_URL || 'http://localhost:8008'; let client = createClient({ @@ -169,9 +248,9 @@ Common issues are: `); process.exit(1); }); - let { user_id: userId } = auth; + let { user_id: aiBotUserId } = auth; client.on(RoomMemberEvent.Membership, function (_event, member) { - if (member.membership === 'invite' && member.userId === userId) { + if (member.membership === 'invite' && member.userId === aiBotUserId) { client .joinRoom(member.roomId) .then(function () { @@ -190,15 +269,11 @@ Common issues are: client.on( RoomEvent.Timeline, async function (event, room, toStartOfTimeline) { + let eventBody = event.getContent().body; if (!room) { return; } - log.info( - '(%s) %s :: %s', - room?.name, - event.getSender(), - event.getContent().body, - ); + log.info('(%s) %s :: %s', room?.name, event.getSender(), eventBody); if (event.event.origin_server_ts! < startTime) { return; @@ -209,7 +284,7 @@ Common issues are: if (event.getType() !== 'm.room.message') { return; // only print messages } - if (event.getSender() === userId) { + if (event.getSender() === aiBotUserId) { return; } let initialMessage: ISendEventResponse = await client.sendHtmlMessage( @@ -226,35 +301,19 @@ Common issues are: let history: IRoomEvent[] = constructHistory(eventList); log.info("Compressed into just the history that's ", history.length); - // While developing the frontend it can be handy to skip GPT and just return some data - if (event.getContent().body.startsWith('debugpatch:')) { - let body = event.getContent().body; - let patchMessage = body.split('debugpatch:')[1]; - // If there's a card attached, we need to split it off to parse the json - patchMessage = patchMessage.split('(Card')[0]; - let attributes = {}; - try { - attributes = JSON.parse(patchMessage); - } catch (error) { - await sendMessage( - client, - room, - 'Error parsing your debug patch as JSON: ' + patchMessage, - initialMessage.event_id, - ); - } - let command = { - type: 'patch', - id: getLastUploadedCardID(history), - patch: { - attributes: attributes, - }, - }; - return await sendOption(client, room, command); + // To assist debugging, handle explicit commands + if (eventBody.startsWith('debug:')) { + return await handleDebugCommands( + eventBody, + client, + room, + history, + aiBotUserId, + ); } let unsent = 0; - const runner = await getResponse(history, userId) + const runner = await getResponse(history, aiBotUserId) .on('content', async (_delta, snapshot) => { unsent += 1; if (unsent > 5) { @@ -305,6 +364,10 @@ Common issues are: if (finalContent) { await sendMessage(client, room, finalContent, initialMessage.event_id); } + + if (shouldSetRoomTitle(eventList, aiBotUserId)) { + await setTitle(client, room, history, aiBotUserId); + } return; }, ); diff --git a/packages/ai-bot/tests/chat-titling-test.ts b/packages/ai-bot/tests/chat-titling-test.ts new file mode 100644 index 0000000000..bc2dbb6022 --- /dev/null +++ b/packages/ai-bot/tests/chat-titling-test.ts @@ -0,0 +1,233 @@ +import { module, test, assert } from 'qunit'; +import { shouldSetRoomTitle } from '../helpers'; +import { IRoomEvent } from 'matrix-js-sdk'; + +module('shouldSetRoomTitle', () => { + test('Do not set a title when there is no content', () => { + const eventLog: IRoomEvent[] = []; + assert.false(shouldSetRoomTitle(eventLog, '@aibot:localhost')); + }); + + test('Do not set a title when there is little content', () => { + const eventLog: IRoomEvent[] = [ + { + type: 'm.room.message', + event_id: '1', + origin_server_ts: 1234567890, + content: { + body: 'Hey', + }, + sender: '@user:localhost', + }, + ]; + assert.false(shouldSetRoomTitle(eventLog, '@aibot:localhost')); + }); + + test('Do not set a title when there are more than 5 messages but they are state/invites/etc', () => { + const eventLog: IRoomEvent[] = [ + { + type: 'm.room.message', + event_id: '1', + origin_server_ts: 1234567890, + content: { + body: 'Hey', + }, + sender: '@user:localhost', + }, + { + type: 'm.room.message', + event_id: '2', + origin_server_ts: 1234567890, + content: { + body: 'conversation', + }, + sender: '@user:localhost', + }, + { + type: 'm.room.create', + event_id: '3', + origin_server_ts: 1234567890, + content: {}, + sender: '@user:localhost', + }, + { + type: 'm.room.power_levels', + event_id: '4', + origin_server_ts: 1234567890, + content: {}, + sender: '@user:localhost', + }, + { + type: 'm.room.invite', + event_id: '5', + origin_server_ts: 1234567890, + content: {}, + sender: '@user:localhost', + }, + { + type: 'm.room.member', + event_id: '6', + origin_server_ts: 1234567890, + content: {}, + sender: '@user:localhost', + }, + ]; + assert.false(shouldSetRoomTitle(eventLog, '@aibot:localhost')); + }); + + test('Do not set a title when there are under 5 user messages but more than 5 total messages', () => { + const eventLog: IRoomEvent[] = [ + { + type: 'm.room.message', + event_id: '1', + origin_server_ts: 1234567890, + content: { + body: 'Hey', + }, + sender: '@user:localhost', + }, + { + type: 'm.room.message', + event_id: '2', + origin_server_ts: 1234567890, + content: { + body: 'conversation', + }, + sender: '@user:localhost', + }, + { + type: 'm.room.message', + event_id: '3', + origin_server_ts: 1234567890, + content: { + body: 'Response', + }, + sender: '@aibot:localhost', + }, + { + type: 'm.room.message', + event_id: '4', + origin_server_ts: 1234567890, + content: { + body: 'Response', + }, + sender: '@aibot:localhost', + }, + + { + type: 'm.room.message', + event_id: '5', + origin_server_ts: 1234567890, + content: { + body: 'Response', + }, + sender: '@aibot:localhost', + }, + { + type: 'm.room.message', + event_id: '6', + origin_server_ts: 1234567890, + content: { + body: 'Hey', + }, + sender: '@user:localhost', + }, + ]; + assert.false(shouldSetRoomTitle(eventLog, '@aibot:localhost')); + }); + + test('Set a title when there are 5 or more user messages', () => { + const eventLog: IRoomEvent[] = [ + { + type: 'm.room.message', + event_id: '1', + origin_server_ts: 1234567890, + content: { + body: 'Hey', + }, + sender: '@user:localhost', + }, + { + type: 'm.room.message', + event_id: '2', + origin_server_ts: 1234567890, + content: { + body: 'conversation', + }, + sender: '@user:localhost', + }, + { + type: 'm.room.message', + event_id: '3', + origin_server_ts: 1234567890, + content: { + body: 'Response', + }, + sender: '@aibot:localhost', + }, + { + type: 'm.room.message', + event_id: '4', + origin_server_ts: 1234567890, + content: { + body: 'Hey', + }, + sender: '@user:localhost', + }, + + { + type: 'm.room.message', + event_id: '5', + origin_server_ts: 1234567890, + content: { + body: 'Hey', + }, + sender: '@user:localhost', + }, + { + type: 'm.room.message', + event_id: '6', + origin_server_ts: 1234567890, + content: { + body: 'Hey', + }, + sender: '@user:localhost', + }, + ]; + assert.true(shouldSetRoomTitle(eventLog, '@aibot:localhost')); + }); + + test('Set a title if the bot has sent a command', () => { + const eventLog: IRoomEvent[] = [ + { + type: 'm.room.message', + event_id: '1', + origin_server_ts: 1234567890, + content: { + body: 'Hey please perform an action', + }, + sender: '@user:localhost', + }, + { + type: 'm.room.message', + event_id: '2', + origin_server_ts: 1234567890, + content: { + body: 'patch', + msgtype: 'org.boxel.command', + command: { + type: 'patch', + id: 'http://localhost:4201/drafts/Friend/1', + patch: { + attributes: { + firstName: 'Dave', + }, + }, + }, + }, + sender: '@aibot:localhost', + }, + ]; + assert.true(shouldSetRoomTitle(eventLog, '@aibot:localhost')); + }); +}); From 871bea462a684043caa390c73db0ac804ba9d5db Mon Sep 17 00:00:00 2001 From: Ian Calvert Date: Wed, 17 Jan 2024 13:46:53 +0000 Subject: [PATCH 02/12] Give AI bot a higher power level --- packages/host/app/services/matrix-service.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/host/app/services/matrix-service.ts b/packages/host/app/services/matrix-service.ts index 264c424419..15c0bca035 100644 --- a/packages/host/app/services/matrix-service.ts +++ b/packages/host/app/services/matrix-service.ts @@ -20,6 +20,7 @@ import { type CodeRef, type MatrixCardError, sanitizeHtml, + aiBotUsername, } from '@cardstack/runtime-common'; import { basicMappings, @@ -49,6 +50,7 @@ import type * as MatrixSDK from 'matrix-js-sdk'; const { matrixURL } = ENV; const SET_OBJECTIVE_POWER_LEVEL = 50; +const AI_BOT_POWER_LEVEL = 50; // this is required to set the room name const DEFAULT_PAGE_SIZE = 50; export type Event = Partial; @@ -256,6 +258,14 @@ export default class MatrixService extends Service { topic, room_alias_name: encodeURIComponent(name), }); + invites.map((i) => { + console.log('Inviting', i, 'to room', roomId, 'are they', aiBotUsername); + let full = i.startsWith('@') ? i : `@${i}:${userId!.split(':')[1]}`; + if (i === aiBotUsername) { + console.log('Setting power level for ai bot', i, AI_BOT_POWER_LEVEL); + this.client.setPowerLevel(roomId, full, AI_BOT_POWER_LEVEL, null); + } + }); return roomId; } @@ -268,12 +278,12 @@ export default class MatrixService extends Service { ); } await Promise.all( - invite.map((i) => + invite.map((i) => { this.client.invite( roomId, i.startsWith('@') ? i : `@${i}:${userId!.split(':')[1]}`, - ), - ), + ); + }), ); } From c22c8217c6b4fe11153aff34c6b96888c7ab2404 Mon Sep 17 00:00:00 2001 From: Ian Calvert Date: Wed, 17 Jan 2024 14:15:18 +0000 Subject: [PATCH 03/12] Handle case where there's just been a command sent thats not in the log --- packages/ai-bot/helpers.ts | 5 +++-- packages/ai-bot/main.ts | 20 ++++++++++++++------ packages/ai-bot/tests/chat-titling-test.ts | 15 +++++++++++++++ packages/ai-bot/tests/index.ts | 1 + 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/packages/ai-bot/helpers.ts b/packages/ai-bot/helpers.ts index 97fb71af03..252fe3864c 100644 --- a/packages/ai-bot/helpers.ts +++ b/packages/ai-bot/helpers.ts @@ -147,6 +147,7 @@ export function getFunctions(history: IRoomEvent[], aiBotUserId: string) { export function shouldSetRoomTitle( rawEventLog: IRoomEvent[], aiBotUserId: string, + additionalCommands = 0, // These are any that have been sent since the event log was retrieved ) { // If the room title has been set already, we don't want to set it again let nameEvents = rawEventLog.filter((event) => event.type === 'm.room.name'); @@ -156,11 +157,11 @@ export function shouldSetRoomTitle( // If there has been a command sent, // we should be at a stage where we can set the room title - let patchEvents = rawEventLog.filter( + let commandsSent = rawEventLog.filter( (event) => event.content.msgtype === 'org.boxel.command', ); - if (patchEvents.length > 0) { + if (commandsSent.length + additionalCommands > 0) { return true; } diff --git a/packages/ai-bot/main.ts b/packages/ai-bot/main.ts index 4eea6b2b81..baddd44c7e 100644 --- a/packages/ai-bot/main.ts +++ b/packages/ai-bot/main.ts @@ -154,7 +154,7 @@ async function setTitle( role: 'system', content: `You are a chat titling system, you must read the conversation and return a suggested title of no more than six words. Do NOT say talk or discussion or discussing or chat or chatting, this is implied by the context. - Explain the general actions and user intent`, + Explain the general actions and user intent.`, }, ...getStartOfConversation(history, userId), ]; @@ -179,11 +179,17 @@ async function setTitle( log.info('Setting room title to', title); return await client.setRoomName(room.roomId, title); } catch (error) { - return await sendError(client, room, error); + return await sendError(client, room, error, undefined); } } -async function handleDebugCommands(eventBody, client, room, history, userId) { +async function handleDebugCommands( + eventBody: string, + client: MatrixClient, + room: Room, + history: IRoomEvent[], + userId: string, +) { // Explicitly set the room name if (eventBody.startsWith('debug:title:set:')) { return await client.setRoomName( @@ -206,7 +212,7 @@ async function handleDebugCommands(eventBody, client, room, history, userId) { client, room, 'Error parsing your debug patch as JSON: ' + patchMessage, - initialMessage.event_id, + undefined, ); } let command = { @@ -313,6 +319,7 @@ Common issues are: } let unsent = 0; + let sentCommands = 0; const runner = await getResponse(history, aiBotUserId) .on('content', async (_delta, snapshot) => { unsent += 1; @@ -340,6 +347,7 @@ Common issues are: ); } if (functionCall.name === 'patchCard') { + sentCommands += 1; await sendMessage( client, room, @@ -365,8 +373,8 @@ Common issues are: await sendMessage(client, room, finalContent, initialMessage.event_id); } - if (shouldSetRoomTitle(eventList, aiBotUserId)) { - await setTitle(client, room, history, aiBotUserId); + if (shouldSetRoomTitle(eventList, aiBotUserId, sentCommands)) { + return await setTitle(client, room, history, aiBotUserId); } return; }, diff --git a/packages/ai-bot/tests/chat-titling-test.ts b/packages/ai-bot/tests/chat-titling-test.ts index bc2dbb6022..9575ff519e 100644 --- a/packages/ai-bot/tests/chat-titling-test.ts +++ b/packages/ai-bot/tests/chat-titling-test.ts @@ -230,4 +230,19 @@ module('shouldSetRoomTitle', () => { ]; assert.true(shouldSetRoomTitle(eventLog, '@aibot:localhost')); }); + + test('Set a title if the bot has sent a command in the last event, not seen in the log', () => { + const eventLog: IRoomEvent[] = [ + { + type: 'm.room.message', + event_id: '1', + origin_server_ts: 1234567890, + content: { + body: 'Hey please perform an action', + }, + sender: '@user:localhost', + }, + ]; + assert.true(shouldSetRoomTitle(eventLog, '@aibot:localhost', 1)); + }); }); diff --git a/packages/ai-bot/tests/index.ts b/packages/ai-bot/tests/index.ts index 28e2f521b1..da6a4fc1e9 100644 --- a/packages/ai-bot/tests/index.ts +++ b/packages/ai-bot/tests/index.ts @@ -2,3 +2,4 @@ import '../setup-logger'; // This should be first import './response-parsing-test'; import './history-construction-test'; import './prompt-construction-test'; +import './chat-titling-test'; From f279545dfca5a3f3e76247026a13444f231442c7 Mon Sep 17 00:00:00 2001 From: Ian Calvert Date: Wed, 17 Jan 2024 14:38:43 +0000 Subject: [PATCH 04/12] Remove debug, simplify code --- packages/host/app/services/matrix-service.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/host/app/services/matrix-service.ts b/packages/host/app/services/matrix-service.ts index 15c0bca035..cb2795ce7a 100644 --- a/packages/host/app/services/matrix-service.ts +++ b/packages/host/app/services/matrix-service.ts @@ -259,11 +259,9 @@ export default class MatrixService extends Service { room_alias_name: encodeURIComponent(name), }); invites.map((i) => { - console.log('Inviting', i, 'to room', roomId, 'are they', aiBotUsername); - let full = i.startsWith('@') ? i : `@${i}:${userId!.split(':')[1]}`; + let fullId = i.startsWith('@') ? i : `@${i}:${userId!.split(':')[1]}`; if (i === aiBotUsername) { - console.log('Setting power level for ai bot', i, AI_BOT_POWER_LEVEL); - this.client.setPowerLevel(roomId, full, AI_BOT_POWER_LEVEL, null); + this.client.setPowerLevel(roomId, fullId, AI_BOT_POWER_LEVEL, null); } }); return roomId; @@ -278,12 +276,12 @@ export default class MatrixService extends Service { ); } await Promise.all( - invite.map((i) => { + invite.map((i) => this.client.invite( roomId, i.startsWith('@') ? i : `@${i}:${userId!.split(':')[1]}`, - ); - }), + ), + ), ); } From 84a1e2c3578d7ae7dc06ddbade97cdaf99051df1 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 22 Jan 2024 14:01:42 -0500 Subject: [PATCH 05/12] Fix type import declarations in boxel-ui This adds missing `import type` declarations so that typescript will strip these imports correcty and stop generating extra noise in rollup. It also changes the rollup config to prevent this problem from creeping back in by turning the rollup warning into a rollup error. --- packages/boxel-ui/addon/rollup.config.mjs | 10 ++++++++++ .../addon/src/components/input-group/usage.gts | 2 +- .../addon/src/components/radio-input/usage.gts | 2 +- .../src/components/resizable-panel-group/usage.gts | 2 +- .../boxel-ui/addon/src/components/tooltip/usage.gts | 2 +- packages/boxel-ui/addon/src/modifiers/set-css-var.ts | 2 +- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/boxel-ui/addon/rollup.config.mjs b/packages/boxel-ui/addon/rollup.config.mjs index e63ae25755..ca7e9e08a3 100644 --- a/packages/boxel-ui/addon/rollup.config.mjs +++ b/packages/boxel-ui/addon/rollup.config.mjs @@ -69,6 +69,16 @@ export default { }), scopedCSS('src'), ], + + onLog(level, log, handler) { + if (log.code === 'UNUSED_EXTERNAL_IMPORT') { + // Turn unused external imports from warnings to errors. Warnings + // accumulate and just generate noise. And this is an easily-fixable issue + // usually caused by failing to declare a type import correctly. + level = 'error'; + } + handler(level, log); + }, }; function scopedCSS(srcDir) { diff --git a/packages/boxel-ui/addon/src/components/input-group/usage.gts b/packages/boxel-ui/addon/src/components/input-group/usage.gts index ffb19242f3..fb4bb67121 100644 --- a/packages/boxel-ui/addon/src/components/input-group/usage.gts +++ b/packages/boxel-ui/addon/src/components/input-group/usage.gts @@ -5,8 +5,8 @@ import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import FreestyleUsage from 'ember-freestyle/components/freestyle/usage'; import { + type CSSVariableInfo, cssVariable, - CSSVariableInfo, } from 'ember-freestyle/decorators/css-variable'; import cssVar from '../../helpers/css-var.ts'; diff --git a/packages/boxel-ui/addon/src/components/radio-input/usage.gts b/packages/boxel-ui/addon/src/components/radio-input/usage.gts index ddf58ece38..a649f6d7f5 100644 --- a/packages/boxel-ui/addon/src/components/radio-input/usage.gts +++ b/packages/boxel-ui/addon/src/components/radio-input/usage.gts @@ -5,8 +5,8 @@ import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import FreestyleUsage from 'ember-freestyle/components/freestyle/usage'; import { + type CSSVariableInfo, cssVariable, - CSSVariableInfo, } from 'ember-freestyle/decorators/css-variable'; import cssVar from '../../helpers/css-var.ts'; diff --git a/packages/boxel-ui/addon/src/components/resizable-panel-group/usage.gts b/packages/boxel-ui/addon/src/components/resizable-panel-group/usage.gts index d1213d578d..115aa94b95 100644 --- a/packages/boxel-ui/addon/src/components/resizable-panel-group/usage.gts +++ b/packages/boxel-ui/addon/src/components/resizable-panel-group/usage.gts @@ -3,8 +3,8 @@ import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import FreestyleUsage from 'ember-freestyle/components/freestyle/usage'; import { + type CSSVariableInfo, cssVariable, - CSSVariableInfo, } from 'ember-freestyle/decorators/css-variable'; import cssVar from '../../helpers/css-var.ts'; diff --git a/packages/boxel-ui/addon/src/components/tooltip/usage.gts b/packages/boxel-ui/addon/src/components/tooltip/usage.gts index 678e62d28f..63be07924e 100644 --- a/packages/boxel-ui/addon/src/components/tooltip/usage.gts +++ b/packages/boxel-ui/addon/src/components/tooltip/usage.gts @@ -1,7 +1,7 @@ import { array, fn } from '@ember/helper'; import { on } from '@ember/modifier'; import { action } from '@ember/object'; -import { MiddlewareState } from '@floating-ui/dom'; +import type { MiddlewareState } from '@floating-ui/dom'; import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import FreestyleUsage from 'ember-freestyle/components/freestyle/usage'; diff --git a/packages/boxel-ui/addon/src/modifiers/set-css-var.ts b/packages/boxel-ui/addon/src/modifiers/set-css-var.ts index 6682f31853..720f8898c5 100644 --- a/packages/boxel-ui/addon/src/modifiers/set-css-var.ts +++ b/packages/boxel-ui/addon/src/modifiers/set-css-var.ts @@ -1,4 +1,4 @@ -import Modifier, { NamedArgs, PositionalArgs } from 'ember-modifier'; +import Modifier, { type NamedArgs, type PositionalArgs } from 'ember-modifier'; interface SetCssVarModifierSignature { Args: { From 4c96fb84978a13bcee2dcb7b926d17f22b80c25d Mon Sep 17 00:00:00 2001 From: Luke Melia Date: Wed, 24 Jan 2024 23:27:16 -0500 Subject: [PATCH 06/12] When opening AI panel, open latest room by default --- .../host/app/components/ai-assistant/panel.gts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/host/app/components/ai-assistant/panel.gts b/packages/host/app/components/ai-assistant/panel.gts index 8934108669..3d84fb4a2b 100644 --- a/packages/host/app/components/ai-assistant/panel.gts +++ b/packages/host/app/components/ai-assistant/panel.gts @@ -9,7 +9,6 @@ import { tracked, cached } from '@glimmer/tracking'; import format from 'date-fns/format'; import { restartableTask, timeout } from 'ember-concurrency'; - import { TrackedMap } from 'tracked-built-ins'; import { @@ -92,7 +91,7 @@ export default class AiAssistantPanel extends Component { New Session - {{#if this.loadRooms.isRunning}} + {{#if this.loadRoomsTask.isRunning}} {{else}}