ソースを参照

fix: new files

15207938132 2 ヶ月 前
コミット
2574e7c884

+ 100 - 0
fashion-app/docs-prod/a.md

@@ -0,0 +1,100 @@
+```plantuml
+@startuml
+'用户信息类'
+class UserInfo{
+    - UserID: String
+    - createAt: Date
+    - name: String
+    - gender: String
+    - age:String
+    - styleInfo: List<UserStyleInfo>
+    + get...()
+    + set...()
+    + requestGenerate()
+    + requestrecommend()
+    + save()
+}
+'用户风格信息类,每位用户可设置多个风格信息'
+class UserStyleInfo{
+    - objectID: String
+    - createAt: Date
+    - age: Int
+    - gender: String
+    - height: Int
+    - weight: Int
+    - season: String
+    - customDesc: String
+    - areaStyle: String
+    - function: String
+    - designIdea: String
+    - artStyle: String
+    - color: String
+    + get...()
+    + set...()
+}
+
+class GenerateResult{
+    - GID: String
+    - UID: String
+    - content: String
+    - image: String
+    + get...()
+    + set...()
+    + save(image,content)
+}
+
+class Process{
+    - generationService: GenerationService
+    - recommendService: RecommendService
+    - fashionService: FashionService
+}
+
+class GenerationService{
+    + generate(UserInfo)
+    + getResult(GID)
+}
+
+Process <.. GenerationService
+GenerationService -- GenerateResult
+UserInfo <.. Process
+UserInfo -- UserStyleInfo
+'用户偏好类,记录用户浏览偏好集合'
+class UserPrefer{
+    - objectID: String
+    - UserID: String
+    - ItemID: String
+    - preference: number
+    + get...()
+    + set...()
+}
+
+class ItemInfo{
+    - objectID: String
+    - name: String
+}
+UserInfo -- UserPrefer
+UserPrefer -- ItemInfo
+
+class RecommendService{
+    + recommend(UserInfo)
+}
+
+Process <.. RecommendService
+
+class FashionResult{
+    - FID: String
+    - jumpLink: String
+    - content: String
+    + get...()
+    + set...()
+    + save(jumpLink,content)
+}
+
+class FashionService{
+    + integrate()
+}
+
+FashionService -- FashionResult
+Process <.. FashionService
+@enduml
+```

+ 0 - 2
fashion-app/src/app/ai-chat-component/ai-chat-component.component.html

@@ -53,7 +53,6 @@
       </div>
     </div>
   </div>
-
   </div>
 </ion-content>
 
@@ -70,7 +69,6 @@
   </ng-template>
 </ion-modal>
 
-
 <!--底部内容-->
 <ion-footer style="background-color: #99d75c;">
   <ion-toolbar>

+ 47 - 5
fashion-app/src/app/ai-chat-component/ai-chat-component.component.ts

@@ -7,6 +7,8 @@ import { FmodeChatCompletion } from 'fmode-ng';
 import { addIcons } from 'ionicons';
 import { chevronBackSharp,  closeCircleOutline,  ellipsisHorizontal, happyOutline, micCircleOutline, paperPlane, sendOutline } from 'ionicons/icons';
 import { IonModal, IonLabel } from '@ionic/angular/standalone'; // 导入独立组件
+import { CloudObject, CloudQuery, CloudUser } from 'src/lib/ncloud';
+import { ActivatedRoute } from '@angular/router';
 
 addIcons({ chevronBackSharp,ellipsisHorizontal,micCircleOutline,happyOutline,paperPlane,closeCircleOutline,sendOutline });
 
@@ -40,7 +42,7 @@ export class AiChatComponentComponent  implements OnInit {
   isLoading: boolean = true; // AI生成文本加载状态,刚开始AI向你打招呼,所以处于加载状态
   isVoiceModalOpen=false; // 语音识别modal默认关闭
 
-  constructor(private navCtrl: NavController,private alertController: AlertController) {
+  constructor(private navCtrl: NavController,private route: ActivatedRoute) {
     // 初始化语音识别
     this.initSpeechRecognition();
    }
@@ -135,8 +137,15 @@ sendVoiceInput() {
   }
   this.isVoiceModalOpen=false; 
 }
-  goBack() {
-    this.navCtrl.back(); // 返回上一页
+  async goBack() {
+    const user = new CloudUser();
+    const currentUser = await user.current(); // 获取当前用户信息
+    if (currentUser) { // 判断用户是否登录
+
+    this.saveChatHistory(); // 保存聊天历史
+  }
+  this.navCtrl.back(); // 返回上一页
+
   }
 
   openOptions() {
@@ -145,10 +154,23 @@ sendVoiceInput() {
   }
 
   ngOnInit() {
-    // 发送初始化消息给AI
-    this.initializeChat();
+    this.route.params.subscribe(params => {
+      const chatId = params['chatId']; // 获取聊天记录ID
+      if (chatId) {
+        this.loadChatHistory(chatId); // 加载聊天记录
+      } else {
+        this.initializeChat(); // 初始化聊天
+      }
+    });
   }
 
+  async loadChatHistory(chatId: string) {
+    const query = new CloudQuery("ChatHistory");
+    const chatHistory = await query.get(chatId); // 获取聊天记录
+    this.messages = JSON.parse(chatHistory['content']); // 解析聊天内容
+}
+  
+
 //初始化聊天,将提示词添加到历史中
   initializeChat() {
     this.initialPrompt = `
@@ -270,4 +292,24 @@ addEmoji(emoji: string) {
 
 
 
+
+async saveChatHistory() {
+  const user = new CloudUser();
+  const currentUser = await user.current(); // 获取当前用户信息
+  if (currentUser) {
+    const chatHistory = new CloudObject("ChatHistory"); // 创建一个新的ChatHistory对象
+    chatHistory.set({
+      user: currentUser.toPointer(), // 指向当前用户
+      content: JSON.stringify(this.messages) // 将聊天记录转换为字符串
+    });
+    await chatHistory.save(); // 保存聊天记录
+    console.log("聊天记录已保存");
+  } else {
+    console.error("用户未登录,无法保存聊天记录");
+  }
+}
+
+
+
+
 }

+ 3 - 1
fashion-app/src/app/app.component.ts

@@ -1,4 +1,5 @@
 import { Component } from '@angular/core';
+import { Router } from '@angular/router';
 import { IonApp, IonRouterOutlet } from '@ionic/angular/standalone';
 
 @Component({
@@ -8,5 +9,6 @@ import { IonApp, IonRouterOutlet } from '@ionic/angular/standalone';
   imports: [IonApp, IonRouterOutlet],
 })
 export class AppComponent {
-  constructor() {}
+  constructor(private router: Router) {}
+  
 }

+ 74 - 0
fashion-app/src/app/chat-history/chat-history.component.html

@@ -0,0 +1,74 @@
+
+<div *ngIf="!selectedChat" class="history-frame">
+<ion-header *ngIf="!selectedChat">
+  <ion-toolbar>
+    <ion-buttons slot="start">
+      <ion-button (click)="goBack()">  <!--返回按钮-->
+        <ion-icon name="chevron-back-sharp" style="color: black; font-size:27px"></ion-icon>
+      </ion-button>
+    </ion-buttons>
+    <ion-title>聊天记录</ion-title>
+    <ion-buttons slot="end">
+      <ion-button >   <!--更多按钮-->
+        <ion-icon name="ellipsis-horizontal" style="color: black; font-size:27px"></ion-icon>
+      </ion-button>
+    </ion-buttons>
+  </ion-toolbar>
+</ion-header>
+  <ion-list>
+    <ion-item *ngFor="let chat of chatHistories">
+      <ion-label (click)="selectChatHistory(chat) ">
+        <h2>聊天记录 {{ chat.createdAt | date:'short' }}</h2>
+        <p>{{ chat.content }}</p>
+      </ion-label>
+    </ion-item>
+  </ion-list>
+</div>
+
+<div *ngIf="selectedChat">
+<!--头部内容-->
+<ion-header>
+  <ion-toolbar class="custom-toolbar" >
+    <ion-buttons slot="start">
+      <ion-button (click)="clearSelection()">  <!--返回按钮-->
+        <ion-icon name="chevron-back-sharp" style="color: black; font-size:27px"></ion-icon>
+      </ion-button>
+    </ion-buttons>
+    <ion-title>聊天内容</ion-title>  <!--名称-->
+    <ion-buttons slot="end">
+      <ion-button >   <!--更多按钮-->
+        <ion-icon name="ellipsis-horizontal" style="color: black; font-size:27px"></ion-icon>
+      </ion-button>
+    </ion-buttons>
+  </ion-toolbar>
+</ion-header>
+
+<!--聊天区域:聊天内容保存在messages-->
+
+  <div class="chat-container">
+    <div *ngFor="let message of selectedChat" class="message-container">
+      <!-- 用户消息 -->
+      <div *ngIf="message.sender === 'user'" class="message-content user-message-content">
+        <div class="message-bubble user-message">
+          {{ message.text }}
+        </div>
+        <div class="user-avatar">
+          <img src="../../assets/images/touxiang.jpg" alt="用户头像" />
+        </div>
+      </div>
+    
+      <!-- AI消息 -->
+      <div *ngIf="message.sender === 'ai'" class="message-content ai-message-content">
+        <div class="ai-avatar">
+          <img src="../../assets/images/cxtouxiang.jpg" alt="AI头像" />
+        </div>
+        <div class="message-bubble ai-message">
+          {{ message.text }}
+        </div>
+      </div>
+    </div>
+
+  </div>
+
+
+

+ 417 - 0
fashion-app/src/app/chat-history/chat-history.component.scss

@@ -0,0 +1,417 @@
+ion-toolbar {
+    height: 70px; /* 设置你想要的高度 */
+    --min-height: 60px; /* 设置最小高度 */
+    padding: 0; /* 去掉内边距 */
+    display: flex; /* 使用Flexbox布局 */
+    align-items: center; /* 垂直居中对齐 */
+    --background: transparent; /* 去除背景色 */
+  }
+  //头部样式
+  ion-header{
+    background-color: #99d75c ;
+    --background: transparent; /* 去除背景色 */
+  }
+  //头部标题
+  ion-title {
+    margin: 0; /* 去掉默认的外边距 */
+    flex: 1; /* 让标题占据剩余空间 */
+    text-align: center; /* 让标题文本居中 */
+    font-size: 24px;
+  }
+
+/* 文本输入框样式 */
+.input-box {
+  background-color: white; /* 设置输入框背景为白色 */
+  border-radius: 8px; /* 圆角 */
+ 
+  height: 40px; /* 高度 */
+  flex: 1; /* 让输入框占据剩余空间 */
+}
+
+/* 底部内容容器 */
+.footer-content {
+  display: flex; /* 使用Flexbox布局 */
+  align-items: center; /* 垂直居中对齐 */
+  justify-content: center; /* 水平居中对齐 */
+  width: 100%; /* 宽度100% */
+}
+//底部按钮样式
+ion-buttons {
+  margin: 0 5px; /* 按钮之间的间距 */
+}
+//底部发送按钮圆圈样式
+.circle{
+width: 35px;
+height: 35px;
+border-radius: 50%;
+border:2px white solid;
+display: flex; /* 使用Flexbox布局 */
+align-items: center; /* 垂直居中对齐 */
+justify-content: center; /* 水平居中对齐 */
+}
+
+//聊天内容容器样式
+.chat-container {
+  display: flex;
+  flex-direction: column;
+  padding-top: 10px;
+}
+//聊天内容样式(包括头像和消息)
+.message-container {
+  display: flex; /* 使用Flexbox布局 */
+  justify-content: flex-end; /* 用户消息在右边,AI消息在左边 */
+  margin: 10px 0; /* 消息之间的间距 */
+}
+//消息内容样式
+.message-content {
+  display: flex; /* 使用Flexbox布局 */
+  
+}
+//用户消息和头像样式
+.user-message-content {
+  justify-content: flex-end; /* 用户消息和头像在右边 */
+}
+//AI消息和头像样式
+.ai-message-content {
+  justify-content: flex-start; /* AI消息和头像在左边 */
+}
+/* 气泡样式 */
+.message-bubble {
+  background-color: #99d75c; /* 绿色气泡的背景色 */
+  color: white; /* 字体颜色 */
+  border-radius: 15px; /* 圆角 */
+  padding: 10px 15px; /* 内边距 */
+  max-width: 70%; /* 最大宽度 */
+  white-space: normal; /* 允许换行 */
+  overflow-wrap: break-word; /* 允许在单词边界换行 */
+}
+
+/* 用户消息样式 */
+.user-message {
+  background-color: #99d75c; /* 用户消息的颜色 */
+  margin-left: 10px; /* 与头像之间的间距 */
+}
+
+/* AI消息样式 */
+.ai-message {
+  background-color: white; /* AI消息的气泡颜色 */
+  color: black; /* 字体颜色 */
+  border: 1px solid black; /* 添加黑色边框 */
+  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); /* 添加阴影效果 */
+  margin-right: 10px; /* 与头像之间的间距 */
+}
+//用户头像样式
+.user-avatar {
+  width: 40px; /* 头像宽度 */
+  height: 40px; /* 头像高度 */
+  border-radius: 50%; /* 圆形 */
+  overflow: hidden; /* 超出部分隐藏 */
+  display: flex; /* 使用Flexbox布局 */
+  align-items: center; /* 垂直居中对齐 */
+  justify-content: center; /* 水平居中对齐 */
+  background-color: #f0f0f0; /* 背景色 */
+  border: 2px solid #99d75c; /* 边框颜色 */
+  margin-left: 5px; /* 与消息之间的间距 */
+}
+//AI头像样式
+.ai-avatar {
+  width: 40px; /* 头像宽度 */
+  height: 40px; /* 头像高度 */
+  border-radius: 50%; /* 圆形 */
+  overflow: hidden; /* 超出部分隐藏 */
+  display: flex; /* 使用Flexbox布局 */
+  align-items: center; /* 垂直居中对齐 */
+  justify-content: center; /* 水平居中对齐 */
+  background-color: #f0f0f0; /* 背景色 */
+  border: 2px solid #99d75c; /* 边框颜色 */
+  margin-right: 5px; /* 与消息之间的间距 */
+}
+//用户头像图片样式
+.user-avatar img {
+  width: 100%; /* 使图片适应头像框 */
+  height: 100%; /* 使图片适应头像框 */
+  object-fit: cover; /* 保持图片比例,裁剪多余部分 */
+}
+//AI头像图片样式
+.ai-avatar img {
+  width: 100%; /* 使图片适应头像框 */
+  height: 100%; /* 使图片适应头像框 */
+  object-fit: cover; /* 保持图片比例,裁剪多余部分 */
+}
+//语音框
+.yuyinframe{
+  --background: transparent; 
+  background-color: #99d75c; 
+  display: flex; 
+  flex-direction: column; 
+  justify-content: center; 
+  align-items: center;
+}
+.modal-content {
+  display: flex;
+  align-items: center; /* 垂直居中对齐 */
+  justify-content: center; /* 水平居中对齐 */
+  width: 100%; /* 宽度100% */
+  height: 25%;
+}
+//语音框中间内容框
+.timer-container {
+  height: 100%;
+  flex-direction: column; /* 垂直排列 */
+  
+  justify-content: center; /* 水平居中对齐 */
+
+}
+//计时器样式
+#timer{
+  width: 100%;
+  margin-top: 30px; /* 可根据需要调整这个值 */
+  text-align: center; /* 确保文本居中 */
+  margin-bottom: 10px;
+}
+
+/*语音取消按钮的样式 */
+.cancle-button {
+  font-size: 75px;
+  display: flex; /* 使用Flexbox布局 */
+  align-items: center; /* 垂直居中对齐 */
+  justify-content: center; /* 水平居中对齐 */
+  color: white;
+  background-color: #99d75c; 
+  margin-right: 20px;
+}
+
+/*语音发送按钮的样式 */
+.send-button {
+  height:60px ;
+  width: 60px;
+  border-radius: 50%;//圆
+  display: flex; /* 使用Flexbox布局 */
+  align-items: center; /* 垂直居中对齐 */
+  justify-content: center; /* 水平居中对齐 */
+  color: white;
+  background-color: #99d75c; 
+  border: 5px solid white;
+  margin-left: 20px;
+}
+
+
+//音律跳动
+.light {
+  width: 100%;
+  height: 90px;
+  display: flex;
+}
+
+.light span {
+  width: 10px;
+  border-radius: 18px;
+  margin-right: 20px;
+}
+
+.light span:nth-child(1) {
+  animation: bar1 2s 0.2s infinite linear;
+}
+
+.light span:nth-child(2) {
+  animation: bar2 2s 0.4s infinite linear;
+}
+
+.light span:nth-child(3) {
+  animation: bar3 2s 0.6s infinite linear;
+}
+
+.light span:nth-child(4) {
+  animation: bar4 2s 0.8s infinite linear;
+}
+
+.light span:nth-child(5) {
+  animation: bar5 2s 1.0s infinite linear;
+}
+
+.light span:nth-child(6) {
+  animation: bar6 2s 1.2s infinite linear;
+}
+
+.light span:nth-child(7) {
+  animation: bar7 2s 1.4s infinite linear;
+}
+
+.light span:nth-child(8) {
+  animation: bar8 2s 1.6s infinite linear;
+}
+
+.light span:nth-child(9) {
+  animation: bar9 2s 1.8s infinite linear;
+}
+//第一条音律加载动画
+@keyframes bar1 {
+  0% {
+      background: #f677b0;
+      margin-top: 25%;
+      height: 10%;
+  }
+
+  50% {
+      background: #f677b0;
+      height: 100%;
+      margin-top: 0%;
+  }
+
+  100% {
+      background: #f677b0;
+      height: 10%;
+      margin-top: 25%;
+  }
+}
+//第二条音律加载动画
+@keyframes bar2 {
+  0% {
+      background: #df7ff2;
+      margin-top: 25%;
+      height: 10%;
+  }
+
+  50% {
+      background: #df7ff2;
+      height: 100%;
+      margin-top: 0%;
+  }
+
+  100% {
+      background: #df7ff2;
+      height: 10%;
+      margin-top: 25%;
+  }
+}
+//第三条音律加载动画
+@keyframes bar3 {
+  0% {
+      background: #8c7ff2;
+      margin-top: 25%;
+      height: 10%;
+  }
+
+  50% {
+      background: #8c7ff2;
+      height: 100%;
+      margin-top: 0%;
+  }
+
+  100% {
+      background: #8c7ff2;
+      height: 10%;
+      margin-top: 25%;
+  }
+}
+//第四条音律加载动画
+@keyframes bar4 {
+  0% {
+      background: #024b6a;
+      margin-top: 25%;
+      height: 10%;
+  }
+
+  50% {
+      background: #024b6a;
+      height: 100%;
+      margin-top: 0%;
+  }
+
+  100% {
+      background: #024b6a;
+      height: 10%;
+      margin-top: 25%;
+  }
+}
+//第五条音律加载动画
+@keyframes bar5 {
+  0% {
+      background: #7ff2d3;
+      margin-top: 25%;
+      height: 10%;
+  }
+
+  50% {
+      background: #7ff2d3;
+      height: 100%;
+      margin-top: 0%;
+  }
+
+  100% {
+      background: #7ff2d3;
+      height: 10%;
+      margin-top: 25%;
+  }
+}
+//三个点的加载动画
+.loading-dots {
+  display: flex;
+  align-items: center;
+  margin-left: 10px; /* 气泡与点之间的间距 */
+}
+
+.loading-dot {
+  width: 8px;
+  height: 8px;
+  border-radius: 50%;
+  background-color: #99d75c; /* 点的颜色 */
+  margin: 0 2px; /* 点之间的间距 */
+  animation: loading 1s infinite; /* 加载动画 */
+}
+//第一个点
+.loading-dot:nth-child(1) {
+  animation-delay: 0s;
+}
+//第二个点
+.loading-dot:nth-child(2) {
+  animation-delay: 0.2s;
+}
+//第三个点
+.loading-dot:nth-child(3) {
+  animation-delay: 0.4s;
+}
+//加载动画
+@keyframes loading {
+  0%, 100% {
+    opacity: 0.5;
+  }
+  50% {
+    opacity: 1;
+  }
+}
+
+
+/* 表情选择器样式 */
+.emoji-picker {
+  --background: transparent; /* 去除默认样式 */
+  background-color: #99d75c; /* 背景颜色 */
+  padding: 10px;
+  display: flex;
+  justify-content: center; /* 水平居中 */
+  overflow: hidden; /* 隐藏多余内容 */
+}
+
+/* 表情容器用于支持滚动 */
+.emoji-container {
+  display: flex;
+  flex-wrap: wrap; /* 允许换行 */
+  overflow-y: auto; /* 允许纵向滚动 */
+  max-height: 70vh; /* 最大高度,防止超出屏幕 */
+  width: 100%; /* 容器宽度 */
+}
+
+/* 表情按钮 */
+.emoji-button {
+  margin: 5px; /* 每个表情与顶部的间距 */
+  font-size: 28px; /* 字体大小 */
+  height: 40px; /* 按钮高度 */
+  width: 40px; /* 按钮宽度 */
+  display: flex; /* 使用 flexbox 对齐 */
+  align-items: center; /* 垂直居中 */
+  justify-content: center; /* 水平居中 */
+  --background: transparent; /* 背景透明 */
+  --box-shadow: none; /* 去掉阴影 */
+  --outline: none; /* 去掉轮廓 */
+  border: none; /* 去掉边框 */
+}

+ 22 - 0
fashion-app/src/app/chat-history/chat-history.component.spec.ts

@@ -0,0 +1,22 @@
+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
+
+import { ChatHistoryComponent } from './chat-history.component';
+
+describe('ChatHistoryComponent', () => {
+  let component: ChatHistoryComponent;
+  let fixture: ComponentFixture<ChatHistoryComponent>;
+
+  beforeEach(waitForAsync(() => {
+    TestBed.configureTestingModule({
+      imports: [ChatHistoryComponent],
+    }).compileComponents();
+
+    fixture = TestBed.createComponent(ChatHistoryComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  }));
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 70 - 0
fashion-app/src/app/chat-history/chat-history.component.ts

@@ -0,0 +1,70 @@
+import { CommonModule } from '@angular/common';
+import { Component, OnInit } from '@angular/core';
+import { Router } from '@angular/router';
+import { IonButton, IonButtons, IonCard, IonCardContent, IonCardHeader, IonCardTitle, IonContent, IonFooter, IonHeader, IonIcon, IonInput, IonItem, IonLabel, IonList, IonTitle, IonToolbar, NavController } from '@ionic/angular/standalone';
+import { addIcons } from 'ionicons';
+import { chevronBackSharp, closeCircleOutline, ellipsisHorizontal, happyOutline, micCircleOutline, paperPlane, sendOutline } from 'ionicons/icons';
+import { CloudQuery, CloudUser } from 'src/lib/ncloud';
+
+addIcons({ chevronBackSharp,ellipsisHorizontal,micCircleOutline,happyOutline,paperPlane,closeCircleOutline,sendOutline });
+
+@Component({
+  selector: 'app-chat-history',
+  templateUrl: './chat-history.component.html',
+  styleUrls: ['./chat-history.component.scss'],
+  standalone: true,
+  imports: [IonHeader,IonToolbar,IonTitle,IonContent,IonList,IonItem,IonLabel,CommonModule,IonCard,IonCardHeader,IonCardTitle,
+    IonButton,IonCardContent,IonIcon,IonButtons,IonInput,IonFooter,IonInput,CommonModule],
+})
+export class ChatHistoryComponent  implements OnInit {
+
+  chatHistories: any[] = []; // 存储聊天记录
+  selectedChat: any; // 存储当前选择的聊天记录,json字符串
+
+
+  constructor(private router: Router,private navCtrl: NavController) {}
+
+  async ngOnInit() {
+    await this.loadChatHistories(); // 加载聊天记录
+  }
+
+  async loadChatHistories() {
+    const user = new CloudUser();
+    const currentUser = await user.current(); // 获取当前用户信息
+
+    if (currentUser) {
+      const query = new CloudQuery("ChatHistory");
+      query.equalTo("user", currentUser.toPointer()); // 查询当前用户的聊天记录
+      this.chatHistories = await query.find(); // 获取聊天记录
+      console.log("聊天记录已加载", this.chatHistories);
+    } else {
+      console.error("用户未登录,无法加载聊天记录");
+    }
+  }
+
+
+  // 选择聊天记录
+  selectChatHistory(chat: any) {
+    this.selectedChat = chat.data.content; // 更新当前选择的聊天记录
+    console.log("选择聊天记录", this.selectedChat);
+    // 解析 JSON 字符串为对象数组
+ this.selectedChat = JSON.parse(this.selectedChat);
+
+
+  }
+
+  // 清除选择
+  clearSelection() {
+    this.selectedChat = null; // 清除选择
+  }
+
+  goBack() {
+
+  this.navCtrl.back(); // 返回上一页
+
+  }
+
+  
+
+}
+

+ 2 - 1
fashion-app/src/app/page-ai-chat/page-ai-chat.component.html

@@ -1,7 +1,8 @@
 <div class="button-container">
   <ion-button fill="clear" (click)="openFashionChat()" class="chat-button">开始新聊天</ion-button>
   <ion-button fill="clear" (click)="restoreChat(chatId)" class="chat-button">继续上次聊天</ion-button>
-  <ion-button fill="clear" (click)="goaichat()" class="chat-button">聊天</ion-button>
+  <ion-button fill="clear" (click)="goaichat()" class="chat-button">聊天</ion-button> 
+  <ion-button fill="clear" (click)="gochathistory()" class="chat-button">历史记录</ion-button> 
 </div>
 
 

+ 4 - 0
fashion-app/src/app/page-ai-chat/page-ai-chat.component.ts

@@ -129,4 +129,8 @@ async loadUserProfileList(){
 goaichat(){
   this.router.navigate(['/tabs/chat'])
 }
+
+gochathistory(){
+  this.router.navigate(['/tabs/chathistory'])
+}
 }

+ 5 - 0
fashion-app/src/app/tabs/tabs.routes.ts

@@ -51,6 +51,11 @@ export const routes: Routes = [
         loadComponent: () =>
           import('../ai-chat-component/ai-chat-component.component').then((m) => m.AiChatComponentComponent),
       },
+      {
+        path: 'chathistory',
+        loadComponent: () =>
+          import('../chat-history/chat-history.component').then((m) => m.ChatHistoryComponent),
+      },
       
       {
         path: '',

+ 2 - 2
fashion-app/src/lib/ncloud.ts

@@ -234,9 +234,9 @@ export class CloudUser extends CloudObject {
             return null;
         }
         return this;
-        /*const response = await fetch(`http://1.94.237.145:1337/parse/users/me`, {
+        /*const response = await fetch(`http://1.94.237.145:1339/parse/users/me`, {
             headers: {
-                "x-parse-application-id": "hcx",
+                "x-parse-application-id": "ylj",
                 "x-parse-session-token": this.sessionToken // 使用sessionToken进行身份验证
             },
             method: "GET"