Преглед изворни кода

Send AI reply reporting back to the conversation

彭峰 пре 2 дана
родитељ
комит
398ad7c67f

+ 1 - 1
test/governance-smoke.test.cjs

@@ -106,7 +106,7 @@ test('语伴引导与三条旧商城导航只传业务参数,保留 H5 支付
   const {requestedTarget}=require('../utils/web-view-target');
   let home,index,navigation;
   const wx={getStorageSync(){throw Error('Home must not read native identity');},redirectTo:options=>{navigation=options.url;}};
-  vm.runInNewContext(fs.readFileSync(path.join(root,'yuban/components/home/index.js'),'utf8'),{Component:def=>{home=def.methods;},wx});
+  vm.runInNewContext(fs.readFileSync(path.join(root,'yuban/components/home/index.js'),'utf8'),{Component:def=>{home=def.methods;},wx,require:()=>require('../utils/web-view-target')});
   function target(route) {
     const target=new URL(new URL(route,'https://local.invalid').searchParams.get('path'));
     for(const key of ['userId','mobile','token','sessionToken'])assert.equal(target.searchParams.has(key),false);

+ 30 - 25
test/service-desk.test.cjs

@@ -1,7 +1,7 @@
 const {test}=require('node:test');
 const assert=require('node:assert/strict');
 const {readFileSync}=require('node:fs');
-const {mapRecords, replyChoices, normalizeContactPhone}=require('../utils/service-desk');
+const {mapRecords, normalizeContactPhone, submitTicket}=require('../utils/service-desk');
 
 test('工单列表只保留用户可见字段并区分不同结单状态',()=>{
   const deleted={
@@ -19,32 +19,37 @@ test('工单列表只保留用户可见字段并区分不同结单状态',()=>{
   assert.ok(!JSON.stringify(items).includes('synthetic redacted'));
   assert.doesNotMatch(readFileSync(require.resolve('../yuban/pages/service-desk/index.wxml'),'utf8'),/internalNote/);
 });
-test('只列出可举报的回复,上一条消息保持可选并限制长度',()=>{
-  const choices=replyChoices([{role:'system',content:'系统消息'}, {role:'user',content:'上一条提问',id:'u'},
-    {role:'assistant',content:'合成回复',id:'a'}, {role:'assistant',content:'隐藏回复',hidden:true}]);
-  assert.equal(choices.length,1);
-  assert.equal(choices[0].id,'a');
-  assert.deepEqual(choices[0].previous,{id:'u',text:'上一条提问'});
-  assert.equal(normalizeContactPhone(' 138-0000-1234 '),'13800001234');
-  assert.equal(normalizeContactPhone('foo123'),'');
-});
 
-test('三个举报选择器有真实占位项,选第一条时产生从 0 到 1 的变化',()=>{
-  const {pickerChoices, selectedPickerIndex}=require('../utils/service-desk');
-  const one=[{id:'first',label:'只有一条'}];
-  assert.deepEqual(pickerChoices(one,'请选择').map(item=>item.label),['请选择','只有一条']);
-  assert.equal(selectedPickerIndex('0',one),-1);
-  assert.equal(selectedPickerIndex('1',one),0);
-  assert.equal(selectedPickerIndex('2',one),-1);
-  for(const index of [null,'',-1,1.5]) assert.equal(selectedPickerIndex(index,one),-1);
+test('AI 举报页只查看进度,可打开正式对话页且不传账号凭据', () => {
+  const {buildConversationWebViewPath, requestedTarget}=require('../utils/web-view-target');
   const markup=readFileSync(require.resolve('../yuban/pages/service-desk/index.wxml'),'utf8');
-  for(const index of ['sessionIndex','replyIndex','categoryIndex']) assert.ok(markup.includes('value="{{'+index+' + 1}}"'));
+  assert.match(markup,/bindtap="openConversation"/);
+  assert.match(markup,/举报此回复/);
+  assert.doesNotMatch(markup,/<picker|selectConversation|submitReport/);
+
+  let page;
+  let lastPath;
+  global.Page=definition=>{page=definition;};
+  global.wx={navigateTo:({url})=>{lastPath=url;}};
+  try {
+    require('../yuban/pages/service-desk/index.js');
+    page.openConversation();
+    assert.equal(lastPath,buildConversationWebViewPath());
+    const opts=new URL(lastPath,'https://local.invalid').searchParams;
+    assert.equal(opts.get('skipAuth'),'true');
+    assert.equal(requestedTarget(Object.fromEntries(opts)),
+      'https://www.yuban.co/home?fromStartup=1&source=wechat-miniprogram');
+  } finally {
+    delete global.Page;
+    delete global.wx;
+  }
 });
 
-test('举报保存区分会话失效、服务端拒绝和结果待核对',()=>{
-  const {submitErrorMessage}=require('../utils/service-desk');
-  assert.equal(submitErrorMessage({code:209},'ai_reply_report'),'登录已失效,请重新登录后提交举报。');
-  assert.equal(submitErrorMessage({code:119},'ai_reply_report'),'当前账号暂不能提交这段对话的举报,请重新登录并重新选择自己的对话。');
-  assert.equal(submitErrorMessage({code:100},'ai_reply_report'),'提交结果待核对,请先刷新处理记录。');
-  assert.ok(!submitErrorMessage({message:'synthetic private server detail'},'ai_reply_report').includes('synthetic'));
+test('原生提交入口拒绝 AI 举报写入,机构和问题反馈仍校验电话', async () => {
+  assert.equal(normalizeContactPhone(' 138-0000-1234 '),'13800001234');
+  assert.equal(normalizeContactPhone('foo123'),'');
+  const scope={parse:{Object(){throw Error('must not contact server');}}};
+  await assert.rejects(submitTicket(scope,'ai_reply_report',{}), /请在对话里举报此回复/);
+  await assert.rejects(submitTicket(scope,'cooperation',{}), /请填写有效联系电话/);
+  await assert.rejects(submitTicket(scope,'feedback',{}), /请填写有效联系电话/);
 });

+ 12 - 107
utils/service-desk.js

@@ -3,45 +3,9 @@ const { restrictionMessageForUser } = require('./login-restrictions');
 const TABS = [
   { key: 'cooperation', label: '机构合作', prefix: 'CO', initial: '待处理' },
   { key: 'feedback', label: '问题反馈', prefix: 'FB', initial: '待处理' },
-  { key: 'ai_reply_report', label: 'AI 回复举报', prefix: 'AR', initial: '已受理' },
+  { key: 'ai_reply_report', label: 'AI 回复举报' },
 ];
 
-const REPORT_CATEGORIES = [
-  { value: 'identity_misleading', label: 'AI 身份误导' },
-  { value: 'life_health_harm', label: '自伤、自杀或暴力不当回复' },
-  { value: 'emotional_manipulation', label: '情感操控或诱导沉迷' },
-  { value: 'privacy_leak', label: '隐私泄露' },
-  { value: 'minor_inappropriate', label: '未成年人不适宜' },
-  { value: 'other_harmful', label: '虚假或其他有害内容' },
-];
-
-function pickerChoices(items, label) {
-  return [{ label }, ...items.map(item => ({ label: item.label }))];
-}
-
-function selectedPickerIndex(value, items) {
-  if (typeof value !== 'number' && (typeof value !== 'string' || !/^\d+$/.test(value))) return -1;
-  const index = Number(value) - 1;
-  return Number.isInteger(index) && index >= 0 && index < items.length ? index : -1;
-}
-
-const INPUT_MESSAGES = [
-  '请填写有效联系电话', '请填写联系人姓名', '请填写问题描述',
-  '请先选择自己的对话', '请先选择要举报的 AI 回复', '请选择举报类型',
-];
-
-function submitErrorMessage(error, type) {
-  if (INPUT_MESSAGES.includes(error?.message)) return error.message;
-  if (type === 'ai_reply_report') {
-    const code = Number(error?.code || error?.statusCode);
-    if (code === 209 || code === 401) return '登录已失效,请重新登录后提交举报。';
-    if (code === 119 || code === 403) return '当前账号暂不能提交这段对话的举报,请重新登录并重新选择自己的对话。';
-    if (code === 101 || code === 404) return '这段对话已不可用,请重新选择。';
-    if (code === 111 || code === 142) return '举报资料未通过服务端校验,请重新选择对话和回复后提交。';
-  }
-  return '提交结果待核对,请先刷新处理记录。';
-}
-
 function normalizeContactPhone(value) {
   const phone = String(value || '').trim().replace(/[ ()-]/g, '');
   return /^\+?[0-9]{7,15}$/.test(phone) ? phone : '';
@@ -103,57 +67,14 @@ async function listTickets(scope, type) {
   return mapRecords(await query.find({ sessionToken: scope.sessionToken }), type);
 }
 
-async function listConversations(scope) {
-  const query = ownedQuery(scope, 'ChatSession', 'user');
-  query.select('title', 'sessionType');
-  query.descending('updatedAt');
-  query.limit(30);
-  const rows = await query.find({ sessionToken: scope.sessionToken });
-  return rows.filter(row => row.get('sessionType') !== 'recording').map(row => ({
-    id: row.id,
-    label: [row.get('title') || '对话', displayTime(row.updatedAt || row.createdAt)].filter(Boolean).join(' · '),
-  }));
-}
-
-function replyChoices(messages) {
-  if (!Array.isArray(messages)) return [];
-  let previous = null;
-  const replies = [];
-  messages.forEach((message, index) => {
-    if (!message || message.hidden === true) return;
-    const source = message.content ?? message.text;
-    const text = typeof source === 'string' ? source.trim().slice(0, 4000) : '';
-    if (!text) return;
-    const id = String(message.id || message.clientMessageId || index);
-    if (message.role === 'user') previous = { id, text };
-    if (message.role === 'assistant' || message.role === 'ai') {
-      replies.push({ id, text, previous, label: text.slice(0, 72) });
-    }
-  });
-  return replies.slice(-50).reverse();
-}
-
-async function listReplies(scope, sessionId) {
-  const query = ownedQuery(scope, 'ChatSession', 'user');
-  query.equalTo('objectId', sessionId);
-  query.select('messageList', 'sessionType');
-  const row = await query.first({ sessionToken: scope.sessionToken });
-  if (!row || row.get('sessionType') === 'recording') return [];
-  return replyChoices(row.get('messageList'));
-}
-
 async function submitTicket(scope, type, form) {
+  if (type === 'ai_reply_report') throw Error('请在对话里举报此回复');
   const tab = TABS.find(item => item.key === type);
   if (!tab) throw Error('工单类型无效');
-  const isAI = type === 'ai_reply_report';
   const name = String(form.name || '').trim();
-  const content = String(form.content || '').trim().slice(0, isAI ? 500 : 2000);
+  const content = String(form.content || '').trim().slice(0, 2000);
   const phone = normalizeContactPhone(form.phone);
-  const category = REPORT_CATEGORIES.find(item => item.value === form.category);
-  if (isAI && !form.sessionId) throw Error('请先选择自己的对话');
-  if (isAI && !form.reply?.text) throw Error('请先选择要举报的 AI 回复');
-  if (isAI && !category) throw Error('请选择举报类型');
-  if (!isAI && !phone) throw Error('请填写有效联系电话');
+  if (!phone) throw Error('请填写有效联系电话');
   if (type === 'cooperation' && !name) throw Error('请填写联系人姓名');
   if (type === 'feedback' && !content) throw Error('请填写问题描述');
 
@@ -164,32 +85,16 @@ async function submitTicket(scope, type, form) {
     submitter: pointer(scope.parse, '_User', scope.user.id),
     submitterName: (type === 'cooperation' ? name : (scope.user.get('nickname') || '微信用户')).slice(0, 80),
     ticketNo, ticketType: type, source: tab.label, progress: tab.initial, isDeleted: false,
-    content: content || (isAI ? category.label : ''),
+    contactPhone: phone, content,
   });
-  if (isAI) {
-    const reply = form.reply;
-    const consentedMessages = [];
-    if (form.includePrevious && reply.previous) {
-      consentedMessages.push({ role: 'user', messageId: reply.previous.id, content: reply.previous.text });
-    }
-    consentedMessages.push({ role: 'assistant', messageId: reply.id, content: reply.text });
-    ticket.set({
-      session: pointer(scope.parse, 'ChatSession', form.sessionId),
-      sessionId: form.sessionId, assistantMessageId: reply.id,
-      resolutionStatus: tab.initial, priority: category.value === 'life_health_harm' ? 'P0' : 'P1',
-      reportCategory: category.value, reportCategoryLabel: category.label, consentedMessages,
-      expectedHandledAt: new Date(Date.now() + 86400000),
-      idempotencyKey: ['ai-reply-report-v1', scope.user.id, form.sessionId, reply.id, category.value].join(':'),
-    });
-  } else {
-    ticket.set('contactPhone', phone);
-    if (type === 'cooperation') ticket.set('companyName', String(form.organization || '').trim().slice(0, 120));
-  }
+  if (type === 'cooperation') ticket.set('companyName', String(form.organization || '').trim().slice(0, 120));
   await ticket.save(null, { sessionToken: scope.sessionToken });
   return ticketNo;
 }
 
-module.exports = {
-  TABS, REPORT_CATEGORIES, authContext, listTickets, listConversations, listReplies, submitTicket,
-  mapRecords, replyChoices, normalizeContactPhone, pickerChoices, selectedPickerIndex, submitErrorMessage,
-};
+function submitErrorMessage(error) {
+  const messages = ['请填写有效联系电话', '请填写联系人姓名', '请填写问题描述'];
+  return messages.includes(error?.message) ? error.message : '提交结果待核对,请先刷新处理记录。';
+}
+
+module.exports = { TABS, authContext, listTickets, submitTicket, mapRecords, normalizeContactPhone, submitErrorMessage };

+ 8 - 1
utils/web-view-target.js

@@ -54,4 +54,11 @@ function requestedTarget(options = {}) {
   return withQuery(target, values, true);
 }
 
-module.exports = { readTarget, requestedTarget, withQuery };
+function buildConversationWebViewPath() {
+  const destination = withQuery('https://www.yuban.co/home', {
+    fromStartup: '1', source: 'wechat-miniprogram',
+  });
+  return '/common-page/pages/web-view/index?path=' + encodeURIComponent(destination) + '&skipAuth=true';
+}
+
+module.exports = { readTarget, requestedTarget, withQuery, buildConversationWebViewPath };

+ 2 - 18
yuban/components/home/index.js

@@ -1,8 +1,4 @@
-const H5_BASE = 'https://www.yuban.co/home';
-const STARTUP_SOURCE_PARAMS = {
-  fromStartup: '1',
-  source: 'wechat-miniprogram',
-};
+const { buildConversationWebViewPath } = require('../../../utils/web-view-target');
 
 Component({
   properties: {},
@@ -71,19 +67,7 @@ Component({
 
     buildWebViewPath() {
       // H5 maintains its own SMS session. Native account data stays in the mini program.
-      const h5Url = this.appendQuery(H5_BASE, STARTUP_SOURCE_PARAMS);
-      const encodedUrl = encodeURIComponent(h5Url);
-      return `/common-page/pages/web-view/index?path=${encodedUrl}&skipAuth=true`;
+      return buildConversationWebViewPath();
     },
-
-    appendQuery(url, params = {}) {
-      const query = Object.keys(params)
-        .filter((key) => params[key] !== null && params[key] !== undefined && params[key] !== '')
-        .map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`)
-        .join('&');
-
-      if (!query) return url;
-      return `${url}${url.indexOf('?') === -1 ? '?' : '&'}${query}`;
-    }
   }
 })

+ 22 - 75
yuban/pages/service-desk/index.js

@@ -1,20 +1,25 @@
-const {
-  TABS, REPORT_CATEGORIES, authContext, listTickets, listConversations, listReplies, submitTicket,
-  pickerChoices, selectedPickerIndex, submitErrorMessage,
-} = require('../../../utils/service-desk');
+const { TABS, authContext, listTickets, submitTicket, submitErrorMessage } = require('../../../utils/service-desk');
+const { buildConversationWebViewPath } = require('../../../utils/web-view-target');
 const { restrictionMessage, restrictionMessageForUser } = require('../../../utils/login-restrictions');
 
 const emptyForm = () => ({ name: '', organization: '', phone: '', content: '' });
 
 Page({
   data: {
-    tabs: TABS, categories: REPORT_CATEGORIES,
-    categoryChoices: pickerChoices(REPORT_CATEGORIES, '选择举报类型'), active: 'cooperation',
+    tabs: TABS, active: 'cooperation',
     signedIn: false, signingIn: false, loading: false, loadFailed: false,
     form: emptyForm(), records: [], submitting: false, notice: '',
-    conversations: [], conversationChoices: [], conversationsLoading: false, conversationsFailed: false, sessionIndex: -1,
-    replies: [], replyPickerChoices: [], repliesLoading: false, repliesFailed: false, replyIndex: -1, categoryIndex: -1,
-    includePrevious: false,
+  },
+
+  onLoad(options = {}) {
+    if (TABS.some(item => item.key === options.tab)) this.setData({ active: options.tab });
+  },
+
+  openConversation() {
+    wx.navigateTo({
+      url: buildConversationWebViewPath(),
+      fail: () => wx.showToast({ title: '对话暂时无法打开,请重试', icon: 'none' }),
+    });
   },
 
   onShow() {
@@ -22,14 +27,9 @@ Page({
     const owner = scope?.user.id || '';
     if (this.owner !== owner) {
       this.owner = owner;
-      this.setData({ signedIn: !!scope, records: [], notice: '', form: emptyForm(),
-        conversations: [], conversationChoices: [], replies: [], replyPickerChoices: [], sessionIndex: -1, replyIndex: -1,
-        categoryIndex: -1, includePrevious: false, conversationsLoading: false, repliesLoading: false,
-        conversationsFailed: false, repliesFailed: false, loading: false, loadFailed: false });
+      this.setData({ signedIn: !!scope, records: [], notice: '', form: emptyForm(), loading: false, loadFailed: false });
     }
-    if (!scope) return;
-    void this.refreshRecords();
-    if (this.data.active === 'ai_reply_report' && !this.data.conversations.length) void this.refreshConversations();
+    if (scope) void this.refreshRecords();
   },
 
   onUnload() { this.closed = true; },
@@ -63,8 +63,7 @@ Page({
   selectTab(event) {
     const active = event.currentTarget.dataset.key;
     if (this.data.submitting || active === this.data.active || !TABS.some(item => item.key === active)) return;
-    this.setData({ active, records: [], notice: '', loadFailed: false, form: emptyForm(),
-      sessionIndex: -1, replies: [], replyPickerChoices: [], replyIndex: -1, categoryIndex: -1, includePrevious: false, repliesLoading: false, repliesFailed: false });
+    this.setData({ active, records: [], notice: '', loadFailed: false, form: emptyForm() });
     this.onShow();
   },
 
@@ -85,54 +84,6 @@ Page({
     }
   },
 
-  async refreshConversations() {
-    const scope = authContext(getApp());
-    if (!scope || this.data.conversationsLoading) return;
-    this.setData({ conversationsLoading: true, conversationsFailed: false });
-    try {
-      const conversations = await listConversations(scope);
-      if (this.matches(scope)) this.setData({
-        conversations, conversationChoices: pickerChoices(conversations, '选择自己的近期对话'),
-      });
-    } catch {
-      if (this.matches(scope)) this.setData({ conversationsFailed: true });
-    } finally {
-      if (this.matches(scope)) this.setData({ conversationsLoading: false });
-    }
-  },
-
-  selectConversation(event) {
-    return this.loadReplies(selectedPickerIndex(event.detail.value, this.data.conversations));
-  },
-
-  async loadReplies(sessionIndex) {
-    const scope = authContext(getApp());
-    if (!scope) return;
-    const selected = this.data.conversations[sessionIndex];
-    const request = this.repliesRequest = (this.repliesRequest || 0) + 1;
-    const current = () => this.matches(scope) && request === this.repliesRequest && sessionIndex === this.data.sessionIndex;
-    this.setData({ sessionIndex, replies: [], replyPickerChoices: [], replyIndex: -1, includePrevious: false,
-      repliesLoading: !!selected, repliesFailed: false });
-    if (!selected) return;
-    try {
-      const replies = await listReplies(scope, selected.id);
-      if (current()) this.setData({ replies, replyPickerChoices: pickerChoices(replies, '选择要举报的回复') });
-    } catch {
-      if (current()) this.setData({ repliesFailed: true });
-    } finally {
-      if (current()) this.setData({ repliesLoading: false });
-    }
-  },
-
-  retryReplies() { void this.loadReplies(this.data.sessionIndex); },
-  selectReply(event) {
-    this.setData({ replyIndex: selectedPickerIndex(event.detail.value, this.data.replies), includePrevious: false });
-  },
-  selectCategory(event) {
-    this.setData({ categoryIndex: selectedPickerIndex(event.detail.value, REPORT_CATEGORIES) });
-  },
-  togglePrevious(event) { this.setData({ includePrevious: event.detail.value.includes('previous') }); },
-
   editField(event) {
     const key = event.currentTarget.dataset.key;
     if (Object.prototype.hasOwnProperty.call(emptyForm(), key)) this.setData({ ['form.' + key]: event.detail.value });
@@ -140,22 +91,18 @@ Page({
 
   async submit() {
     const scope = authContext(getApp());
-    if (this.data.submitting) return;
+    if (this.data.submitting || this.data.active === 'ai_reply_report') return;
     if (!scope) {
       this.onShow();
       this.setData({ notice: '登录已失效,请重新登录后提交。' });
       return;
     }
-    const { active, form, sessionIndex, conversations, replies, replyIndex, categoryIndex, includePrevious } = this.data;
+    const { active, form } = this.data;
     this.setData({ submitting: true, notice: '' });
     try {
-      const ticketNo = await submitTicket(scope, active, {
-        ...form, sessionId: conversations[sessionIndex]?.id, reply: replies[replyIndex],
-        category: REPORT_CATEGORIES[categoryIndex]?.value, includePrevious,
-      });
+      const ticketNo = await submitTicket(scope, active, form);
       if (!this.matches(scope)) return;
-      this.setData({ form: emptyForm(), replyIndex: -1, categoryIndex: -1, includePrevious: false,
-        notice: '提交成功,工单号 ' + ticketNo + '。处理结果可在本页查看。' });
+      this.setData({ form: emptyForm(), notice: '提交成功,工单号 ' + ticketNo + '。处理结果可在本页查看。' });
       void this.refreshRecords();
     } catch (error) {
       if (this.closed) return;
@@ -163,7 +110,7 @@ Page({
         this.onShow();
         this.setData({ notice: '登录已失效,请重新登录后提交。' });
       } else if (this.matches(scope)) {
-        this.setData({ notice: submitErrorMessage(error, active) });
+        this.setData({ notice: submitErrorMessage(error) });
       }
     } finally {
       if (!this.closed) this.setData({ submitting: false });

+ 12 - 31
yuban/pages/service-desk/index.wxml

@@ -4,13 +4,19 @@
       data-key="{{item.key}}" bindtap="selectTab" disabled="{{submitting}}">{{item.label}}</button>
   </view>
 
+  <view wx:if="{{active === 'ai_reply_report'}}" class="panel form">
+    <text class="section-title">在对话中举报</text>
+    <text class="instructions">打开对应的对话,在要举报的 AI 回复下点「···」→「举报此回复」。提交后可回到这里查看处理进度。</text>
+    <button class="primary" bindtap="openConversation">去对话中举报</button>
+  </view>
+
   <view wx:if="{{!signedIn}}" class="panel">
-    <text class="section-title">登录后提交并查看自己的工单</text>
+    <text class="section-title">{{active === 'ai_reply_report' ? '登录后查看自己的举报记录' : '登录后提交并查看自己的工单'}}</text>
     <button class="primary" bindtap="signIn" loading="{{signingIn}}" disabled="{{signingIn}}">微信登录</button>
     <text wx:if="{{notice}}" class="notice">{{notice}}</text>
   </view>
   <block wx:else>
-    <view class="panel form">
+    <view wx:if="{{active !== 'ai_reply_report'}}" class="panel form">
       <view wx:if="{{active === 'cooperation'}}" class="field">
         <text>联系人姓名</text>
         <input maxlength="80" value="{{form.name}}" data-key="name" bindinput="editField" placeholder="必填" />
@@ -19,41 +25,16 @@
         <text>机构名称</text>
         <input maxlength="120" value="{{form.organization}}" data-key="organization" bindinput="editField" placeholder="选填" />
       </view>
-      <view wx:if="{{active !== 'ai_reply_report'}}" class="field">
+      <view class="field">
         <text>联系电话</text>
         <input maxlength="30" value="{{form.phone}}" data-key="phone" bindinput="editField" placeholder="请输入可接通的电话" />
       </view>
-      <block wx:if="{{active === 'ai_reply_report'}}">
-        <text wx:if="{{conversationsLoading}}" class="meta">正在读取对话…</text>
-        <button wx:elif="{{conversationsFailed}}" class="secondary" bindtap="refreshConversations">重新读取对话</button>
-        <text wx:elif="{{!conversations.length}}" class="meta">暂无可举报的近期对话</text>
-        <picker wx:else mode="selector" range="{{conversationChoices}}" range-key="label" value="{{sessionIndex + 1}}" bindchange="selectConversation" disabled="{{submitting}}">
-          <view class="pick">{{sessionIndex < 0 ? '选择自己的近期对话' : conversations[sessionIndex].label}}</view>
-        </picker>
-        <text wx:if="{{repliesLoading}}" class="meta">正在读取回复…</text>
-        <button wx:elif="{{repliesFailed}}" class="secondary" bindtap="retryReplies">重新读取回复</button>
-        <text wx:elif="{{sessionIndex >= 0 && !replies.length}}" class="meta">这段对话暂无可选回复</text>
-        <picker wx:if="{{replies.length}}" mode="selector" range="{{replyPickerChoices}}" range-key="label" value="{{replyIndex + 1}}" bindchange="selectReply" disabled="{{submitting}}">
-          <view class="pick">{{replyIndex < 0 ? '选择要举报的回复' : replies[replyIndex].label}}</view>
-        </picker>
-        <view wx:if="{{replyIndex >= 0}}" class="excerpt">
-          <text class="meta">将随举报提交的 AI 回复</text>
-          <text selectable class="multiline">{{replies[replyIndex].text}}</text>
-          <checkbox-group wx:if="{{replies[replyIndex].previous}}" bindchange="togglePrevious">
-            <label><checkbox value="previous" checked="{{includePrevious}}" disabled="{{submitting}}" />同时提交我的上一条消息</label>
-            <text wx:if="{{includePrevious}}" selectable class="multiline">{{replies[replyIndex].previous.text}}</text>
-          </checkbox-group>
-        </view>
-        <picker mode="selector" range="{{categoryChoices}}" range-key="label" value="{{categoryIndex + 1}}" bindchange="selectCategory" disabled="{{submitting}}">
-          <view class="pick">{{categoryIndex < 0 ? '选择举报类型' : categories[categoryIndex].label}}</view>
-        </picker>
-      </block>
       <view class="field">
-        <text>{{active === 'cooperation' ? '合作诉求' : active === 'feedback' ? '问题描述' : '补充说明(选填)'}}</text>
-        <textarea maxlength="{{active === 'ai_reply_report' ? 500 : 2000}}" value="{{form.content}}"
+        <text>{{active === 'cooperation' ? '合作诉求' : '问题描述'}}</text>
+        <textarea maxlength="2000" value="{{form.content}}"
           data-key="content" bindinput="editField" placeholder="填写具体情况" auto-height />
       </view>
-      <button class="primary" bindtap="submit" loading="{{submitting}}" disabled="{{submitting}}">{{submitting ? '提交中…' : active === 'ai_reply_report' ? '提交举报' : '提交'}}</button>
+      <button class="primary" bindtap="submit" loading="{{submitting}}" disabled="{{submitting}}">{{submitting ? '提交中…' : '提交'}}</button>
       <text wx:if="{{notice}}" selectable class="notice">{{notice}}</text>
     </view>
 

+ 4 - 4
yuban/pages/service-desk/index.wxss

@@ -6,10 +6,10 @@ page { background: #110f1d; color: #f5f1ff; }
 .tab { flex: 1; background: #242035; padding: 0 8rpx; line-height: 76rpx; }
 .selected { background: #7045cb; }
 .panel { background: #1b1729; padding: 24rpx; border-radius: 22rpx; margin-bottom: 20rpx; }
-.form, .field, .record, .result, .excerpt { display: flex; flex-direction: column; gap: 12rpx; }
+.form, .field, .record, .result { display: flex; flex-direction: column; gap: 12rpx; }
 .form { gap: 24rpx; }
 .field, .record { font-size: 28rpx; }
-.field input, .field textarea, .pick { box-sizing: border-box; width: 100%; background: #282239; min-height: 76rpx; padding: 16rpx; border-radius: 12rpx; }
+.field input, .field textarea { box-sizing: border-box; width: 100%; background: #282239; min-height: 76rpx; padding: 16rpx; border-radius: 12rpx; }
 .primary { background: #7045cb; margin-top: 12rpx; }
 .secondary { background: #302747; }
 .mini, .status { flex-shrink: 0; padding: 0 18rpx; font-size: 24rpx; }
@@ -19,6 +19,6 @@ page { background: #110f1d; color: #f5f1ff; }
 .record { border-top: 1rpx solid #3e3551; padding: 20rpx 0; margin-top: 12rpx; }
 .status, .result { background: #302747; border-radius: 12rpx; }
 .status { line-height: 48rpx; }
-.result, .excerpt { padding: 16rpx; }
-.excerpt { background: #282239; border-radius: 12rpx; }
+.result { padding: 16rpx; }
+.instructions { color: #e2d8f1; font-size: 27rpx; line-height: 1.55; }
 .multiline { white-space: pre-wrap; word-break: break-word; line-height: 1.55; display: block; }