chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import * as sdk from '@botpress/sdk'
|
||||
import * as env from './.genenv'
|
||||
import knowledge from './bp_modules/knowledge'
|
||||
import openai from './bp_modules/openai'
|
||||
import personality from './bp_modules/personality'
|
||||
import telegram from './bp_modules/telegram'
|
||||
|
||||
type OpenAiModel = sdk.z.infer<typeof openai.definition.entities.modelRef.schema>
|
||||
|
||||
export default new sdk.BotDefinition({})
|
||||
.addIntegration(telegram, {
|
||||
enabled: true,
|
||||
configuration: {
|
||||
botToken: env.KNOWLEDGIANI_TELEGRAM_BOT_TOKEN,
|
||||
typingIndicatorEmoji: true,
|
||||
},
|
||||
})
|
||||
.addIntegration(openai, {
|
||||
enabled: true,
|
||||
configuration: {},
|
||||
})
|
||||
.addPlugin(personality, {
|
||||
configuration: {
|
||||
model: 'gpt-3.5-turbo-0125' satisfies OpenAiModel['id'],
|
||||
personality: 'Respond as if you were Mario the famous video game character of Nintendo',
|
||||
},
|
||||
dependencies: {
|
||||
llm: {
|
||||
integrationAlias: 'openai',
|
||||
integrationInterfaceAlias: 'llm<modelRef>',
|
||||
},
|
||||
},
|
||||
})
|
||||
.addPlugin(knowledge, {
|
||||
configuration: {},
|
||||
dependencies: {
|
||||
llm: {
|
||||
integrationAlias: 'openai',
|
||||
integrationInterfaceAlias: 'llm<modelRef>',
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,13 @@
|
||||
import rootConfig from '../../eslint.config.mjs'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "@bp-bots/knowledgiani",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"postinstall": "genenv -o ./.genenv/index.ts -e KNOWLEDGIANI_TELEGRAM_BOT_TOKEN",
|
||||
"check:type": "tsc --noEmit",
|
||||
"check:bplint": "bp lint",
|
||||
"build": "bp add -y && bp build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/client": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/common": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*",
|
||||
"@botpresshub/knowledge": "workspace:*",
|
||||
"@botpresshub/openai": "workspace:*",
|
||||
"@botpresshub/personality": "workspace:*",
|
||||
"@botpresshub/telegram": "workspace:*",
|
||||
"@bpinternal/genenv": "0.0.1",
|
||||
"@types/json-schema": "^7.0.12",
|
||||
"@types/qs": "^6.9.7"
|
||||
},
|
||||
"bpDependencies": {
|
||||
"telegram": "../../integrations/telegram",
|
||||
"openai": "../../integrations/openai",
|
||||
"personality": "../../plugins/personality",
|
||||
"knowledge": "../../plugins/knowledge"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
# Knowledgiani
|
||||
@@ -0,0 +1,42 @@
|
||||
import * as bp from '.botpress'
|
||||
|
||||
const bot = new bp.Bot({
|
||||
actions: {},
|
||||
})
|
||||
|
||||
bot.on.message('text', async (props) => {
|
||||
console.info('Received text message:', props.message.payload.text)
|
||||
await props.client.createMessage({
|
||||
conversationId: props.message.conversationId,
|
||||
userId: props.ctx.botId,
|
||||
type: 'text',
|
||||
payload: {
|
||||
text: 'I dont know how to respond to that',
|
||||
},
|
||||
tags: {},
|
||||
})
|
||||
})
|
||||
|
||||
const fileKey = (url: string) => {
|
||||
const fileName = url.split('/').pop()
|
||||
if (!fileName) {
|
||||
return url
|
||||
}
|
||||
return fileName
|
||||
}
|
||||
|
||||
bot.on.message('file', async (props) => {
|
||||
console.info('Received file message:', props.message.payload.fileUrl)
|
||||
|
||||
const { fileUrl } = props.message.payload
|
||||
const key = fileKey(fileUrl)
|
||||
await props.client.uploadFile({
|
||||
key,
|
||||
url: fileUrl,
|
||||
index: true,
|
||||
})
|
||||
|
||||
console.info('File uploaded:', key)
|
||||
})
|
||||
|
||||
export default bot
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": { "*": ["./*"] },
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": [".botpress/**/*", "src/**/*", "*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user