import { Component, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
    
import { IonContent,IonButton,IonSegment,IonSegmentButton,IonLabel,IonList,IonItem } from "@ionic/angular/standalone";
import { AgentStory } from '../story-loader/story.loader';

@Component({
  selector: 'app-page-hangzhou',
  templateUrl: './page-hangzhou.component.html',
  styleUrls: ['./page-hangzhou.component.scss'],
  standalone: true,
    imports:[
      CommonModule,
      IonContent,IonButton,
      IonSegment,IonSegmentButton,IonLabel,
      IonList,IonItem
    ]
})
export class PageHangzhouComponent  implements OnInit {
  tab:string = "vector"
  tabChange(ev:any){
    this.tab = ev.detail.value
  }
  constructor() { }

  ngOnInit() {}

  /**
   * 文档加载、分割、向量存储
   */
  fileList:Array<any> = [
    {
      title:`市委办公厅 市政府办公厅印发《关于服务保障“抓防控促发展”落实“人才生态37条”的补充意见》的通知`,
      url:`https://app.fmode.cn/dev/jxnu/case/2020%E5%B9%B4%E6%9D%AD%E5%B7%9E%E5%B8%82%E4%BA%BA%E6%89%8D37%E6%9D%A1.docx`
    },
    {
      title:"杭州市余杭区服务保障高层次人才创新创业政策实施细则",
      url:"https://app.fmode.cn/dev/jxnu/case/2022年杭州余杭.docx"
    }
  ]
  storyMap:any = {}
  preview(file:any){
    window.open(file.url,"_blank")
  }
  async loader(file:any){
    let story = new AgentStory();
    await story.loader(file.url);
    console.log(story.content);
    this.storyMap[file?.url] = story;
  }
  async splitter(story:AgentStory){

    await story.splitter();
  }
  async embedings(story:AgentStory){
    await story.embedings()
  }

}
