Skip to content

Instantly share code, notes, and snippets.

View notsobad's full-sized avatar

notsobad notsobad

View GitHub Profile
@notsobad
notsobad / vanna.md
Last active July 22, 2025 07:29
vanna.ai prompt
[{
    'role': 'system',
    'content': "You are a SQLite expert. Please help to generate a SQL query to answer the question. Your response should ONLY be based on the given context and follow the response guidelines and format instructions. \n===Tables \nCREATE TABLE [Album]\n(\n    [AlbumId] INTEGER  NOT NULL,\n    [Title] NVARCHAR(160)  NOT NULL,\n    [ArtistId] INTEGER  NOT NULL,\n    CONSTRAINT [PK_Album] PRIMARY KEY  ([AlbumId]),\n    FOREIGN KEY ([ArtistId]) REFERENCES [Artist] ([ArtistId]) \n\t\tON DELETE NO ACTION ON UPDATE NO ACTION\n)\n\nCREATE INDEX [IFK_AlbumArtistId] ON [Album] ([ArtistId])\n\nCREATE INDEX [IFK_TrackAlbumId] ON [Track] ([AlbumId])\n\nCREATE TABLE [Track]\n(\n    [TrackId] INTEGER  NOT NULL,\n    [Name] NVARCHAR(200)  NOT NULL,\n    [AlbumId] INTEGER,\n    [MediaTypeId] INTEGER  NOT NULL,\n    [GenreId] INTEGER,\n    [Composer] NVARCHAR(220),\n    [Milliseconds] INTEGER  NOT NULL,\n    [Bytes] INTEGER,\n    [UnitPrice] NUMERIC(10,2)  NOT NULL,\n    CONSTRAINT [PK_Track] PRI
# TODO: import the required dependencies
import pandas as pd

# Write code here
sql_query = """
    SELECT country, revenue 
 FROM table_3196ce98cf3ce3223735e1d61022e9d2 

Cherry studio use MCP with function call

Client ask question, and convert MCP tool to function call

{
    "model": "deepseek-v3-0324",
    "messages": [{
        "role": "user",
        "content": "当前时间是什么?"
    }],

使用function call形式实现MCP调用

这种方式,每个user消息中,带上一个tools,将mcp tools包装成function call提供给LLM。

User msg

{
    "messages": [{
        "content": "You are a helpful AI assistant.
You have access to the following tools:
@notsobad
notsobad / cherry-studio-mcp-system-prompt.txt
Last active July 7, 2025 09:44
cherry studio中使用mcp时,sytem prompt内容。
In this environment you have access to a set of tools you can use to answer the user's question. You can use one tool per message, and will receive the result of that tool use in the user's response. You use tools step-by-step to accomplish a given task, with each tool use informed by the result of the previous tool use.
## Tool Use Formatting
Tool use is formatted using XML-style tags. The tool name is enclosed in opening and closing tags, and each parameter is similarly enclosed within its own set of tags. Here's the structure:
<tool_use>
<name>{tool_name}</name>
<arguments>{json_arguments}</arguments>
@notsobad
notsobad / chromedpTest.go
Last active August 16, 2023 06:47
使用 chromedp,加载一个网页,获取网页加载的所有资源地址,获取页面里的所有链接地址
// Command click is a chromedp example demonstrating how to use a selector to
// click on an element.
package main
import (
"context"
"fmt"
"log"
"strings"
"time"
@notsobad
notsobad / ana.sh
Created October 17, 2022 06:32
run this script on machine first.
#!/bin/bash
run(){
cmd=$@
echo ">> $cmd"
eval $cmd
echo
}
run uptime
>python3 blackjack.py -h
usage: blackjack.py [-h] -n NROUND [-j BLACKJACK_NUM] [-u PLAYER_HIT_UNTIL] [-s PLAYER_SKIP_LARGE] [--verbose]
Blackjack
optional arguments:
-h, --help show this help message and exit
-n NROUND, --nround NROUND
-j BLACKJACK_NUM, --blackjack_num BLACKJACK_NUM
-u PLAYER_HIT_UNTIL, --player_hit_until PLAYER_HIT_UNTIL
@notsobad
notsobad / gist:aa252de8d23cae9f265d743f1d041be0
Created April 12, 2022 06:31
Use dns-reverse-proxy to route dns request to different server by domain name.
#!/bin/bash
# Get dns-reverse-proxy from https://github.com/notsobad/dns-reverse-proxy
pushd /xxx/dns-reverse-proxy
LAN_DNS=`systemd-resolve --status | grep 'DNS Servers'|cut -d ':' -f2|xargs`:53
echo "lan dns": $LAN_DNS
sudo ./dns-reverse-proxy\
-address 0.0.0.0:53 \
-default 114.114.114.114:53 \
@notsobad
notsobad / init.sh
Created April 12, 2022 06:27
Init script, so you can open several iterm2 tabs and ohter desktop apps.
#!/bin/bash
function tab () {
local cmd=""
local cdto="$PWD"
local args="$@"
if [ -d "$1" ]; then
cdto=`cd "$1"; pwd`
args="${@:2}"