feat: 百科rag
This commit is contained in:
+16
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user