mirror of
				https://github.com/xiaoyiweb/YiAi.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	更新模型列表/新增gpt-4o,gpt-4o-all,claude-3.5等模型识图/文件分析功能
This commit is contained in:
		
							
								
								
									
										10
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								README.md
									
									
									
									
									
								
							@@ -4,6 +4,16 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Yi - Ai 更新日志
 | 
					# Yi - Ai 更新日志
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## V2.6.0(20240705)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 功能优化
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					1. **更新模型列表,新增gpt-4o、claude3.5等热门模型**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2. **新增模型识图功能**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   - 支持gpt-4o识图功能,gpt-4o-all文件分析功能
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## V2.5.1(20240205)
 | 
					## V2.5.1(20240205)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### 功能优化
 | 
					### 功能优化
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "version": "2.5.0",
 | 
					  "version": "2.6.0",
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "dev": "vite",
 | 
					    "dev": "vite",
 | 
				
			||||||
    "build:test": "vue-tsc --noEmit && vite build --mode test",
 | 
					    "build:test": "vue-tsc --noEmit && vite build --mode test",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -166,6 +166,7 @@ export const MODEL_LIST = [
 | 
				
			|||||||
  "gpt-3.5-turbo",
 | 
					  "gpt-3.5-turbo",
 | 
				
			||||||
  "gpt-3.5-turbo-1106",
 | 
					  "gpt-3.5-turbo-1106",
 | 
				
			||||||
  "gpt-3.5-turbo-16k",
 | 
					  "gpt-3.5-turbo-16k",
 | 
				
			||||||
 | 
					  "gpt-3.5-turbo-instruct",
 | 
				
			||||||
  "gpt-4",
 | 
					  "gpt-4",
 | 
				
			||||||
  "gpt-4-0613",
 | 
					  "gpt-4-0613",
 | 
				
			||||||
  "gpt-4-32k",
 | 
					  "gpt-4-32k",
 | 
				
			||||||
@@ -174,10 +175,21 @@ export const MODEL_LIST = [
 | 
				
			|||||||
  "gpt-4-vision-preview",
 | 
					  "gpt-4-vision-preview",
 | 
				
			||||||
  "gpt-4-all",
 | 
					  "gpt-4-all",
 | 
				
			||||||
  "gpt-4-0125-preview",
 | 
					  "gpt-4-0125-preview",
 | 
				
			||||||
  'dall-e-3',
 | 
					  "gpt-4-turbo-2024-04-09",
 | 
				
			||||||
 | 
					  "gpt-4-turbo-preview",
 | 
				
			||||||
 | 
					  "gpt-4o",
 | 
				
			||||||
 | 
					  "gpt-4o-2024-05-13",
 | 
				
			||||||
 | 
					  "gpt-4o-all",
 | 
				
			||||||
 | 
					  "dall-e-3",
 | 
				
			||||||
  // claude
 | 
					  // claude
 | 
				
			||||||
  "claude-2.0",
 | 
					  "claude-2.0",
 | 
				
			||||||
  "claude-2.1",
 | 
					  "claude-2.1",
 | 
				
			||||||
 | 
					  "claude-3.0",
 | 
				
			||||||
 | 
					  "claude-3-5-sonnet-20240620",
 | 
				
			||||||
 | 
					  "claude-3-haiku-20240307",
 | 
				
			||||||
 | 
					  "claude-3-opus-20240229",
 | 
				
			||||||
 | 
					  "claude-3-sonnet-20240229",
 | 
				
			||||||
 | 
					  "claude-instant-1.2",
 | 
				
			||||||
  // gemini
 | 
					  // gemini
 | 
				
			||||||
  "gemini-pro",
 | 
					  "gemini-pro",
 | 
				
			||||||
  // 百度文心
 | 
					  // 百度文心
 | 
				
			||||||
@@ -200,6 +212,15 @@ export const MODEL_LIST = [
 | 
				
			|||||||
  "360GPT_S2_V9",
 | 
					  "360GPT_S2_V9",
 | 
				
			||||||
  // 讯飞星火
 | 
					  // 讯飞星火
 | 
				
			||||||
  "SparkDesk",
 | 
					  "SparkDesk",
 | 
				
			||||||
 | 
					  "SparkDesk-v3.5",
 | 
				
			||||||
 | 
					  // kimi
 | 
				
			||||||
 | 
					  "kimi",
 | 
				
			||||||
 | 
					  "kimi-128k",
 | 
				
			||||||
 | 
					  "kimi-all",
 | 
				
			||||||
 | 
					  //deepseek
 | 
				
			||||||
 | 
					  "deepseek",
 | 
				
			||||||
 | 
					  "deepseek-chat",
 | 
				
			||||||
 | 
					  "deepseek-coder",
 | 
				
			||||||
];
 | 
					];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 模型列表 0 mj   1 Dall-e
 | 
					// 模型列表 0 mj   1 Dall-e
 | 
				
			||||||
@@ -284,42 +305,63 @@ export const MODELSMAP = {
 | 
				
			|||||||
export const MODELSMAPLIST = {
 | 
					export const MODELSMAPLIST = {
 | 
				
			||||||
  1: [
 | 
					  1: [
 | 
				
			||||||
    "gpt-3.5-turbo",
 | 
					    "gpt-3.5-turbo",
 | 
				
			||||||
    "gpt-3.5-turbo-1106",
 | 
					  "gpt-3.5-turbo-1106",
 | 
				
			||||||
    "gpt-3.5-turbo-16k",
 | 
					  "gpt-3.5-turbo-16k",
 | 
				
			||||||
    "gpt-4",
 | 
					  "gpt-3.5-turbo-instruct",
 | 
				
			||||||
    "gpt-4-0613",
 | 
					  "gpt-4",
 | 
				
			||||||
    "gpt-4-32k",
 | 
					  "gpt-4-0613",
 | 
				
			||||||
    "gpt-4-32k-0613",
 | 
					  "gpt-4-32k",
 | 
				
			||||||
    "gpt-4-1106-preview",
 | 
					  "gpt-4-32k-0613",
 | 
				
			||||||
    "gpt-4-vision-preview",
 | 
					  "gpt-4-1106-preview",
 | 
				
			||||||
    "gpt-4-all",
 | 
					  "gpt-4-vision-preview",
 | 
				
			||||||
    "gpt-4-0125-preview",
 | 
					  "gpt-4-all",
 | 
				
			||||||
    'dall-e-3',
 | 
					  "gpt-4-0125-preview",
 | 
				
			||||||
    // claude
 | 
					  "gpt-4-turbo-2024-04-09",
 | 
				
			||||||
    "claude-2.0",
 | 
					  "gpt-4-turbo-preview",
 | 
				
			||||||
    "claude-2.1",
 | 
					  "gpt-4o",
 | 
				
			||||||
    // gemini
 | 
					  "gpt-4o-2024-05-13",
 | 
				
			||||||
    "gemini-pro",
 | 
					  "gpt-4o-all",
 | 
				
			||||||
    // 百度文心
 | 
					  "dall-e-3",
 | 
				
			||||||
    "ERNIE-Bot",
 | 
					  // claude
 | 
				
			||||||
    "ERNIE-Bot-4",
 | 
					  "claude-2.0",
 | 
				
			||||||
    "ERNIE-Bot-turbo",
 | 
					  "claude-2.1",
 | 
				
			||||||
    // 阿里通义
 | 
					  "claude-3.0",
 | 
				
			||||||
    "qwen-turbo",
 | 
					  "claude-3-5-sonnet-20240620",
 | 
				
			||||||
    "qwen-plus",
 | 
					  "claude-3-haiku-20240307",
 | 
				
			||||||
    "qwen-max",
 | 
					  "claude-3-opus-20240229",
 | 
				
			||||||
    "qwen-max-lingcontext",
 | 
					  "claude-3-sonnet-20240229",
 | 
				
			||||||
    // 腾讯混元
 | 
					  "claude-instant-1.2",
 | 
				
			||||||
    "hunyuan",
 | 
					  // gemini
 | 
				
			||||||
    // 清华智谱
 | 
					  "gemini-pro",
 | 
				
			||||||
    "chatglm_turbo",
 | 
					  // 百度文心
 | 
				
			||||||
    "chatglm_pro",
 | 
					  "ERNIE-Bot",
 | 
				
			||||||
    "chatglm_std",
 | 
					  "ERNIE-Bot-4",
 | 
				
			||||||
    "chatglm_lite",
 | 
					  "ERNIE-Bot-turbo",
 | 
				
			||||||
    // 360 智脑
 | 
					  // 阿里通义
 | 
				
			||||||
    "360GPT_S2_V9",
 | 
					  "qwen-turbo",
 | 
				
			||||||
    // 讯飞星火
 | 
					  "qwen-plus",
 | 
				
			||||||
    "SparkDesk",
 | 
					  "qwen-max",
 | 
				
			||||||
 | 
					  "qwen-max-lingcontext",
 | 
				
			||||||
 | 
					  // 腾讯混元
 | 
				
			||||||
 | 
					  "hunyuan",
 | 
				
			||||||
 | 
					  // 清华智谱
 | 
				
			||||||
 | 
					  "chatglm_turbo",
 | 
				
			||||||
 | 
					  "chatglm_pro",
 | 
				
			||||||
 | 
					  "chatglm_std",
 | 
				
			||||||
 | 
					  "chatglm_lite",
 | 
				
			||||||
 | 
					  // 360 智脑
 | 
				
			||||||
 | 
					  "360GPT_S2_V9",
 | 
				
			||||||
 | 
					  // 讯飞星火
 | 
				
			||||||
 | 
					  "SparkDesk",
 | 
				
			||||||
 | 
					  "SparkDesk-v3.5",
 | 
				
			||||||
 | 
					  // kimi
 | 
				
			||||||
 | 
					  "kimi",
 | 
				
			||||||
 | 
					  "kimi-128k",
 | 
				
			||||||
 | 
					  "kimi-all",
 | 
				
			||||||
 | 
					  //deepseek
 | 
				
			||||||
 | 
					  "deepseek",
 | 
				
			||||||
 | 
					  "deepseek-chat",
 | 
				
			||||||
 | 
					  "deepseek-coder",
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  2: [
 | 
					  2: [
 | 
				
			||||||
    "ERNIE-Bot",
 | 
					    "ERNIE-Bot",
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								chat/.env.development
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								chat/.env.development
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					# 本地链接生产
 | 
				
			||||||
 | 
					VITE_GLOB_API_URL=http://172.20.10.2:9520/api
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					VITE_GLOB_OPEN_LONG_REPLY=false
 | 
				
			||||||
 | 
					VITE_GLOB_APP_PWA=false
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	"name": "chatgpt-cooper",
 | 
						"name": "chatgpt-cooper",
 | 
				
			||||||
	"version": "2.5.0",
 | 
						"version": "2.6.0",
 | 
				
			||||||
	"private": true,
 | 
						"private": true,
 | 
				
			||||||
	"description": "ChatGPT Cooper",
 | 
						"description": "ChatGPT Cooper",
 | 
				
			||||||
	"author": "Yi <a8052@qq.com>",
 | 
						"author": "Yi <a8052@qq.com>",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,14 @@
 | 
				
			|||||||
<script setup lang='ts'>
 | 
					<script setup lang='ts'>
 | 
				
			||||||
import type { Ref } from 'vue'
 | 
					import type { Ref } from 'vue'
 | 
				
			||||||
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
 | 
					import {
 | 
				
			||||||
 | 
					  computed,
 | 
				
			||||||
 | 
					  nextTick,
 | 
				
			||||||
 | 
					  onMounted,
 | 
				
			||||||
 | 
					  onUnmounted,
 | 
				
			||||||
 | 
					  ref,
 | 
				
			||||||
 | 
					  watch,
 | 
				
			||||||
 | 
					  onBeforeUnmount,
 | 
				
			||||||
 | 
					} from 'vue'
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  NButton,
 | 
					  NButton,
 | 
				
			||||||
  NCard,
 | 
					  NCard,
 | 
				
			||||||
@@ -16,6 +24,7 @@ import {
 | 
				
			|||||||
  NSpace,
 | 
					  NSpace,
 | 
				
			||||||
  NPopselect,
 | 
					  NPopselect,
 | 
				
			||||||
  NText,
 | 
					  NText,
 | 
				
			||||||
 | 
					  NDropdown,
 | 
				
			||||||
} from 'naive-ui'
 | 
					} from 'naive-ui'
 | 
				
			||||||
import type { MessageRenderMessage } from 'naive-ui'
 | 
					import type { MessageRenderMessage } from 'naive-ui'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -35,6 +44,7 @@ import { SvgIcon } from '@/components/common'
 | 
				
			|||||||
import { useBasicLayout } from '@/hooks/useBasicLayout'
 | 
					import { useBasicLayout } from '@/hooks/useBasicLayout'
 | 
				
			||||||
import type { Theme } from '@/store/modules/app/helper'
 | 
					import type { Theme } from '@/store/modules/app/helper'
 | 
				
			||||||
import modelSvg from '@/assets/icons/modelSvg.svg'
 | 
					import modelSvg from '@/assets/icons/modelSvg.svg'
 | 
				
			||||||
 | 
					import voiceSvg from '@/assets/icons/voicetype.svg'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  useAppStore,
 | 
					  useAppStore,
 | 
				
			||||||
@@ -50,6 +60,12 @@ const uploadUrl = ref(`${import.meta.env.VITE_GLOB_API_URL}/upload/file`)
 | 
				
			|||||||
const useGlobalStore = useGlobalStoreWithOut()
 | 
					const useGlobalStore = useGlobalStoreWithOut()
 | 
				
			||||||
const authStore = useAuthStore()
 | 
					const authStore = useAuthStore()
 | 
				
			||||||
const route = useRoute()
 | 
					const route = useRoute()
 | 
				
			||||||
 | 
					const uploadModels = [
 | 
				
			||||||
 | 
					  'gpt-4-vision-preview',
 | 
				
			||||||
 | 
					  'gpt-4o',
 | 
				
			||||||
 | 
					  'gpt-4o-all',
 | 
				
			||||||
 | 
					  'claude-3-5-sonnet-20240620',
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
let controller = new AbortController()
 | 
					let controller = new AbortController()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const dialog = useDialog()
 | 
					const dialog = useDialog()
 | 
				
			||||||
@@ -90,35 +106,35 @@ const themeOptions: {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const videoOptions: {
 | 
					const videoOptions: {
 | 
				
			||||||
  label: string
 | 
					  label: string
 | 
				
			||||||
  value: string
 | 
					  key: string
 | 
				
			||||||
}[] = [
 | 
					}[] = [
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    value: 'alloy',
 | 
					    key: 'alloy',
 | 
				
			||||||
    label: 'alloy',
 | 
					    label: 'alloy',
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    value: 'echo',
 | 
					    key: 'echo',
 | 
				
			||||||
    label: 'echo',
 | 
					    label: 'echo',
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    value: 'fable',
 | 
					    key: 'fable',
 | 
				
			||||||
    label: 'fable',
 | 
					    label: 'fable',
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    value: 'nova',
 | 
					    key: 'nova',
 | 
				
			||||||
    label: 'nova',
 | 
					    label: 'nova',
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    value: 'onyx',
 | 
					    key: 'onyx',
 | 
				
			||||||
    label: 'onyx',
 | 
					    label: 'onyx',
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    value: 'shimmer',
 | 
					    key: 'shimmer',
 | 
				
			||||||
    label: 'shimmer',
 | 
					    label: 'shimmer',
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let currentVideo = ref('alloy')
 | 
					let voice = ref('alloy')
 | 
				
			||||||
const theme = computed(() => appStore.theme)
 | 
					const theme = computed(() => appStore.theme)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const globaelConfig = computed(() => authStore.globalConfig)
 | 
					const globaelConfig = computed(() => authStore.globalConfig)
 | 
				
			||||||
@@ -233,48 +249,72 @@ function handleSignIn() {
 | 
				
			|||||||
  useGlobalStore.updateSignInDialog(true)
 | 
					  useGlobalStore.updateSignInDialog(true)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const audioRef = ref(null)
 | 
					// onBeforeUnmount(() => {
 | 
				
			||||||
const audioState = ref('Play')
 | 
					//   // 判断音频是否正在播放
 | 
				
			||||||
function hendleVideo(item) {
 | 
					//   if (player && !player.paused) {
 | 
				
			||||||
  var data = JSON.stringify({
 | 
					//     // 如果音频正在播放,那么停止播放
 | 
				
			||||||
    model: 'tts-1',
 | 
					//     player.pause()
 | 
				
			||||||
    input: item.text,
 | 
					//     isResponseVideo.value = false
 | 
				
			||||||
    voice: 'alloy',
 | 
					//     isPlay.value = false
 | 
				
			||||||
  })
 | 
					//     player = null
 | 
				
			||||||
  axios({
 | 
					//   }
 | 
				
			||||||
    method: 'post',
 | 
					// })
 | 
				
			||||||
    url: 'https://api.oneapi.dwyu.cn/v1/audio/speech',
 | 
					 | 
				
			||||||
    headers: {
 | 
					 | 
				
			||||||
      Authorization:
 | 
					 | 
				
			||||||
        'Bearer sk-z726fTNvD1jzSBZ42e8dF919840b48A5820e4e5d9d4e70A4',
 | 
					 | 
				
			||||||
      'Content-Type': 'application/json',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    data: data,
 | 
					 | 
				
			||||||
  })
 | 
					 | 
				
			||||||
    .then(function (response) {
 | 
					 | 
				
			||||||
      console.log('--response.data', response.data)
 | 
					 | 
				
			||||||
      const audio = audioRef.value
 | 
					 | 
				
			||||||
      const blob = new Blob([response.data], { type: 'audio/mpeg' })
 | 
					 | 
				
			||||||
      if (!audio) return
 | 
					 | 
				
			||||||
      audio.src = URL.createObjectURL(blob)
 | 
					 | 
				
			||||||
      console.log(audio)
 | 
					 | 
				
			||||||
      audio.load()
 | 
					 | 
				
			||||||
      audio.play()
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // if (audio.paused) {
 | 
					// let isResponseVideo = ref(false)
 | 
				
			||||||
      //   audio.play()
 | 
					// let isPlay = ref(false)
 | 
				
			||||||
      //   audioState.value = 'Stop'
 | 
					// let player = null
 | 
				
			||||||
      // } else {
 | 
					 | 
				
			||||||
      //   audio.pause()
 | 
					 | 
				
			||||||
      //   audio.currentTime = 0
 | 
					 | 
				
			||||||
      //   audioState.value = 'Play'
 | 
					 | 
				
			||||||
      // }
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
    .catch(function (error) {
 | 
					 | 
				
			||||||
      console.error('There was an error fetching the audio data', error)
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// function hendleVideo(type, item) {
 | 
				
			||||||
 | 
					//   isResponseVideo.value = true
 | 
				
			||||||
 | 
					//   isPlay.value = true
 | 
				
			||||||
 | 
					//   if (!player) {
 | 
				
			||||||
 | 
					//     player = new window.Audio()
 | 
				
			||||||
 | 
					//   }
 | 
				
			||||||
 | 
					//   // 判断音频是否正在播放
 | 
				
			||||||
 | 
					//   if (!player.paused || type === 'stop') {
 | 
				
			||||||
 | 
					//     // 如果音频正在播放,那么停止播放
 | 
				
			||||||
 | 
					//     player.pause()
 | 
				
			||||||
 | 
					//     isResponseVideo.value = false
 | 
				
			||||||
 | 
					//     isPlay.value = false
 | 
				
			||||||
 | 
					//   } else {
 | 
				
			||||||
 | 
					//     // 如果音频已经暂停或者停止,那么开始播放
 | 
				
			||||||
 | 
					//     var data = JSON.stringify({
 | 
				
			||||||
 | 
					//       model: 'tts-1',
 | 
				
			||||||
 | 
					//       input: item.text,
 | 
				
			||||||
 | 
					//       voice: voice.value,
 | 
				
			||||||
 | 
					//     })
 | 
				
			||||||
 | 
					//     axios({
 | 
				
			||||||
 | 
					//       method: 'post',
 | 
				
			||||||
 | 
					//       url: '中转地址',
 | 
				
			||||||
 | 
					//       headers: {
 | 
				
			||||||
 | 
					//         Authorization:
 | 
				
			||||||
 | 
					//           'Bearer key密钥',
 | 
				
			||||||
 | 
					//         'Content-Type': 'application/json',
 | 
				
			||||||
 | 
					//       },
 | 
				
			||||||
 | 
					//       responseType: 'arraybuffer', // 设置 responseType 为 'arraybuffer'
 | 
				
			||||||
 | 
					//       data: data,
 | 
				
			||||||
 | 
					//     })
 | 
				
			||||||
 | 
					//       .then(async function (response) {
 | 
				
			||||||
 | 
					//         if (!isResponseVideo.value) return
 | 
				
			||||||
 | 
					//         const blob = new Blob([response.data], { type: 'audio/mpeg' })
 | 
				
			||||||
 | 
					//         player.src = URL.createObjectURL(blob)
 | 
				
			||||||
 | 
					//         player.load()
 | 
				
			||||||
 | 
					//         player.play()
 | 
				
			||||||
 | 
					//         // 监听音频播放结束事件
 | 
				
			||||||
 | 
					//         player.onended = function () {
 | 
				
			||||||
 | 
					//           isPlay.value = false
 | 
				
			||||||
 | 
					//         }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//         isResponseVideo.value = false
 | 
				
			||||||
 | 
					//       })
 | 
				
			||||||
 | 
					//       .catch(function (error) {
 | 
				
			||||||
 | 
					//         isResponseVideo.value = false
 | 
				
			||||||
 | 
					//         player.onended = null
 | 
				
			||||||
 | 
					//         isPlay.value = false
 | 
				
			||||||
 | 
					//         console.error('There was an error fetching the audio data', error)
 | 
				
			||||||
 | 
					//       })
 | 
				
			||||||
 | 
					//   }
 | 
				
			||||||
 | 
					// }
 | 
				
			||||||
// 解析文件 gpt-4-all逆向
 | 
					// 解析文件 gpt-4-all逆向
 | 
				
			||||||
let curFile: File | null
 | 
					let curFile: File | null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -831,6 +871,11 @@ function onInputeTip() {
 | 
				
			|||||||
  nextTick(() => getTipsRefHeight())
 | 
					  nextTick(() => getTipsRefHeight())
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function handleSelect(key) {
 | 
				
			||||||
 | 
					  voice.value = key
 | 
				
			||||||
 | 
					  ms.success(`切换语音模式成功,当前使用:${key}`)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
onMounted(async () => {
 | 
					onMounted(async () => {
 | 
				
			||||||
  chatStore.queryChatPre()
 | 
					  chatStore.queryChatPre()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -898,7 +943,7 @@ onUnmounted(() => {
 | 
				
			|||||||
                :imageUrl="item.imageUrl"
 | 
					                :imageUrl="item.imageUrl"
 | 
				
			||||||
                @regenerate="handleSubmit(index)"
 | 
					                @regenerate="handleSubmit(index)"
 | 
				
			||||||
                @delete="handleDelete(item)"
 | 
					                @delete="handleDelete(item)"
 | 
				
			||||||
                @video="hendleVideo(item)"
 | 
					                :isPlay="isPlay"
 | 
				
			||||||
              />
 | 
					              />
 | 
				
			||||||
              <div class="sticky bottom-1 left-0 flex justify-center">
 | 
					              <div class="sticky bottom-1 left-0 flex justify-center">
 | 
				
			||||||
                <NButton v-if="loading" @click="handleStop">
 | 
					                <NButton v-if="loading" @click="handleStop">
 | 
				
			||||||
@@ -1051,6 +1096,24 @@ onUnmounted(() => {
 | 
				
			|||||||
            </template>
 | 
					            </template>
 | 
				
			||||||
            切换模型
 | 
					            切换模型
 | 
				
			||||||
          </NTooltip>
 | 
					          </NTooltip>
 | 
				
			||||||
 | 
					          <!-- <NDropdown
 | 
				
			||||||
 | 
					            trigger="hover"
 | 
				
			||||||
 | 
					            :options="videoOptions"
 | 
				
			||||||
 | 
					            @select="handleSelect"
 | 
				
			||||||
 | 
					          >
 | 
				
			||||||
 | 
					            <NButton
 | 
				
			||||||
 | 
					              icon-placement="left"
 | 
				
			||||||
 | 
					              class="shrink0 flex h-8 w-8 items-center justify-center rounded border transition dark:border-neutral-700 dark:hover:bg-[#33373c]"
 | 
				
			||||||
 | 
					              style="height: 2rem; padding: 0 8px"
 | 
				
			||||||
 | 
					            >
 | 
				
			||||||
 | 
					              <template #icon>
 | 
				
			||||||
 | 
					                <span class="text-base text-slate-500 dark:text-slate-400">
 | 
				
			||||||
 | 
					                  <img :src="voiceSvg" class="h-8" alt="" />
 | 
				
			||||||
 | 
					                </span>
 | 
				
			||||||
 | 
					              </template>
 | 
				
			||||||
 | 
					              <span style="color: #3076fd">{{ voice }}</span>
 | 
				
			||||||
 | 
					            </NButton>
 | 
				
			||||||
 | 
					          </NDropdown> -->
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
      <div
 | 
					      <div
 | 
				
			||||||
@@ -1100,9 +1163,9 @@ onUnmounted(() => {
 | 
				
			|||||||
                  <NTooltip
 | 
					                  <NTooltip
 | 
				
			||||||
                    v-if="
 | 
					                    v-if="
 | 
				
			||||||
                      !dataBase64 &&
 | 
					                      !dataBase64 &&
 | 
				
			||||||
                      (chatStore.activeConfig.modelInfo.model === 'gpt-4-all' ||
 | 
					                      uploadModels.includes(
 | 
				
			||||||
                        chatStore.activeConfig.modelInfo.model ===
 | 
					                        chatStore.activeConfig.modelInfo.model
 | 
				
			||||||
                          'gpt-4-vision-preview')
 | 
					                      )
 | 
				
			||||||
                    "
 | 
					                    "
 | 
				
			||||||
                    trigger="hover"
 | 
					                    trigger="hover"
 | 
				
			||||||
                    placement="bottom-end"
 | 
					                    placement="bottom-end"
 | 
				
			||||||
@@ -1122,7 +1185,11 @@ onUnmounted(() => {
 | 
				
			|||||||
                            style="display: none"
 | 
					                            style="display: none"
 | 
				
			||||||
                            :accept="
 | 
					                            :accept="
 | 
				
			||||||
                              chatStore.activeConfig.modelInfo.model ===
 | 
					                              chatStore.activeConfig.modelInfo.model ===
 | 
				
			||||||
                              'gpt-4-vision-preview'
 | 
					                                'gpt-4-vision-preview' ||
 | 
				
			||||||
 | 
					                              chatStore.activeConfig.modelInfo.model ===
 | 
				
			||||||
 | 
					                                'gpt-4o' ||
 | 
				
			||||||
 | 
					                              chatStore.activeConfig.modelInfo.model ===
 | 
				
			||||||
 | 
					                                'claude-3-5-sonnet-20240620'
 | 
				
			||||||
                                ? 'image/*'
 | 
					                                ? 'image/*'
 | 
				
			||||||
                                : 'text/plain,image/*, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/pdf'
 | 
					                                : 'text/plain,image/*, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/pdf'
 | 
				
			||||||
                            "
 | 
					                            "
 | 
				
			||||||
@@ -1233,10 +1300,6 @@ onUnmounted(() => {
 | 
				
			|||||||
        />
 | 
					        />
 | 
				
			||||||
      </NCard>
 | 
					      </NCard>
 | 
				
			||||||
    </NModal>
 | 
					    </NModal>
 | 
				
			||||||
 | 
					 | 
				
			||||||
    <!-- <audio ref="audioRef" controls>
 | 
					 | 
				
			||||||
      <source type="audio/mpeg" />
 | 
					 | 
				
			||||||
    </audio> -->
 | 
					 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "yi-ai",
 | 
					  "name": "yi-ai",
 | 
				
			||||||
  "version": "2.5.0",
 | 
					  "version": "2.6.0",
 | 
				
			||||||
  "description": "使用 Nestjs 和 Vue3 搭建的 AIGC 生态社区 持续集成AI能力到社区之中",
 | 
					  "description": "使用 Nestjs 和 Vue3 搭建的 AIGC 生态社区 持续集成AI能力到社区之中",
 | 
				
			||||||
  "main": "index.js",
 | 
					  "main": "index.js",
 | 
				
			||||||
  "author": "longyanjiang",
 | 
					  "author": "longyanjiang",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "service",
 | 
					  "name": "service",
 | 
				
			||||||
  "version": "2.5.0",
 | 
					  "version": "2.6.0",
 | 
				
			||||||
  "description": "",
 | 
					  "description": "",
 | 
				
			||||||
  "author": "",
 | 
					  "author": "",
 | 
				
			||||||
  "private": true,
 | 
					  "private": true,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ export enum VerificationUseStatusEnum {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const ModelsMapCn = {
 | 
					export const ModelsMapCn = {
 | 
				
			||||||
  1: '系统内置大模型',
 | 
					  1: 'Ai大模型',
 | 
				
			||||||
  2: '百度千帆大模型',
 | 
					  2: '百度千帆大模型',
 | 
				
			||||||
  3: '清华智谱大模型'
 | 
					  3: '清华智谱大模型'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -97,7 +97,7 @@ export class NineStore implements NineStoreInterface {
 | 
				
			|||||||
    let nextNumTokensEstimate = 0;
 | 
					    let nextNumTokensEstimate = 0;
 | 
				
			||||||
    // messages.push({ role: 'system', content: systemMessage, name })
 | 
					    // messages.push({ role: 'system', content: systemMessage, name })
 | 
				
			||||||
    if (systemMessage) {
 | 
					    if (systemMessage) {
 | 
				
			||||||
      const specialModels = ['gemini-pro', 'ERNIE','hunyuan'];
 | 
					      const specialModels = ['gemini-pro', 'ERNIE', 'hunyuan'];
 | 
				
			||||||
      const isSpecialModel = activeModel && specialModels.some((specialModel) => activeModel.includes(specialModel));
 | 
					      const isSpecialModel = activeModel && specialModels.some((specialModel) => activeModel.includes(specialModel));
 | 
				
			||||||
      if (isSpecialModel) {
 | 
					      if (isSpecialModel) {
 | 
				
			||||||
        messages.push({ role: 'user', content: systemMessage, name });
 | 
					        messages.push({ role: 'user', content: systemMessage, name });
 | 
				
			||||||
@@ -108,8 +108,9 @@ export class NineStore implements NineStoreInterface {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    const systemMessageOffset = messages.length;
 | 
					    const systemMessageOffset = messages.length;
 | 
				
			||||||
    let round = 0;
 | 
					    let round = 0;
 | 
				
			||||||
 | 
					    const uploadModels = ['gpt-4-vision-preview', 'gpt-4o', 'claude-3-5-sonnet-20240620'];
 | 
				
			||||||
    // 特殊处理 gpt-4-vision-preview 模型
 | 
					    // 特殊处理 gpt-4-vision-preview 模型
 | 
				
			||||||
    if (activeModel === 'gpt-4-vision-preview' && imageUrl) {
 | 
					    if (uploadModels.includes(activeModel) && imageUrl) {
 | 
				
			||||||
      const content = [
 | 
					      const content = [
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          type: 'text',
 | 
					          type: 'text',
 | 
				
			||||||
@@ -123,14 +124,22 @@ export class NineStore implements NineStoreInterface {
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
      ];
 | 
					      ];
 | 
				
			||||||
      messages.push({ role: 'user', content: content, name });
 | 
					      messages.push({ role: 'user', content: content, name });
 | 
				
			||||||
 | 
					    } else if (uploadModels.includes(activeModel) && !imageUrl) {
 | 
				
			||||||
 | 
					      const content = [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          type: 'text',
 | 
				
			||||||
 | 
					          text: text,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					      ];
 | 
				
			||||||
 | 
					      messages.push({ role: 'user', content: content, name });
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      // 处理 gpt-4-all 模型
 | 
					      // 处理 gpt-4-all 模型
 | 
				
			||||||
      if (model === 'gpt-4-all' && imageUrl) {
 | 
					      if ((model === 'gpt-4-all' || model === 'gpt-4o-all') && imageUrl) {
 | 
				
			||||||
        text = imageUrl + '\n' + text;
 | 
					        text = imageUrl + '\n' + text;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      messages.push({ role: 'user', content: text, name });
 | 
					      messages.push({ role: 'user', content: text, name });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // Logger.debug(`发送的参数:${messages}`)
 | 
					    // Logger.debug(`发送的参数:${messages}`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let nextMessages = messages;
 | 
					    let nextMessages = messages;
 | 
				
			||||||
    do {
 | 
					    do {
 | 
				
			||||||
@@ -148,12 +157,18 @@ export class NineStore implements NineStoreInterface {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      // 特别处理包含 imageUrl 的消息
 | 
					      // 特别处理包含 imageUrl 的消息
 | 
				
			||||||
      if (imageUrl) {
 | 
					      if (imageUrl) {
 | 
				
			||||||
        if (activeModel === 'gpt-4-vision-preview') {
 | 
					        if (uploadModels.includes(activeModel)) {
 | 
				
			||||||
          content = [
 | 
					          if (role === 'assistant') {
 | 
				
			||||||
            { type: 'text', text: text },
 | 
					            content = [{ type: 'text', text: text }];
 | 
				
			||||||
            { type: 'image_url', image_url: { url: imageUrl } },
 | 
					          } else {
 | 
				
			||||||
          ];
 | 
					            content = [
 | 
				
			||||||
 | 
					              { type: 'text', text: text },
 | 
				
			||||||
 | 
					              { type: 'image_url', image_url: { url: imageUrl } },
 | 
				
			||||||
 | 
					            ];
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					      } else if (!imageUrl && uploadModels.includes(activeModel)) {
 | 
				
			||||||
 | 
					        content = [{ type: 'text', text: text }];
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      /* 将本轮消息插入到列表中 */
 | 
					      /* 将本轮消息插入到列表中 */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user