MCPcopy Index your code
hub / github.com/NagariaHussain/doppio_bot

github.com/NagariaHussain/doppio_bot @v1.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.3.0 ↗ · + Follow
20 symbols 61 edges 26 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

DoppioBot

https://user-images.githubusercontent.com/34810212/233836702-c626bd91-4016-4731-89b0-a09c21e433c4.mp4

Use. Play. Extend. ChatGPT experience, built right into Frappe's desk interface.

Announcement Blog Post

You can read more on how DoppioBot is built, how to use it and how to extend it for your own applications in this blog post.

Tech Stack

Installation & Usage

Just like any other Frappe app, if you have bench installed, you can execute the following commands to install the DoppioBot app on your Frappe site:

bench get-app NagariaHussain/doppio_bot
bench --site <your-site> install-app doppio_bot

Then add your OpenAI API key to the site_config.json (of the site you have installed the app on):

"openai_api_key": "sk-your-secret-api-key"

Then navigate to your site, use the awesome bar for Ask DoppioBot, and enjoy!

Chat Interface

doppio_bot_cover_image

The Chat page is built using Frappe's Custom Pages feature, React, and ChakraUI.

Features

DoppioBot Feature Sneak

  • Session Chat history management with Redis
  • Formatting of markdown responses including tables and lists
  • Code block responses are syntax-highlighted and have a click to copy button!
  • A sleek loading skeleton is shown while the message is being fetched
  • The prompt can be submitted through mouse as well as keyboard (Cmd + Enter)

API

bot_fun_chat

The API that powers the chat page is built using the LangChain Python package.

Advanced Example: Agent with Custom Tool

Here is an example of an conversational agent that uses a custom tool that creates a ToDo document in the Frappe backend:

from langchain import OpenAI
from langchain.agents import tool
from langchain.agents import AgentType
from langchain.memory import ConversationBufferMemory
from langchain.agents import initialize_agent

llm = OpenAI(temperature=0)
memory = ConversationBufferMemory(memory_key="chat_history")
tools = [create_todo]

agent_chain = initialize_agent(
 tools,
 llm,
 agent=AgentType.CONVERSATIONAL_REACT_DESCRIPTION,
 verbose=True,
 memory=memory,
)

# Will call the tool with proper JSON and voila, magic!
agent.run("I have to create a college report before May 17, 2023, can you set a task for me?")

The tool that creates new ToDo documents in Frappe:

@tool
def create_todo(todo: str) -> str:
 """
 Create a new ToDo document, can be used when you need to store a note or todo or task for the user.
 It takes a json string as input and requires at least the `description`. Returns "done" if the
 todo was created and "failed" if the creation failed. Optionally it could contain a `date`
 field (in the JSON) which is the due date or reminder date for the task or todo. The `date` must follow
 the "YYYY-MM-DD" format. You don't need to add timezone to the date.
 """
 try:
  data = frappe.parse_json(todo)
  todo = frappe.new_doc("ToDo")
  todo.update(data)
  todo.save()
  return "done"
 except Exception:
  return "failed"

Learn more about creating custom tools here.

License

MIT

Core symbols most depended-on inside this repo

get_model_from_settings
called by 1
doppio_bot/api.py
handleSendMessage
called by 1
doppio_bot/public/js/ChatView.jsx
init
called by 1
doppio_bot/public/js/doppiobot_ui.bundle.jsx
load_doppiobot_ui
called by 1
doppio_bot/frappe_chatgpt_integration/page/doppio_bot/doppio_bot.js
get_chatbot_response
called by 0
doppio_bot/api.py
ChatView
called by 0
doppio_bot/public/js/ChatView.jsx
App
called by 0
doppio_bot/public/js/App.jsx
constructor
called by 0
doppio_bot/public/js/doppiobot_ui.bundle.jsx

Shape

Function 14
Class 4
Method 2

Languages

TypeScript80%
Python20%

Modules by API surface

doppio_bot/public/js/doppiobot_ui.bundle.jsx4 symbols
doppio_bot/public/js/components/message/MessageRenderer.jsx3 symbols
doppio_bot/public/js/components/message/CopyToClipboardButton.jsx2 symbols
doppio_bot/public/js/ChatView.jsx2 symbols
doppio_bot/api.py2 symbols
doppio_bot/public/js/components/message/MessageLoadingSkeletonText.jsx1 symbols
doppio_bot/public/js/components/message/MessageBubble.jsx1 symbols
doppio_bot/public/js/components/message/Message.jsx1 symbols
doppio_bot/public/js/App.jsx1 symbols
doppio_bot/frappe_chatgpt_integration/page/doppio_bot/doppio_bot.js1 symbols
doppio_bot/frappe_chatgpt_integration/doctype/doppiobot_settings/test_doppiobot_settings.py1 symbols
doppio_bot/frappe_chatgpt_integration/doctype/doppiobot_settings/doppiobot_settings.py1 symbols

For agents

$ claude mcp add doppio_bot \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page