feat: AI assistant phase 2 - configurable prompt, action operations, FAQ matching, NVIDIA provider

- Admin-configurable AI prompt/quick questions from system_configs DB
- GET /api/v1/ai/quick-questions endpoint for fetching quick questions
- Local FAQ matching for instant responses (avoid AI calls for common Qs)
- AI action extraction: "add customer" intent detected, structured data returned
- Frontend action confirmation card with editable fields, calls customer API on confirm
- NVIDIA provider (stepfun-ai/step-3.5-flash) for faster chat vs deepseek-v4-flash
- Fixed httpx client timeout preventing backend hangs
- Added log_usage calls for auth events (register/login/guest/wechat)
- Admin tabs (users/stats/logs/config) fully functional with real backend
- AiAssistant component added to all tabbar pages
This commit is contained in:
TradeMate Dev
2026-05-20 09:39:22 +08:00
parent 4755cc75ba
commit f8a23855d2
20 changed files with 744 additions and 5 deletions
+4
View File
@@ -258,11 +258,13 @@
</view>
</view>
</view>
<AiAssistant />
</view>
</template>
<script setup>
import { ref, watch, computed } from 'vue'
import AiAssistant from '@/components/ai-assistant.vue'
import { onShow } from '@dcloudio/uni-app'
import { adminApi } from '@/utils/api.js'
@@ -297,6 +299,8 @@ const configLabels = {
feature_registration: '新用户注册',
free_daily_limits: '免费版每日配额',
pro_daily_limits: 'Pro 版每日配额',
ai_assistant_prompt: 'AI 助手系统提示词',
ai_assistant_quick_questions: 'AI 助手快捷提问',
}
const fieldLabels = (configKey, fieldKey) => {
@@ -338,11 +338,13 @@
</view>
</view>
</view>
<AiAssistant />
</view>
</template>
<script setup>
import { ref } from 'vue'
import AiAssistant from '@/components/ai-assistant.vue'
import { onShow } from '@dcloudio/uni-app'
import { customerApi, healthApi, silentPatternApi, whatsappApi, translateApi } from '@/utils/api.js'
+2
View File
@@ -253,6 +253,7 @@
</view>
<text class="footer-copyright">© 2026 北京宇之然科技中心. 保留所有权利.</text>
</view>
<AiAssistant />
</view>
</template>
@@ -260,6 +261,7 @@
import { ref, computed, onUnmounted } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { authApi, customerApi, analyticsApi, onboardingApi, notificationApi, followupApi, translateApi, BASE_URL } from '@/utils/api.js'
import AiAssistant from '@/components/ai-assistant.vue'
const showAnnouncement = ref(false)
const currentAnnouncement = ref(0)
@@ -143,11 +143,13 @@
<view class="empty" v-if="!loading && (!resultsMap[activeTab] || resultsMap[activeTab].length === 0)">
<text>{{ tabConfig[activeTab].emptyHint }}</text>
</view>
<AiAssistant />
</view>
</template>
<script setup>
import { ref, reactive, computed } from 'vue'
import AiAssistant from '@/components/ai-assistant.vue'
import { marketingApi, interactionApi, translateApi, BASE_URL } from '@/utils/api.js'
const tabConfig = {
+2
View File
@@ -191,11 +191,13 @@
</view>
</view>
</view>
<AiAssistant />
</view>
</template>
<script setup>
import { ref } from 'vue'
import AiAssistant from '@/components/ai-assistant.vue'
import { onShow } from '@dcloudio/uni-app'
import { productApi } from '@/utils/api.js'
@@ -242,11 +242,13 @@
</view>
</view>
</view>
<AiAssistant />
</view>
</template>
<script setup>
import { ref } from 'vue'
import AiAssistant from '@/components/ai-assistant.vue'
import { onShow } from '@dcloudio/uni-app'
import { quotationApi, customerApi } from '@/utils/api.js'
@@ -105,11 +105,13 @@
</view>
<view class="keyboard-height" :style="{ height: keyboardHeight + 'px' }"></view>
<AiAssistant />
</view>
</template>
<script setup>
import { ref } from 'vue'
import AiAssistant from '@/components/ai-assistant.vue'
import { translateApi, interactionApi, BASE_URL } from '@/utils/api.js'
const mode = ref('translate')