34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import path from 'path'
|
|
|
|
import { Logger } from 'tslog'
|
|
import { createLogger } from '@plastichub/osr-log'
|
|
import { CONFIG_DEFAULT, get_var } from '@plastichub/osr-commons'
|
|
import { MODULE_NAME } from './constants'
|
|
export const logger: Logger<unknown> = createLogger('llm-tools')
|
|
export { run } from './commands/run'
|
|
const isWindows = process.platform === 'win32'
|
|
export const module_root = () => path.resolve(path.join(get_var( isWindows ? 'HOMEPATH' : 'HOME'), `.${MODULE_NAME}`))
|
|
|
|
export const assistant_supported: Record<string, string> = {
|
|
".c": "text/x-c",
|
|
".cpp": "text/x-c++",
|
|
".cs": "text/x-csharp",
|
|
".css": "text/css",
|
|
".doc": "application/msword",
|
|
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
".go": "text/x-golang",
|
|
".html": "text/html",
|
|
".java": "text/x-java",
|
|
".js": "text/javascript",
|
|
".json": "application/json",
|
|
".md": "text/markdown",
|
|
".pdf": "application/pdf",
|
|
".php": "text/x-php",
|
|
".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
".py": "text/x-python", // sometimes text/x-script.python
|
|
".rb": "text/x-ruby",
|
|
".sh": "application/x-sh",
|
|
".tex": "text/x-tex",
|
|
".ts": "application/typescript",
|
|
".txt": "text/plain"
|
|
}; |