From 802d5beae9616b8876be0a3ab232ad9491edddf2 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Thu, 14 May 2026 16:46:48 +0100 Subject: [PATCH] =?UTF-8?q?cube(portal):=20=E5=8A=A0=20chatbot=20+=20creat?= =?UTF-8?q?e=5Fissue=20tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 入口页右下角浮动 chat — 走 mochi 同款 LLM gateway (gemma-4-31b-it), 单步 tool calling 实现 `create_issue` 调 gitea API 建 fam/cube issue。 LLM_API_TOKEN + GITEA_TOKEN 走 ns 内 secret `chat-credentials` (kubectl 手工创建,不进 git);gateway URL / model / 仓库地址走 env。 8 个 cargo test 覆盖 prompt / tool schema / tool_call 解析 / 错误。 顺手 git rm --cached 之前漏掉的 tsbuildinfo(已 gitignore)。 --- Cargo.lock | 5 + apps/cube/Cargo.toml | 5 + apps/cube/frontend/src/App.vue | 3 + apps/cube/frontend/src/components/Chatbot.vue | 292 ++++++++++++++ apps/cube/frontend/tsconfig.tsbuildinfo | 1 - apps/cube/k8s/all.yaml | 16 +- apps/cube/src/chat.rs | 381 ++++++++++++++++++ apps/cube/src/main.rs | 17 +- 8 files changed, 716 insertions(+), 4 deletions(-) create mode 100644 apps/cube/frontend/src/components/Chatbot.vue delete mode 100644 apps/cube/frontend/tsconfig.tsbuildinfo create mode 100644 apps/cube/src/chat.rs diff --git a/Cargo.lock b/Cargo.lock index 8e40b59..f9e01e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -154,8 +154,13 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" name = "cube" version = "0.1.0" dependencies = [ + "axum", "cube-core", + "reqwest", + "serde", + "serde_json", "tokio", + "tracing", ] [[package]] diff --git a/apps/cube/Cargo.toml b/apps/cube/Cargo.toml index 7d772a8..8395de3 100644 --- a/apps/cube/Cargo.toml +++ b/apps/cube/Cargo.toml @@ -8,4 +8,9 @@ description = "cube.famzheng.me — cube 平台入口门户(app #0)" [dependencies] cube-core = { path = "../../crates/cube-core" } +axum = { workspace = true } tokio = { workspace = true } +tracing = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +reqwest = { workspace = true } diff --git a/apps/cube/frontend/src/App.vue b/apps/cube/frontend/src/App.vue index 0481a02..817bda6 100644 --- a/apps/cube/frontend/src/App.vue +++ b/apps/cube/frontend/src/App.vue @@ -1,5 +1,6 @@ @@ -33,6 +34,8 @@ import { apps } from './apps' cube · monorepo at famzheng.me/gitea/fam/cube + + diff --git a/apps/cube/frontend/src/components/Chatbot.vue b/apps/cube/frontend/src/components/Chatbot.vue new file mode 100644 index 0000000..fa0091a --- /dev/null +++ b/apps/cube/frontend/src/components/Chatbot.vue @@ -0,0 +1,292 @@ + + +