Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Pkmmte authored May 10, 2024
2 parents d95f907 + dcd2da5 commit d462ed1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
5 changes: 3 additions & 2 deletions packages/plugin-ai/src/api/ai/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface ApiChatResponse {

export default (req: RoboRequest<ApiChatRequest>): Promise<ApiChatResponse> => {
return new Promise((resolve, reject) => {
;(async () => {
const run = async () => {
const { messages } = req.body
if (!messages?.length) {
return reject('No message provided')
Expand All @@ -41,6 +41,7 @@ export default (req: RoboRequest<ApiChatRequest>): Promise<ApiChatResponse> => {
})
}
})
})()
}
run()
})
}
5 changes: 3 additions & 2 deletions packages/plugin-ai/src/events/typingStart/debounce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export function isUserTyping(userId: string) {

export function waitForTyping(userId: string) {
return new Promise<string[]>((resolve) => {
;(async () => {
const run = async () => {
// Loop until the user stops typing
while (isUserTyping(userId)) {
const state = UserStatus[userId]
Expand All @@ -137,6 +137,7 @@ export function waitForTyping(userId: string) {
}
logger.debug(`User @${userId} stopped typing. Context:`, context)
resolve(context)
})()
}
run()
})
}
4 changes: 3 additions & 1 deletion packages/robo/src/cli/utils/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,9 @@ async function generateEntries<T>(
}

// Add the entry to the context type
;(entries[contextType] as Record<string, T>)[fileKeys[1]] = entry
if (entries[contextType] as Record<string, T>) {
entries[fileKeys[1]] = entry
}
}

// Third level command? Add it to the parent subcommand (subcommand group)
Expand Down
17 changes: 10 additions & 7 deletions packages/robo/src/core/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ const filterEmpty =

const hexToRgb = (hex: string) => {
const match = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
return match
? {
r: parseInt(match[1], 16),
g: parseInt(match[2], 16),
b: parseInt(match[3], 16)
}
: null

if (!match) {
return null
}

return {
r: parseInt(match[1], 16),
g: parseInt(match[2], 16),
b: parseInt(match[3], 16)
}
}

const init = (
Expand Down

0 comments on commit d462ed1

Please sign in to comment.