feat: 百科rag

This commit is contained in:
Blizzard
2026-04-23 11:13:23 +08:00
parent 40f3a8cfa8
commit 9fe2fd42e0
23 changed files with 1129 additions and 69 deletions
+16 -4
View File
@@ -21,7 +21,8 @@ Page({
scrollTop: 0,
// Modal State
showIdentifyModal: false
showIdentifyModal: false,
isRefreshing: false
},
onLoad() {
@@ -40,6 +41,13 @@ Page({
this.setData({ scrollTop: Math.random() * 0.01 });
},
onRefresh() {
this.setData({ isRefreshing: true });
this.fetchWikiList(true).finally(() => {
this.setData({ isRefreshing: false });
});
},
// Fetch categories from API
fetchCategories() {
request.get('/wiki-class/list').then(res => {
@@ -52,8 +60,8 @@ Page({
// Fetch wiki list from API
fetchWikiList(reset = false) {
if (this.data.isLoading) return;
if (!reset && !this.data.hasMore) return;
if (this.data.isLoading) return Promise.resolve();
if (!reset && !this.data.hasMore) return Promise.resolve();
const current = reset ? 1 : this.data.current;
@@ -75,7 +83,7 @@ Page({
params.classId = [this.data.activeCategory];
}
request.post('/wiki/page', params).then(res => {
return request.post('/wiki/page', params).then(res => {
const data = res || {};
const list = data.list || [];
const total = data.total || 0;
@@ -207,6 +215,10 @@ Page({
openIdentifyModal() { this.setData({ showIdentifyModal: true }); },
goToAiChat() {
wx.navigateTo({ url: '/pages/wiki/chat/index' });
},
onPopupVisibleChange(e) {
this.setData({
showIdentifyModal: e.detail.visible