mirror of
https://github.com/ArthurDanjou/artchat.git
synced 2026-01-14 13:54:01 +01:00
- Created a new article on "Understanding AI Agents, LLMs, and RAG" detailing the synergy between AI agents, LLMs, and Retrieval-Augmented Generation. - Added an introductory article on "What is Machine Learning?" covering types, model selection, workflow, and evaluation metrics. chore: setup ESLint and Nuxt configuration - Added ESLint configuration for code quality. - Initialized Nuxt configuration with various modules and settings for the application. chore: initialize package.json and TypeScript configuration - Created package.json for dependency management and scripts. - Added TypeScript configuration for the project. feat: implement API endpoints for activity and stats - Developed API endpoint to fetch user activity from Lanyard. - Created a stats endpoint to retrieve Wakatime coding statistics with caching. feat: add various assets and images - Included multiple images and assets for articles and projects. - Added placeholder files to maintain directory structure. refactor: define types for chat, lanyard, time, and wakatime - Created TypeScript types for chat messages, Lanyard activities, time formatting, and Wakatime statistics.
58 lines
1.5 KiB
TypeScript
58 lines
1.5 KiB
TypeScript
import type { H3Event } from 'h3'
|
|
|
|
const cachedWakatimeCoding = defineCachedFunction(async (event: H3Event) => {
|
|
const config = useRuntimeConfig(event)
|
|
|
|
return await $fetch(`https://wakatime.com/share/${config.wakatime.userId}/${config.wakatime.coding}.json`)
|
|
}, {
|
|
maxAge: 24 * 60 * 60,
|
|
name: 'wakatime',
|
|
getKey: () => 'coding',
|
|
})
|
|
|
|
const cachedWakatimeEditors = defineCachedFunction(async (event: H3Event) => {
|
|
const config = useRuntimeConfig(event)
|
|
|
|
return await $fetch(`https://wakatime.com/share/${config.wakatime.userId}/${config.wakatime.editors}.json`)
|
|
}, {
|
|
maxAge: 24 * 60 * 60,
|
|
name: 'wakatime',
|
|
getKey: () => 'editors',
|
|
})
|
|
|
|
const cachedWakatimeOs = defineCachedFunction(async (event: H3Event) => {
|
|
const config = useRuntimeConfig(event)
|
|
|
|
return await $fetch(`https://wakatime.com/share/${config.wakatime.userId}/${config.wakatime.os}.json`)
|
|
}, {
|
|
maxAge: 24 * 60 * 60,
|
|
name: 'wakatime',
|
|
getKey: () => 'os',
|
|
})
|
|
|
|
const cachedWakatimeLanguages = defineCachedFunction(async (event: H3Event) => {
|
|
const config = useRuntimeConfig(event)
|
|
|
|
return await $fetch(`https://wakatime.com/share/${config.wakatime.userId}/${config.wakatime.languages}.json`)
|
|
}, {
|
|
maxAge: 24 * 60 * 60,
|
|
name: 'wakatime',
|
|
getKey: () => 'languages',
|
|
})
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
const [coding, editors, os, languages] = await Promise.all([
|
|
cachedWakatimeCoding(event),
|
|
cachedWakatimeEditors(event),
|
|
cachedWakatimeOs(event),
|
|
cachedWakatimeLanguages(event),
|
|
])
|
|
|
|
return {
|
|
coding,
|
|
editors,
|
|
os,
|
|
languages,
|
|
}
|
|
})
|