Skip to content

Commit f0d9719

Browse files
committed
Add last.fm integration
1 parent b372a6b commit f0d9719

File tree

5 files changed

+24
-3
lines changed

5 files changed

+24
-3
lines changed

typescript/packages/lookslike-prototype/src/components/com-app.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,24 @@ export class ComApp extends LitElement {
267267
in: {},
268268
outputType: {
269269
type: 'object',
270+
"properties": {
271+
"results": {
272+
"type": "object",
273+
"properties": {
274+
"albummatches": {
275+
"type": "object",
276+
"properties": {
277+
"albums": {
278+
"type": "array",
279+
"items": {
280+
"type": "object"
281+
}
282+
}
283+
}
284+
}
285+
}
286+
}
287+
}
270288
},
271289
body: `https://ws.audioscrobbler.com/2.0/?method=album.search&album=${query}&api_key=${lastFmKey}&format=json`
272290
})

typescript/packages/lookslike-prototype/src/components/com-thread.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export class ComThread extends LitElement {
9898
this.requestUpdate()
9999
})
100100
});
101+
101102
this.lastGraph = this.graph
102103
}
103104

typescript/packages/lookslike-prototype/src/eval.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const code = (src: string) => `
4545
4646
console.log('[begin]');
4747
const fn = function() { ${src} };
48-
const result = await fn();
48+
const result = fn();
4949
write('__result__', { tag: 'string', val: JSON.stringify(result) });
5050
console.log('[end]');
5151
}

typescript/packages/lookslike-prototype/src/llm.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ const toolSpec: ChatCompletionTool[] = [
8787
"type": "function",
8888
"function": {
8989
"name": "addMusicSearchNode",
90-
"description": `Adds a new fetch node to the graph to search last.fm.`,
90+
"description": `Adds a new fetch node to the graph to search last.fm.
91+
92+
Results are stored in result.albumsmatches.album
93+
`,
9194
"parameters": {
9295
"type": "object",
9396
"properties": {

typescript/packages/lookslike-prototype/src/ui.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export function createElement(node, context) {
2727
// repeat node
2828
if (!node.tag && node.type == 'repeat') {
2929
const container = document.createElement('div');
30-
debugger
3130
const items = readValue(context, node.binding) || [];
3231
items.forEach(item => {
3332
container.appendChild(createElement(node.template, item));

0 commit comments

Comments
 (0)