Skip to content

Commit 38c35a1

Browse files
committed
Merge branch 'main' into cs-7850-find-a-way-to-stream-incoming-tool-call-code-and-thinking
2 parents db7d0af + c8731f2 commit 38c35a1

File tree

53 files changed

+971
-593
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+971
-593
lines changed

packages/ai-bot/main.ts

+23-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const MINIMUM_CREDITS = 10;
4646
class Assistant {
4747
private openai: OpenAI;
4848
private client: MatrixClient;
49+
private toolCallCapableModels: Set<string>;
4950
pgAdapter: PgAdapter;
5051
id: string;
5152

@@ -57,6 +58,21 @@ class Assistant {
5758
this.id = id;
5859
this.client = client;
5960
this.pgAdapter = new PgAdapter();
61+
this.toolCallCapableModels = new Set();
62+
}
63+
64+
async loadToolCallCapableModels() {
65+
// api request is https://openrouter.ai/api/v1/models?supported_parameters=tools
66+
let response = await fetch(
67+
'https://openrouter.ai/api/v1/models?supported_parameters=tools',
68+
);
69+
let responseJson = (await response.json()) as {
70+
data: { id: string }[];
71+
};
72+
let modelList = responseJson.data;
73+
this.toolCallCapableModels = new Set(
74+
modelList.map((model: any) => model.id),
75+
);
6076
}
6177

6278
async trackAiUsageCost(matrixUserId: string, generationId: string) {
@@ -72,7 +88,12 @@ class Assistant {
7288
}
7389

7490
getResponse(prompt: PromptParts) {
75-
if (prompt.tools.length === 0) {
91+
// Sending tools to models that don't support them results in an error
92+
// from openrouter.
93+
if (
94+
prompt.tools.length === 0 ||
95+
!this.toolCallCapableModels.has(prompt.model)
96+
) {
7697
return this.openai.beta.chat.completions.stream({
7798
model: prompt.model,
7899
messages: prompt.messages as ChatCompletionMessageParam[],
@@ -144,6 +165,7 @@ Common issues are:
144165
});
145166
let { user_id: aiBotUserId } = auth;
146167
let assistant = new Assistant(client, aiBotUserId);
168+
await assistant.loadToolCallCapableModels();
147169

148170
client.on(RoomMemberEvent.Membership, function (_event, member) {
149171
if (member.membership === 'invite' && member.userId === aiBotUserId) {

packages/base/cards-grid.gts

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ class Isolated extends Component<typeof CardsGrid> {
396396
{
397397
filter: {
398398
on: catalogEntryRef,
399-
every: [{ eq: { specType: 'card' } }],
399+
every: [{ eq: { isCard: true } }],
400400
},
401401
},
402402
{ preselectedCardTypeQuery },

packages/base/catalog-entry.gts

+5-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ export class CatalogEntry extends CardDef {
5353

5454
@field isCard = contains(BooleanField, {
5555
computeVia: function (this: CatalogEntry) {
56-
return this.specType === 'card';
56+
return (
57+
this.specType === 'card' ||
58+
this.specType === 'app' ||
59+
this.specType === 'skill'
60+
);
5761
},
5862
});
5963
@field moduleHref = contains(StringField, {
Loading

packages/boxel-ui/addon/src/components/loading-indicator/index.gts

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ interface Signature {
77
Args: {
88
color?: string;
99
};
10-
Element: HTMLDivElement;
10+
Element: HTMLSpanElement;
1111
}
1212

1313
const LoadingIndicator: TemplateOnlyComponent<Signature> = <template>
14-
<div
14+
<span
1515
class='boxel-loading-indicator'
1616
data-test-loading-indicator
1717
...attributes
1818
>
1919
<LoadingIndicatorIcon
20-
style={{cssVar icon-color=(if @color @color '#000')}}
20+
style={{cssVar icon-color=@color}}
2121
role='presentation'
2222
/>
23-
</div>
23+
</span>
2424
<style scoped>
2525
/* zero specificity default sizing */
2626
:where(.boxel-loading-indicator) {

packages/boxel-ui/addon/src/components/select/trigger.gts

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ export class BoxelTriggerWrapper extends Component<TriggerSignature> {
6363
gap: var(--boxel-sp-xxs);
6464
}
6565
.boxel-trigger-placeholder {
66-
color: var(--boxel-400);
66+
color: var(--boxel-450);
67+
font: var(--boxel-font-sm);
68+
letter-spacing: var(--boxel-lsp-sm);
6769
}
6870
</style>
6971
<style scoped>
@@ -99,6 +101,7 @@ export class BoxelSelectDefaultTrigger extends Component<TriggerSignature> {
99101
.icon {
100102
width: 10px;
101103
height: 10px;
104+
flex-shrink: 0;
102105
}
103106
.is-open {
104107
transform: rotate(180deg);

packages/boxel-ui/addon/src/icons/loading-indicator.gts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const IconComponent: TemplateOnlyComponent<Signature> = <template>
1212
...attributes
1313
><g
1414
fill='none'
15-
stroke='var(--icon-color, #000)'
15+
stroke='var(--icon-color, currentColor)'
1616
stroke-linecap='round'
1717
stroke-linejoin='round'
1818
stroke-width='1.5'

packages/experiments-realm/Account/77976251-6bc8-4a8c-972f-f9d588e8434d.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@
2929
"urgencyTag": {
3030
"index": 3,
3131
"label": "Expiring Soon",
32-
"color": null,
33-
"colorScheme": {
34-
"foregroundColor": "#FBC02D",
35-
"backgroundColor": "#FFF9C4"
36-
}
32+
"foregroundColor": "#FBC02D",
33+
"backgroundColor": "#FFF9C4"
3734
},
3835
"description": "Current client with website and social media package expiring in 30 days",
3936
"thumbnailURL": null
@@ -62,4 +59,4 @@
6259
}
6360
}
6461
}
65-
}
62+
}

packages/experiments-realm/Account/be0192c4-e566-40ee-8a57-f88f7ab37e53.json

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
},
2727
"poBoxNumber": null
2828
},
29+
"urgencyTag": {
30+
"label": "Follow-Up Required",
31+
"foregroundColor": "#1976D2",
32+
"backgroundColor": "#E3F2FD"
33+
},
2934
"description": "Multi-location gym chain with comprehensive digital transformation needs",
3035
"thumbnailURL": "https://picsum.photos/id/416/200/300"
3136
},

packages/experiments-realm/Account/bf437dc3-1f96-45e5-a057-3487c6a5c2f7.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@
2929
"urgencyTag": {
3030
"index": 4,
3131
"label": "Follow-Up Required",
32-
"color": null,
33-
"colorScheme": {
34-
"foregroundColor": "#1976D2",
35-
"backgroundColor": "#E3F2FD"
36-
}
32+
"foregroundColor": "#1976D2",
33+
"backgroundColor": "#E3F2FD"
3734
},
3835
"description": "Potential startup client interested in digital marketing services",
3936
"thumbnailURL": null
@@ -62,4 +59,4 @@
6259
}
6360
}
6461
}
65-
}
62+
}

packages/experiments-realm/Account/c78762d3-9ab5-4f62-9370-d0b6a0261b08.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@
2929
"urgencyTag": {
3030
"index": 5,
3131
"label": "Pending Contract",
32-
"color": null,
33-
"colorScheme": {
34-
"foregroundColor": "#512DA8",
35-
"backgroundColor": "#EDE7F6"
36-
}
32+
"foregroundColor": "#512DA8",
33+
"backgroundColor": "#EDE7F6"
3734
},
3835
"description": "Proposal sent for website redesign and booking system integration",
3936
"thumbnailURL": null
@@ -62,4 +59,4 @@
6259
}
6360
}
6461
}
65-
}
62+
}

packages/experiments-realm/Contact/a01fc5c9-d70d-4b9c-aae4-384cf2b79b25.json

+2-8
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,7 @@
4141
"statusTag": {
4242
"lightColor": "#93C5FD",
4343
"darkColor": "#3B82F6",
44-
"index": null,
45-
"label": "Lead",
46-
"color": null,
47-
"colorScheme": {
48-
"foregroundColor": null,
49-
"backgroundColor": null
50-
}
44+
"label": "Lead"
5145
},
5246
"description": null,
5347
"thumbnailURL": "https://images.pexels.com/photos/4571943/pexels-photo-4571943.jpeg?auto=compress&cs=tinysrgb&w=300&h=300&dpr=1"
@@ -66,4 +60,4 @@
6660
}
6761
}
6862
}
69-
}
63+
}

packages/experiments-realm/Customer/0c71bda7-f4d8-451a-97cb-567a8fa31763.json

+3-13
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@
1515
},
1616
"type": {
1717
"index": 0,
18-
"label": "Mobile",
19-
"color": null,
20-
"colorScheme": {
21-
"foregroundColor": null,
22-
"backgroundColor": null
23-
}
18+
"label": "Mobile"
2419
}
2520
},
2621
"phoneOffice": {
@@ -30,12 +25,7 @@
3025
},
3126
"type": {
3227
"index": 2,
33-
"label": "Work",
34-
"color": null,
35-
"colorScheme": {
36-
"foregroundColor": null,
37-
"backgroundColor": null
38-
}
28+
"label": "Work"
3929
}
4030
},
4131
"socialLinks": [
@@ -65,4 +55,4 @@
6555
}
6656
}
6757
}
68-
}
58+
}

packages/experiments-realm/Customer/1274acf3-5b66-4373-89a2-fe8106c3d586.json

+3-13
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@
1515
},
1616
"type": {
1717
"index": 0,
18-
"label": "Mobile",
19-
"color": null,
20-
"colorScheme": {
21-
"foregroundColor": null,
22-
"backgroundColor": null
23-
}
18+
"label": "Mobile"
2419
}
2520
},
2621
"phoneOffice": {
@@ -30,12 +25,7 @@
3025
},
3126
"type": {
3227
"index": 1,
33-
"label": "Office",
34-
"color": null,
35-
"colorScheme": {
36-
"foregroundColor": null,
37-
"backgroundColor": null
38-
}
28+
"label": "Office"
3929
}
4030
},
4131
"socialLinks": [
@@ -65,4 +55,4 @@
6555
}
6656
}
6757
}
68-
}
58+
}

packages/experiments-realm/Customer/dddaeabf-1e95-480c-b158-0873e31fc66c.json

+3-13
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@
1515
},
1616
"type": {
1717
"index": 0,
18-
"label": "Mobile",
19-
"color": null,
20-
"colorScheme": {
21-
"foregroundColor": null,
22-
"backgroundColor": null
23-
}
18+
"label": "Mobile"
2419
}
2520
},
2621
"phoneOffice": {
@@ -30,12 +25,7 @@
3025
},
3126
"type": {
3227
"index": 1,
33-
"label": "Office",
34-
"color": null,
35-
"colorScheme": {
36-
"foregroundColor": null,
37-
"backgroundColor": null
38-
}
28+
"label": "Office"
3929
}
4030
},
4131
"socialLinks": [
@@ -65,4 +55,4 @@
6555
}
6656
}
6757
}
68-
}
58+
}

packages/experiments-realm/Deal/4fdd3053-14f1-4800-827f-d3e2a5c44ae8.json

+4-10
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,14 @@
66
"status": {
77
"index": 3,
88
"label": "Closed Won",
9-
"color": null,
10-
"colorScheme": {
11-
"foregroundColor": "#000000",
12-
"backgroundColor": "#E8F5E9"
13-
}
9+
"foregroundColor": "#000000",
10+
"backgroundColor": "#E8F5E9"
1411
},
1512
"priority": {
1613
"index": 1,
1714
"label": "Medium Priority",
18-
"color": null,
19-
"colorScheme": {
20-
"foregroundColor": "#000000",
21-
"backgroundColor": "#FFF0B3"
22-
}
15+
"foregroundColor": "#000000",
16+
"backgroundColor": "#FFF0B3"
2317
},
2418
"closeDate": "2024-04-30",
2519
"currentValue": {

packages/experiments-realm/Deal/50b65110-8335-4391-84ec-28cc9c0f22b3.json

+4-10
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,14 @@
66
"status": {
77
"index": 2,
88
"label": "Negotiation",
9-
"color": null,
10-
"colorScheme": {
11-
"foregroundColor": "#000000",
12-
"backgroundColor": "#FFF3E0"
13-
}
9+
"foregroundColor": "#000000",
10+
"backgroundColor": "#FFF3E0"
1411
},
1512
"priority": {
1613
"index": 2,
1714
"label": "High Priority",
18-
"color": null,
19-
"colorScheme": {
20-
"foregroundColor": "#000000",
21-
"backgroundColor": "#FFE0B2"
22-
}
15+
"foregroundColor": "#000000",
16+
"backgroundColor": "#FFE0B2"
2317
},
2418
"closeDate": "2024-05-30",
2519
"currentValue": {

0 commit comments

Comments
 (0)