简介
本章节介绍如何使用 tio-boot+openai gpt4+telegram 开发一个翻译机器人
openai
前往 openai 申请 key 过程略
telegram
创建 telegram 机器人 过程略
数据库
create database gpt_translator;
数据表设计
max_kb_sentence_tanslate_cache
CREATE TABLE "max_kb_sentence_tanslate_cache" (
"id" "varchar" primary key,
"from" varchar,
"user_id" varchar,
"md5" varchar,
"src_lang" varchar,
"dst_lang" varchar,
"src_text" varchar,
"dst_text" varchar,
"model" varchar,
"system_fingerprint" VARCHAR,
"completion_tokens" INT,
"prompt_tokens" INT,
"total_tokens" INT
"elapsed" bigint,
);
CREATE INDEX "max_kb_sentence_tanslate_cache_md5" ON "public"."max_kb_embedding_cache" USING btree (
"md5" TEXT_OPS ASC NULLS LAST
);
CREATE INDEX "max_kb_sentence_tanslate_cache_md5_model" ON "public"."max_kb_embedding_cache" USING btree (
"md5" TEXT_OPS ASC NULLS LAST,
"model" TEXT_OPS ASC NULLS LAST
);