Compare commits
19 Commits
a2bd1905b9
...
master
Author | SHA1 | Date | |
---|---|---|---|
e647d1791d | |||
a7c76596de | |||
ef4dbda961 | |||
3b0fcbfb64 | |||
c8f13dff8c | |||
7e3254bc81 | |||
adf6af0824 | |||
ede810f51b | |||
df8d2bb3d0 | |||
b844f82c50 | |||
a494c0ed16 | |||
337a3f2d6e | |||
589cd6c49c | |||
fe55fae1f7 | |||
44409b2bba | |||
a2c90214ad | |||
3f8a11e1e0 | |||
5f061ddf14 | |||
cf4fedbee2 |
@@ -14,5 +14,7 @@ import Conversation from './main/Conversation'
|
|||||||
<Conversation client:only />
|
<Conversation client:only />
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
<div id='infoSend'>
|
||||||
<Send client:load />
|
<Send client:load />
|
||||||
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
@@ -5,6 +5,8 @@ import { conversationMapSortList } from '@/stores/conversation'
|
|||||||
import ConversationSidebarItem from './ConversationSidebarItem'
|
import ConversationSidebarItem from './ConversationSidebarItem'
|
||||||
import ConversationSidebarAdd from './ConversationSidebarAdd'
|
import ConversationSidebarAdd from './ConversationSidebarAdd'
|
||||||
import { addConversation } from '@/stores/conversation'
|
import { addConversation } from '@/stores/conversation'
|
||||||
|
import { showConversationEditModal } from '@/stores/ui'
|
||||||
|
import ChatList from '../../pages/chat/datalist'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
@@ -21,10 +23,9 @@ export default () => {
|
|||||||
let num = seachText[0].match(/\(\d+\)/g) || 'null'
|
let num = seachText[0].match(/\(\d+\)/g) || 'null'
|
||||||
if (num !== 'null') {
|
if (num !== 'null') {
|
||||||
count = Math.max(count, Number(num[0].replace('(', '').replace(')', '')))
|
count = Math.max(count, Number(num[0].replace('(', '').replace(')', '')))
|
||||||
console.log(count, Number(num[0].replace('(', '').replace(')', '')))
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
title =count?`${setName}(${count + 1})`:`${setName}`
|
title = count ? `${setName}(${count + 1})` : `${setName}${numList.length > 0 ? '(1)' : ''}`
|
||||||
return title
|
return title
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,25 +37,28 @@ export default () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
// onMount(() => {
|
||||||
setTimeout(() => {
|
// return
|
||||||
let itemList = conversationMapSortList.get()
|
// setTimeout(() => {
|
||||||
let setName = JSON.parse(sessionStorage.getItem('dialogueName') as any)||'未命名对话'
|
// let itemList = conversationMapSortList.get()
|
||||||
let numList: number[] = []
|
// let setName = JSON.parse(sessionStorage.getItem('dialogueName') as any) || '未命名对话'
|
||||||
itemList.map((res, i) => {
|
// let numList: number[] = []
|
||||||
if (checkName(res.name, setName.name)) numList.push(i)
|
// itemList.map((res, i) => {
|
||||||
})
|
// if (checkName(res.name, setName.name)) numList.push(i)
|
||||||
|
// })
|
||||||
|
|
||||||
if(setName.switch){
|
// if (setName.switch) {
|
||||||
addConversation({name:setNameNum(setName.name, numList)})
|
// addConversation({ name: setNameNum(setName.name, numList), systemInfo: setName.systemInfo })
|
||||||
setName.switch=false
|
// showConversationEditModal.set(true)
|
||||||
sessionStorage.setItem('dialogueName',JSON.stringify({name:setName.name,switch:false}))
|
// setName.switch = false
|
||||||
}
|
// sessionStorage.setItem('dialogueName', JSON.stringify({ name: setName.name, switch: false }))
|
||||||
}, 1000)
|
// }
|
||||||
})
|
// }, 1000)
|
||||||
|
// })
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="h-full flex flex-col bg-sidebar">
|
<div style={{height:'100vh'}}>
|
||||||
|
<div class="h-full flex flex-col bg-sidebar" style={{height:'50%',overflow:'auto'}}>
|
||||||
<header class="h-14 fi justify-between px-4 text-xs uppercase">
|
<header class="h-14 fi justify-between px-4 text-xs uppercase">
|
||||||
<p class="px-2">{t('conversations.title')}</p>
|
<p class="px-2">{t('conversations.title')}</p>
|
||||||
<div class="fi gap-1">
|
<div class="fi gap-1">
|
||||||
@@ -76,5 +80,7 @@ export default () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<ChatList></ChatList>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,7 @@ import { currentConversationId, deleteConversationById } from '@/stores/conversa
|
|||||||
import { showConversationSidebar } from '@/stores/ui'
|
import { showConversationSidebar } from '@/stores/ui'
|
||||||
import { useI18n } from '@/hooks'
|
import { useI18n } from '@/hooks'
|
||||||
import type { Conversation } from '@/types/conversation'
|
import type { Conversation } from '@/types/conversation'
|
||||||
|
import { chatShow } from '@/pages/chat/ts/store'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
instance: Omit<Conversation, 'messages'> & {
|
instance: Omit<Conversation, 'messages'> & {
|
||||||
@@ -16,6 +17,15 @@ export default ({ instance }: Props) => {
|
|||||||
const isTouchDevice = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0
|
const isTouchDevice = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
|
chatShow.set(false)
|
||||||
|
let infoHeader = document.getElementById("infoHeader");
|
||||||
|
let infoSend = document.getElementById("infoSend");
|
||||||
|
let mtBox = document.getElementsByClassName('flex-1 mt-14 flex flex-col overflow-hidden')[0]
|
||||||
|
if (!chatShow.get()) {
|
||||||
|
infoHeader.style.display = "flex";
|
||||||
|
infoSend.style.display = "block";
|
||||||
|
mtBox.style.marginTop = '3.5rem';
|
||||||
|
}
|
||||||
currentConversationId.set(instance.id)
|
currentConversationId.set(instance.id)
|
||||||
showConversationSidebar.set(false)
|
showConversationSidebar.set(false)
|
||||||
}
|
}
|
||||||
@@ -36,7 +46,7 @@ export default ({ instance }: Props) => {
|
|||||||
<div class="fcc w-8 h-8 rounded-full text-xl shrink-0">
|
<div class="fcc w-8 h-8 rounded-full text-xl shrink-0">
|
||||||
{instance.icon ? instance.icon : <div class="text-base i-carbon-chat" />}
|
{instance.icon ? instance.icon : <div class="text-base i-carbon-chat" />}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1 truncate text-sm">{ instance.name || t('conversations.untitled') }</div>
|
<div class="flex-1 truncate text-sm">{instance.name || t('conversations.untitled')}</div>
|
||||||
<div class={isTouchDevice ? '' : 'hidden group-hover:block'}>
|
<div class={isTouchDevice ? '' : 'hidden group-hover:block'}>
|
||||||
<div
|
<div
|
||||||
class="inline-flex p-2 items-center gap-1 rounded-md hv-base"
|
class="inline-flex p-2 items-center gap-1 rounded-md hv-base"
|
||||||
|
@@ -16,7 +16,9 @@ export default () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
return (
|
return (
|
||||||
<header onDblClick={scrollController().scrollToTop} class="shrink-0 absolute top-0 left-0 right-0 fi justify-between border-b border-base h-14 px-4">
|
<header onDblClick={scrollController().scrollToTop}
|
||||||
|
id='infoHeader'
|
||||||
|
class="shrink-0 absolute top-0 left-0 right-0 fi justify-between border-b border-base h-14 px-4">
|
||||||
<div class="fi overflow-hidden">
|
<div class="fi overflow-hidden">
|
||||||
<div
|
<div
|
||||||
class="fcc p-2 rounded-md text-xl hv-foreground md:hidden"
|
class="fcc p-2 rounded-md text-xl hv-foreground md:hidden"
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Match, Switch, createEffect,onMount } from 'solid-js'
|
import { Match, Switch, createEffect, Show } from 'solid-js'
|
||||||
import { useStore } from '@nanostores/solid'
|
import { useStore } from '@nanostores/solid'
|
||||||
import { conversationMap, currentConversationId } from '@/stores/conversation'
|
import { conversationMap, currentConversationId } from '@/stores/conversation'
|
||||||
import { conversationMessagesMap } from '@/stores/messages'
|
import { conversationMessagesMap } from '@/stores/messages'
|
||||||
@@ -10,6 +10,8 @@ import Welcome from './Welcome'
|
|||||||
import Continuous from './Continuous'
|
import Continuous from './Continuous'
|
||||||
import Single from './Single'
|
import Single from './Single'
|
||||||
import Image from './Image'
|
import Image from './Image'
|
||||||
|
import { chatShow } from '@/pages/chat/ts/store'
|
||||||
|
import Iframe from '@/pages/chat/components/iframe'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
@@ -33,7 +35,7 @@ export default () => {
|
|||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
const conversation = currentConversation()
|
const conversation = currentConversation()
|
||||||
const currentDomain = window.location.hostname;
|
const currentDomain = window.location.hostname;
|
||||||
const contentDomain = currentDomain=='gtering.com'?'Gtering.com':'Ansnid.Com';
|
const contentDomain = currentDomain == 'gtering.com' ? 'Gtering.com' : 'Ansnid.Com';
|
||||||
|
|
||||||
document.title = conversation ? `${(conversation.name || t('conversations.untitled'))} - ` + contentDomain : contentDomain
|
document.title = conversation ? `${(conversation.name || t('conversations.untitled'))} - ` + contentDomain : contentDomain
|
||||||
const link = document.querySelector("link[rel~='icon']") as HTMLLinkElement
|
const link = document.querySelector("link[rel~='icon']") as HTMLLinkElement
|
||||||
@@ -43,7 +45,12 @@ export default () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let chat: any = null
|
||||||
|
chat = useStore(chatShow)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
<Show when={!chat()}>
|
||||||
<Switch
|
<Switch
|
||||||
fallback={(
|
fallback={(
|
||||||
<Welcome />
|
<Welcome />
|
||||||
@@ -72,5 +79,11 @@ export default () => {
|
|||||||
/>
|
/>
|
||||||
</Match>
|
</Match>
|
||||||
</Switch>
|
</Switch>
|
||||||
|
</Show>
|
||||||
|
<Show when={chat()}>
|
||||||
|
<Iframe></Iframe>
|
||||||
|
</Show>
|
||||||
|
</>
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -3,13 +3,13 @@ import { For } from 'solid-js'
|
|||||||
import MessageItem from './../main/MessageItem'
|
import MessageItem from './../main/MessageItem'
|
||||||
import Banner from './banner'
|
import Banner from './banner'
|
||||||
import './style.css'
|
import './style.css'
|
||||||
import { createEffect, createSignal, useEffect,onMount } from 'solid-js'
|
import { createEffect, createSignal, useEffect, onMount,sg } from 'solid-js'
|
||||||
import { fetchData } from '../../http/api'
|
import { fetchData } from '../../http/api'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
|
|
||||||
const currentDomain = window.location.hostname;
|
const currentDomain = window.location.hostname;
|
||||||
const contentDomain = currentDomain=='gtering.com'?'Gtering.com':'Ansnid.Com';
|
const contentDomain = currentDomain == 'gtering.com' ? 'Gtering.com' : 'Ansnid.Com';
|
||||||
|
|
||||||
const [views, setViews] = createSignal(0)
|
const [views, setViews] = createSignal(0)
|
||||||
const [url, setUrl] = createSignal('')
|
const [url, setUrl] = createSignal('')
|
||||||
@@ -20,11 +20,7 @@ export default () => {
|
|||||||
document.documentElement.classList.toggle('dark', false)
|
document.documentElement.classList.toggle('dark', false)
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
fetchData(null, function (data) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fetchData(null, function(data){
|
|
||||||
|
|
||||||
setViews(data.data.views);
|
setViews(data.data.views);
|
||||||
setUrl(data.data.url);
|
setUrl(data.data.url);
|
||||||
@@ -32,10 +28,12 @@ export default () => {
|
|||||||
setTitle(data.data.title);
|
setTitle(data.data.title);
|
||||||
document.title = data.data.title ? `${(data.data.title || t('conversations.untitled'))} - ` + contentDomain : contentDomain
|
document.title = data.data.title ? `${(data.data.title || t('conversations.untitled'))} - ` + contentDomain : contentDomain
|
||||||
|
|
||||||
}, "/chatgptApi/conversations?url="+encodeURIComponent(window.location.href))
|
}, "/chatgptApi/conversations?url=" + encodeURIComponent(window.location.href))
|
||||||
|
|
||||||
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
let [moreBox,setMoreBox]= createSignal(false)
|
||||||
return (
|
return (
|
||||||
<div class="flex flex-col h-full">
|
<div class="flex flex-col h-full">
|
||||||
<div style="text-align: center; padding: 0.75rem;">
|
<div style="text-align: center; padding: 0.75rem;">
|
||||||
@@ -53,7 +51,16 @@ export default () => {
|
|||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
</div>
|
</div>
|
||||||
<Banner views={views} url={url} />
|
<div class={[moreBox()?'more-show-box more-hid-box flex-end':'more-hid-box flex-end'].join()} onClick={()=>setMoreBox(!moreBox())}>
|
||||||
|
<div class='more-btn'>
|
||||||
|
<Banner views={views} url={url} title={title}/>
|
||||||
|
<div class='icon'>
|
||||||
|
<div class='icon-r'></div>
|
||||||
|
<div class='icon-r mg-l-3'></div>
|
||||||
|
<div class='icon-r mg-l-3'></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
@@ -1,4 +1,5 @@
|
|||||||
export default function Banner({ views, url }: { views: number }) {
|
import './style.css'
|
||||||
|
export default function Banner({ views, url ,title}: { views: number }) {
|
||||||
|
|
||||||
const copyToClipboard = (text) => {
|
const copyToClipboard = (text) => {
|
||||||
var tempInput = document.createElement("input");
|
var tempInput = document.createElement("input");
|
||||||
@@ -17,7 +18,7 @@ export default function Banner({ views, url }: { views: number }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="z-10 fixed bottom-10 inset-x-0 mx-auto max-w-fit rounded-lg px-3 py-2 bg-white border border-gray-100 shadow-md flex justify-between space-x-2 items-center"
|
className="z-10 pos-a more-box mx-auto max-w-fit rounded-lg px-3 py-2 bg-white border border-gray-100 shadow-md flex justify-between space-x-2 items-center"
|
||||||
initial={{ opacity: 0, y: 100 }}
|
initial={{ opacity: 0, y: 100 }}
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, y: 0 }}
|
||||||
exit={{ opacity: 0, y: 100 }}
|
exit={{ opacity: 0, y: 100 }}
|
||||||
@@ -43,7 +44,7 @@ export default function Banner({ views, url }: { views: number }) {
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
copyToClipboard(url())
|
copyToClipboard(`${title()} ${url()}`)
|
||||||
}
|
}
|
||||||
className="p-2 flex flex-col space-y-1 items-center rounded-md w-12 hover:bg-gray-100 active:bg-gray-200 transition-all"
|
className="p-2 flex flex-col space-y-1 items-center rounded-md w-12 hover:bg-gray-100 active:bg-gray-200 transition-all"
|
||||||
>
|
>
|
||||||
|
@@ -15,3 +15,61 @@
|
|||||||
.ansnidshare .ansnid_copy{
|
.ansnidshare .ansnid_copy{
|
||||||
/* margin: 0px !important;*/
|
/* margin: 0px !important;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.more-btn{
|
||||||
|
--un-shadow: var(--un-shadow-inset) 0 4px 6px -1px var(--un-shadow-color, rgba(0,0,0,0.1)),var(--un-shadow-inset) 0 2px 4px -2px var(--un-shadow-color, rgba(0,0,0,0.1));
|
||||||
|
box-shadow: var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow);
|
||||||
|
width:2.5rem;
|
||||||
|
height:2.5rem;
|
||||||
|
border-radius:50%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background:#fff;
|
||||||
|
border:1px solid rgba(0,0,0,0.1);
|
||||||
|
margin-right:0.3125rem;
|
||||||
|
}
|
||||||
|
.more-btn .icon{
|
||||||
|
width:1.5rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.more-btn .icon .icon-r{
|
||||||
|
width:5px;
|
||||||
|
height:5px;
|
||||||
|
border-radius:50%;
|
||||||
|
background: rgba(0,0,0,0.5);
|
||||||
|
}
|
||||||
|
.mg-l-3{
|
||||||
|
margin-left:3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pos-a{
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.more-box{
|
||||||
|
right:3.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.more-hid-box{
|
||||||
|
position: fixed;
|
||||||
|
bottom:2rem;
|
||||||
|
right:0.05rem;
|
||||||
|
z-index:66;
|
||||||
|
overflow: hidden;
|
||||||
|
width:3.1rem;
|
||||||
|
height:5.1rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
transition: width linear 0.2s;
|
||||||
|
}
|
||||||
|
.more-show-box{
|
||||||
|
width:24.1rem;
|
||||||
|
}
|
||||||
|
.flex-end{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction:row-reverse;
|
||||||
|
}
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
import type { JSXElement } from 'solid-js'
|
import type { JSXElement } from 'solid-js'
|
||||||
|
import '../../pages/chat/css/list.css'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
direction: 'left' | 'right'
|
direction: 'left' | 'right' | 'none'
|
||||||
class?: string
|
class?: string
|
||||||
children: JSXElement
|
children: JSXElement
|
||||||
}
|
}
|
||||||
@@ -10,6 +11,7 @@ export default (props: Props) => {
|
|||||||
const containerBaseClass = {
|
const containerBaseClass = {
|
||||||
left: 'w-[260px] h-100dvh border-r',
|
left: 'w-[260px] h-100dvh border-r',
|
||||||
right: 'w-[300px] h-100dvh border-l',
|
right: 'w-[300px] h-100dvh border-l',
|
||||||
|
none:'w-100'
|
||||||
}[props.direction]
|
}[props.direction]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@@ -5,7 +5,7 @@ interface Data {}
|
|||||||
interface ResponseData {
|
interface ResponseData {
|
||||||
code: number;
|
code: number;
|
||||||
message: string;
|
message: string;
|
||||||
data: Array;
|
data: any;
|
||||||
url: string;
|
url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,17 +3,22 @@ import ConversationSidebarItem from './listItem'
|
|||||||
import { createStore } from "solid-js/store";
|
import { createStore } from "solid-js/store";
|
||||||
import '../css/list.css'
|
import '../css/list.css'
|
||||||
import { fetchData } from '../../../http/api'
|
import { fetchData } from '../../../http/api'
|
||||||
|
import { addConversation } from '@/stores/conversation'
|
||||||
|
import { showConversationEditModal } from '@/stores/ui'
|
||||||
|
import { conversationMapSortList } from '@/stores/conversation'
|
||||||
|
import { chatShow, uniqid } from '../ts/store';
|
||||||
|
import { showConversationSidebar } from '@/stores/ui'
|
||||||
|
import { useStore } from '@nanostores/solid'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
// dataItemLists.set([{id:'1'},{id:'2'},{id:'3'},{id:'4'},{id:'5'},{id:'6'}])
|
// dataItemLists.set([{id:'1'},{id:'2'},{id:'3'},{id:'4'},{id:'5'},{id:'6'}])
|
||||||
const [list, setList] = createStore({
|
const [list, setList] = createStore({
|
||||||
data: [{ id: '1', Topping: false }, { id: '2', Topping: false }, { id: '3', Topping: false }, { id: '4', Topping: false }, { id: '5', Topping: false }, { id: '6', Topping: false }]
|
data: [{ title: '' }]
|
||||||
})
|
})
|
||||||
|
|
||||||
type errorObj={
|
type errorObj = {
|
||||||
show:boolean,
|
show: boolean,
|
||||||
message:string
|
message: string
|
||||||
}
|
}
|
||||||
|
|
||||||
let [errorShow, setErrorShow] = createSignal({
|
let [errorShow, setErrorShow] = createSignal({
|
||||||
@@ -25,18 +30,23 @@ export default () => {
|
|||||||
fetchData({}, function (data) {
|
fetchData({}, function (data) {
|
||||||
if (data.code === 200) {
|
if (data.code === 200) {
|
||||||
setList('data', () => [...data.data])
|
setList('data', () => [...data.data])
|
||||||
|
} else {
|
||||||
|
// setErrorFun(data.message)
|
||||||
}
|
}
|
||||||
}, '/chat/api', 'GET');
|
}, '/chat/api', 'GET');
|
||||||
}
|
}
|
||||||
|
|
||||||
//标题
|
//标题
|
||||||
let dialogueName = ''
|
let dialogue = {
|
||||||
|
systemmessage: '',
|
||||||
//新建对话框
|
title: ''
|
||||||
const newlyAdded = () => {
|
|
||||||
window.open(`${location.protocol}//${location.host}`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// //新建对话框
|
||||||
|
// const newlyAdded = () => {
|
||||||
|
// window.open(`${location.protocol}//${location.host}`)
|
||||||
|
// }
|
||||||
|
|
||||||
//删除记录
|
//删除记录
|
||||||
let deleteItem = { key: null, e: null }
|
let deleteItem = { key: null, e: null }
|
||||||
const handleDelete = (e: MouseEvent, key: string) => {
|
const handleDelete = (e: MouseEvent, key: string) => {
|
||||||
@@ -64,25 +74,65 @@ export default () => {
|
|||||||
let [pop, setPop] = createSignal(false)
|
let [pop, setPop] = createSignal(false)
|
||||||
let [popType, setPopType] = createSignal('open')
|
let [popType, setPopType] = createSignal('open')
|
||||||
|
|
||||||
const popShow = (type: string, e: any, key: number, name: string = '未命名对话') => {
|
const popShow = (type: string, e: any, key: number, dialogueObj: any = {}) => {
|
||||||
setPopType(type)
|
setPopType(type)
|
||||||
if (type == 'delete') {
|
if (type == 'delete') {
|
||||||
deleteItem['key'] = key as any
|
deleteItem['key'] = key as any
|
||||||
deleteItem['e'] = e
|
deleteItem['e'] = e
|
||||||
}
|
}
|
||||||
if (type === 'open') dialogueName = name
|
if (type === 'open') dialogue = dialogueObj
|
||||||
setPop(!pop())
|
setPop(!pop())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置副标题数字
|
||||||
|
const setNameNum = (setName: string, numList: any) => {
|
||||||
|
let list = conversationMapSortList.get()
|
||||||
|
let title = ''
|
||||||
|
let count = 0
|
||||||
|
numList.map((res: number) => {
|
||||||
|
let regex1 = new RegExp("" + setName + '\\(\\d+\\)', 'g')
|
||||||
|
let seachText = list[res].name.match(regex1) || 'null'
|
||||||
|
let num = seachText[0].match(/\(\d+\)/g) || 'null'
|
||||||
|
if (num !== 'null') {
|
||||||
|
count = Math.max(count, Number(num[0].replace('(', '').replace(')', '')))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
title = count ? `${setName}(${count + 1})` : `${setName}${numList.length > 0 ? '(1)' : ''}`
|
||||||
|
return title
|
||||||
|
}
|
||||||
|
|
||||||
|
//查重
|
||||||
|
const checkName = (name: string, setName: string) => {
|
||||||
|
let setNameReg = new RegExp(setName, 'g')
|
||||||
|
if (setNameReg.test(name) && name.replace(/\(\d+\)/g, '') === setName) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//确认按钮
|
//确认按钮
|
||||||
const determineBtn = () => {
|
const determineBtn = () => {
|
||||||
if (popType() === 'open') {
|
if (popType() === 'open') {
|
||||||
sessionStorage.setItem('dialogueName', JSON.stringify({ name: dialogueName, switch: true }))
|
sessionStorage.setItem('dialogueName', JSON.stringify({ name: dialogue.title, switch: true, systemInfo: dialogue.systemmessage }))
|
||||||
if (isMobile()) {
|
// if (isMobile()) {
|
||||||
location.pathname = '/'
|
// location.pathname = '/'
|
||||||
} else {
|
// } else {
|
||||||
newlyAdded()
|
// newlyAdded()
|
||||||
|
let itemList = conversationMapSortList.get()
|
||||||
|
let setName = JSON.parse(sessionStorage.getItem('dialogueName') as any) || '未命名对话'
|
||||||
|
let numList: number[] = []
|
||||||
|
itemList.map((res, i) => {
|
||||||
|
if (checkName(res.name, setName.name)) numList.push(i)
|
||||||
|
})
|
||||||
|
|
||||||
|
if (setName.switch) {
|
||||||
|
addConversation({ name: setNameNum(setName.name, numList), systemInfo: setName.systemInfo })
|
||||||
|
showConversationEditModal.set(true)
|
||||||
|
setName.switch = false
|
||||||
|
sessionStorage.setItem('dialogueName', JSON.stringify({ name: setName.name, switch: false }))
|
||||||
}
|
}
|
||||||
|
chatShow.set(false)
|
||||||
|
setDataInfo()
|
||||||
|
// }
|
||||||
} else if (popType() === 'delete') {
|
} else if (popType() === 'delete') {
|
||||||
handleDelete(deleteItem['e'] as any, deleteItem['key'] as any)
|
handleDelete(deleteItem['e'] as any, deleteItem['key'] as any)
|
||||||
}
|
}
|
||||||
@@ -90,36 +140,66 @@ export default () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//显示错误提示
|
//显示错误提示
|
||||||
const setErrorFun=(message:string)=>{
|
// const setErrorFun = (message: string) => {
|
||||||
setErrorShow({
|
// // console.log(message)
|
||||||
message,
|
// setErrorShow({
|
||||||
show:true
|
// message,
|
||||||
})
|
// show: true
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
|
//查看记录内容
|
||||||
|
const chatWatch = (id: string = '') => {
|
||||||
|
chatShow.set(true)
|
||||||
|
showConversationSidebar.set(false)
|
||||||
|
uniqid.set(id)
|
||||||
|
setDataInfo()
|
||||||
|
}
|
||||||
|
const unId = useStore(uniqid)
|
||||||
|
|
||||||
|
//设置切换显示内容
|
||||||
|
const setDataInfo = () => {
|
||||||
|
let infoSend = document.getElementById("infoSend");
|
||||||
|
let infoHeader = document.getElementById("infoHeader");
|
||||||
|
let mtBox = document.getElementsByClassName('flex-1 mt-14 flex flex-col overflow-hidden')[0]
|
||||||
|
if (chatShow.get()) {
|
||||||
|
infoSend.style.display = "none";
|
||||||
|
if (!isMobile()) {
|
||||||
|
infoHeader.style.display = "none";
|
||||||
|
mtBox.style.marginTop = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
infoSend.style.display = "flex";
|
||||||
|
if (!isMobile()) {
|
||||||
|
infoHeader.style.display = "flex";
|
||||||
|
mtBox.style.marginTop = '3.5rem';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//提示弹窗
|
//提示弹窗
|
||||||
const ErrorState = () => (
|
// const ErrorState = () => (
|
||||||
<div class='tps-error-box'>
|
// <div class='tps-error-box'>
|
||||||
<div class="max-w-base h-full flex items-end flex-col justify-between gap-8 sm:(flex-row items-center) py-4 text-error text-sm" style="padding: 1rem;">
|
// <div class="max-w-base h-full flex items-end flex-col justify-between gap-8 sm:(flex-row items-center) py-4 text-error text-sm" style="padding: 1rem;">
|
||||||
<div class="flex-1 w-full">
|
// <div class="flex-1 w-full">
|
||||||
<div class="fi gap-0.5 mb-1">
|
// <div class="fi gap-0.5 mb-1">
|
||||||
<span i-carbon-warning />
|
// <span i-carbon-warning />
|
||||||
<span class="font-semibold">{errorShow().message}</span>
|
// <span class="font-semibold">{errorShow().message}</span>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
<div class="border border-error px-2 py-1 rounded-md hv-base hover:bg-white" onClick={() => { setErrorShow({ show: false, message: errorShow().message }) }} >
|
// <div class="border border-error px-2 py-1 rounded-md hv-base hover:bg-white" onClick={() => { setErrorShow({ show: false, message: errorShow().message }) }} >
|
||||||
Dismiss
|
// Dismiss
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
)
|
// )
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="h-full flex flex-col bg-sidebar max-w-350 min-w-260">
|
<div class="h-full flex flex-col bg-sidebar">
|
||||||
<Show when={pop()}>
|
<Show when={pop()}>
|
||||||
<div class='pop center-f'>
|
<div class='pop center-f'>
|
||||||
<div class='center-f text-box'>
|
<div class='center-f text-box'>
|
||||||
@@ -140,14 +220,20 @@ export default () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
<Show when={errorShow().show}>
|
{/* <Show when={errorShow().show}>
|
||||||
<ErrorState />
|
<ErrorState />
|
||||||
</Show>
|
</Show> */}
|
||||||
<div class="flex-1 overflow-auto">
|
<div class="overflow-auto px-2">
|
||||||
<div class="px-2">
|
<div style={{ width: '100%' }}>
|
||||||
<For each={list.data}>
|
<For each={list.data}>
|
||||||
{(instance, i) => (
|
{(instance, i) => (
|
||||||
<ConversationSidebarItem popShow={popShow} setErrorFun={setErrorFun} instanceData={{ ...instance }} infoList={list.data} key={i as any} setList={setList} />
|
<Show when={instance.title}>
|
||||||
|
<div class={[instance.uniqid == unId()?'click-bg':''].join()}>
|
||||||
|
<ConversationSidebarItem
|
||||||
|
clickInfo={instance.uniqid == unId()}
|
||||||
|
chatWatch={chatWatch} popShow={popShow} instanceData={{ ...instance }} infoList={list.data} key={i as any} setList={setList} />
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
</div>
|
</div>
|
||||||
|
26
src/pages/chat/components/iframe.tsx
Normal file
26
src/pages/chat/components/iframe.tsx
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import { keys } from 'idb-keyval'
|
||||||
|
import '../css/list.css'
|
||||||
|
import { createSignal, Switch, Match } from 'solid-js'
|
||||||
|
import { uniqid } from '@/pages/chat/ts/store'
|
||||||
|
import { useStore } from '@nanostores/solid'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
let id: any = ''
|
||||||
|
id = useStore(uniqid) as any
|
||||||
|
return (
|
||||||
|
<Switch>
|
||||||
|
<Match when={id()}>
|
||||||
|
<div style={{ width: '100%', height: '100%' }} id='iframe'>
|
||||||
|
<iframe src={`/share/?id=${id()}`} style={{ width: '100%', height: '100%' }}></iframe>
|
||||||
|
</div>
|
||||||
|
</Match>
|
||||||
|
<Match when={!id()}>
|
||||||
|
<div></div>
|
||||||
|
</Match>
|
||||||
|
</Switch>
|
||||||
|
)
|
||||||
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
import { keys } from 'idb-keyval'
|
import { keys } from 'idb-keyval'
|
||||||
import '../css/list.css'
|
import '../css/list.css'
|
||||||
import { createSignal } from 'solid-js'
|
import { createSignal,splitProps } from 'solid-js'
|
||||||
import { fetchData } from '../../../http/api'
|
import { fetchData } from '../../../http/api'
|
||||||
|
|
||||||
type dataList = {
|
type dataList = {
|
||||||
@@ -8,47 +8,52 @@ type dataList = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
instanceData: Omit<dataList, 'messages'> & {},
|
instanceData: {
|
||||||
|
title?:string,
|
||||||
|
istop?:number,
|
||||||
|
uniqid?:string
|
||||||
|
},
|
||||||
key: any,
|
key: any,
|
||||||
setList: Function,
|
setList: Function,
|
||||||
infoList: any,
|
infoList: any,
|
||||||
popShow: Function,
|
popShow: Function,
|
||||||
setErrorFun:Function
|
chatWatch:Function,
|
||||||
|
clickInfo:any
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ({ instanceData, key, setList, infoList, popShow,setErrorFun }: Props) => {
|
export default ({ instanceData, key, setList, infoList, popShow,chatWatch,clickInfo }: Props,props:any) => {
|
||||||
|
|
||||||
//设置数据
|
//设置数据
|
||||||
const instanceItem = instanceData
|
const instanceItem = instanceData
|
||||||
let instance = instanceItem || { id: '', name: '' }
|
let instance = instanceItem || { id: '', name: '',uniqid:'' }
|
||||||
const isTouchDevice = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0
|
const isTouchDevice = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0
|
||||||
|
|
||||||
const handleClick = () => {
|
//置顶数据排序
|
||||||
// console.log(dataList)
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取置顶数据
|
|
||||||
const getToppingItem = (arr: any) => {
|
const getToppingItem = (arr: any) => {
|
||||||
let toppingArr: { id: string, istop: boolean }[] = []
|
let toppingArr: { id: string, istop: boolean }[] = []
|
||||||
|
let copyArr: any[]=[]
|
||||||
arr.map((res: { istop: boolean; id: string }, i: number) => {
|
arr.map((res: { istop: boolean; id: string }, i: number) => {
|
||||||
if (res.istop) {
|
if (res.istop) {
|
||||||
toppingArr.push(arr.splice(i, 1)[0] as { istop: boolean; id: string })
|
copyArr.push(arr[i])
|
||||||
|
}else{
|
||||||
|
toppingArr.push(arr[i])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return toppingArr
|
// console.log([...copyArr,...toppingArr])
|
||||||
|
return [...copyArr,...toppingArr]
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置置顶
|
//设置数据置顶
|
||||||
const setItemTop = (uniqid: string, item: any) => {
|
const setItemTop = (uniqid: string, item: any) => {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
fetchData({ uniqid }, function (data) {
|
fetchData({ uniqid }, function (data) {
|
||||||
if (data.code === 200) {
|
if (data.code === 200) {
|
||||||
item.istop = item.istop ? 0 : 1
|
item.istop = item.istop ? 0 : 1
|
||||||
} else {
|
} else {
|
||||||
setErrorFun(data.message)
|
// setErrorFun(data.message)
|
||||||
}
|
}
|
||||||
res(null)
|
res(null)
|
||||||
}, '/chat/top', 'GET');
|
}, !item.istop?'/chat/top':'/chat/cancelTop', 'POST');
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +63,7 @@ export default ({ instanceData, key, setList, infoList, popShow,setErrorFun }: P
|
|||||||
let item = arr[key]
|
let item = arr[key]
|
||||||
setItemTop(item.uniqid, item).then(res=>{
|
setItemTop(item.uniqid, item).then(res=>{
|
||||||
let toppindItem = getToppingItem(arr)
|
let toppindItem = getToppingItem(arr)
|
||||||
setList('data', (list: null[]) => [...toppindItem, ...arr])
|
setList('data', (list: null[]) => [...toppindItem])
|
||||||
})
|
})
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
}
|
}
|
||||||
@@ -66,9 +71,11 @@ export default ({ instanceData, key, setList, infoList, popShow,setErrorFun }: P
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class={[
|
class={[
|
||||||
|
clickInfo?
|
||||||
|
'group fi h-10 my-0.5 px-2 gap-2 hv-base rounded-md click-bg' :
|
||||||
'group fi h-10 my-0.5 px-2 gap-2 hv-base rounded-md'
|
'group fi h-10 my-0.5 px-2 gap-2 hv-base rounded-md'
|
||||||
].join(' ')}
|
].join(' ')}
|
||||||
onClick={handleClick}
|
onClick={()=>chatWatch(instance.uniqid)}
|
||||||
>
|
>
|
||||||
<div class="fcc w-8 h-8 rounded-full text-xl shrink-0">
|
<div class="fcc w-8 h-8 rounded-full text-xl shrink-0">
|
||||||
<div class="text-base i-carbon-chat" />
|
<div class="text-base i-carbon-chat" />
|
||||||
@@ -78,7 +85,7 @@ export default ({ instanceData, key, setList, infoList, popShow,setErrorFun }: P
|
|||||||
<div class={[isTouchDevice ? '' : 'hidden group-hover:block'].join('')}>
|
<div class={[isTouchDevice ? '' : 'hidden group-hover:block'].join('')}>
|
||||||
<div
|
<div
|
||||||
class="inline-flex p-2 items-center gap-1 rounded-md hv-base"
|
class="inline-flex p-2 items-center gap-1 rounded-md hv-base"
|
||||||
onClick={() => popShow('open', null, null, instance.title)}
|
onClick={(e) => {popShow('open', null, null, instance);e.stopPropagation()}}
|
||||||
>
|
>
|
||||||
<div class='add-new-icon'></div>
|
<div class='add-new-icon'></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -89,14 +96,14 @@ export default ({ instanceData, key, setList, infoList, popShow,setErrorFun }: P
|
|||||||
class="inline-flex p-2 items-center gap-1 rounded-md hv-base"
|
class="inline-flex p-2 items-center gap-1 rounded-md hv-base"
|
||||||
onClick={e => setDataTop(e, key())}
|
onClick={e => setDataTop(e, key())}
|
||||||
>
|
>
|
||||||
<div class='list-top-icon'></div>
|
<div class={[instance.istop === 1 ?'list-top-icon-b':'list-top-icon'].join('')}></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class={isTouchDevice ? '' : 'hidden group-hover:block'}>
|
<div class={isTouchDevice ? '' : 'hidden group-hover:block'}>
|
||||||
<div
|
<div
|
||||||
class="inline-flex p-2 items-center gap-1 rounded-md hv-base"
|
class="inline-flex p-2 items-center gap-1 rounded-md hv-base"
|
||||||
onClick={e => popShow('delete', e, key())}
|
onClick={e => {popShow('delete', e, key());e.stopPropagation()}}
|
||||||
>
|
>
|
||||||
<div class="i-carbon-close" />
|
<div class="i-carbon-close" />
|
||||||
</div>
|
</div>
|
||||||
|
@@ -17,6 +17,13 @@
|
|||||||
background-position: center;
|
background-position: center;
|
||||||
background-size: 1rem 1rem;
|
background-size: 1rem 1rem;
|
||||||
}
|
}
|
||||||
|
.list-top-icon-b {
|
||||||
|
width: 1rem;
|
||||||
|
height: 1rem;
|
||||||
|
background: url('../img/posTopB.svg') no-repeat;
|
||||||
|
background-position: center;
|
||||||
|
background-size: 1rem 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.add-new-icon {
|
.add-new-icon {
|
||||||
width: 1rem;
|
width: 1rem;
|
||||||
@@ -91,3 +98,21 @@
|
|||||||
background:rgba(246, 246, 246, 1);
|
background:rgba(246, 246, 246, 1);
|
||||||
width:100%;
|
width:100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chat-list-title{
|
||||||
|
font-size:0.75rem;
|
||||||
|
line-height:1rem;
|
||||||
|
height:3.5rem;
|
||||||
|
text-transform:uppercase;
|
||||||
|
padding:0 1rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.top-bor{
|
||||||
|
border-top:1px solid #e9ecef;
|
||||||
|
}
|
||||||
|
|
||||||
|
.click-bg{
|
||||||
|
background: rgba(243, 243, 243, 1) !important;
|
||||||
|
border-radius: 0.375rem;
|
||||||
|
}
|
@@ -1,21 +0,0 @@
|
|||||||
---
|
|
||||||
import Layout from '@/layouts/Layout.astro'
|
|
||||||
import Main from '@/components/Main.astro'
|
|
||||||
import ConversationSidebar from './components/dataList'
|
|
||||||
import ModalsLayer from '@/components/ModalsLayer'
|
|
||||||
import Sidebar from '@/components/ui/Sidebar'
|
|
||||||
import BuildStores from '@/components/client-only/BuildStores'
|
|
||||||
import './css/list.css'
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<Layout title="Ansnid">
|
|
||||||
<div class="h-100vh w-screen flex">
|
|
||||||
<Sidebar direction="left" class='w-100'>
|
|
||||||
<ConversationSidebar client:only="solid-js" />
|
|
||||||
</Sidebar>
|
|
||||||
<!-- <Main /> -->
|
|
||||||
</div>
|
|
||||||
<!-- <ModalsLayer client:only />
|
|
||||||
<BuildStores client:only /> -->
|
|
||||||
</Layout>
|
|
23
src/pages/chat/datalist.tsx
Normal file
23
src/pages/chat/datalist.tsx
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import ConversationSidebar from './components/dataList'
|
||||||
|
import Sidebar from '@/components/ui/Sidebar'
|
||||||
|
import './css/list.css'
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div class='top-bor' style={{height:'50%',overflow:'auto'}}>
|
||||||
|
<div class='chat-list-title'>
|
||||||
|
分享历史记录
|
||||||
|
</div>
|
||||||
|
<div class="flex">
|
||||||
|
<Sidebar direction="none" class=''>
|
||||||
|
<ConversationSidebar />
|
||||||
|
</Sidebar>
|
||||||
|
</div>
|
||||||
|
{/* <ModalsLayer />
|
||||||
|
<BuildStores/> */}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
1
src/pages/chat/img/moreIcon.svg
Normal file
1
src/pages/chat/img/moreIcon.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1692866656055" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3806" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M221 592c-44.183 0-80-35.817-80-80s35.817-80 80-80 80 35.817 80 80-35.817 80-80 80z m291 0c-44.183 0-80-35.817-80-80s35.817-80 80-80 80 35.817 80 80-35.817 80-80 80z m291 0c-44.183 0-80-35.817-80-80s35.817-80 80-80 80 35.817 80 80-35.817 80-80 80z" fill="#000000" p-id="3807"></path></svg>
|
After Width: | Height: | Size: 622 B |
1
src/pages/chat/img/posTopB.svg
Normal file
1
src/pages/chat/img/posTopB.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1692354575685" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2366" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M43.072 974.72l380.864-301.952 151.936 161.6c0 0 63.424 17.28 67.328-30.72l-3.904-163.584 225.088-259.648 98.048-5.696c0 0 76.928-15.488 21.184-82.752l-275.072-276.928c0 0-74.944-9.6-69.248 59.584l0 75.008L383.552 367.104 225.856 376.64c0 0-57.728 19.2-36.608 69.248l148.16 146.176L43.072 974.72 43.072 974.72z" fill="#2c2c2c" p-id="2367"></path></svg>
|
After Width: | Height: | Size: 685 B |
3
src/pages/chat/ts/store.ts
Normal file
3
src/pages/chat/ts/store.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import { atom } from 'nanostores';
|
||||||
|
export const chatShow=atom(false)
|
||||||
|
export const uniqid=atom('')
|
@@ -6,6 +6,7 @@ import Settings from '@/components/settings/SettingsSidebar'
|
|||||||
import ModalsLayer from '@/components/ModalsLayer'
|
import ModalsLayer from '@/components/ModalsLayer'
|
||||||
import Sidebar from '@/components/ui/Sidebar'
|
import Sidebar from '@/components/ui/Sidebar'
|
||||||
import BuildStores from '@/components/client-only/BuildStores'
|
import BuildStores from '@/components/client-only/BuildStores'
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Ansnid">
|
<Layout title="Ansnid">
|
||||||
|
@@ -42,12 +42,18 @@ const providerOpenAI = () => {
|
|||||||
type: 'select',
|
type: 'select',
|
||||||
options: [
|
options: [
|
||||||
{ value: 'gpt-3.5-turbo', label: 'gpt-3.5-turbo' },
|
{ value: 'gpt-3.5-turbo', label: 'gpt-3.5-turbo' },
|
||||||
{ value: 'gpt-3.5-turbo-16k', label: 'gpt-3.5-turbo-16k' },
|
|
||||||
{ value: 'gpt-4', label: 'gpt-4' },
|
{ value: 'gpt-4', label: 'gpt-4' },
|
||||||
{ value: 'gpt-4-0314', label: 'gpt-4-0314' },
|
{ value: 'gpt-4-0314', label: 'gpt-4-0314' },
|
||||||
|
{ value: 'gpt-4-0613', label: 'gpt-4-0613' },
|
||||||
|
{ value: 'gpt-4-1106-preview', label: 'gpt-4-1106-preview' },
|
||||||
{ value: 'gpt-4-32k', label: 'gpt-4-32k' },
|
{ value: 'gpt-4-32k', label: 'gpt-4-32k' },
|
||||||
{ value: 'gpt-4-32k-0314', label: 'gpt-4-32k-0314' },
|
{ value: 'gpt-4-32k-0314', label: 'gpt-4-32k-0314' },
|
||||||
|
{ value: 'gpt-4-32k-0613', label: 'gpt-4-32k-0613' },
|
||||||
{ value: 'gpt-3.5-turbo-0301', label: 'gpt-3.5-turbo-0301' },
|
{ value: 'gpt-3.5-turbo-0301', label: 'gpt-3.5-turbo-0301' },
|
||||||
|
{ value: 'gpt-3.5-turbo-0613', label: 'gpt-3.5-turbo-0613' },
|
||||||
|
{ value: 'gpt-3.5-turbo-1106', label: 'gpt-3.5-turbo-1106' },
|
||||||
|
{ value: 'gpt-3.5-turbo-16k', label: 'gpt-3.5-turbo-16k' },
|
||||||
|
{ value: 'gpt-3.5-turbo-16k-0613', label: 'gpt-3.5-turbo-16k-0613' },
|
||||||
],
|
],
|
||||||
default: 'gpt-3.5-turbo',
|
default: 'gpt-3.5-turbo',
|
||||||
},
|
},
|
||||||
|
@@ -55,6 +55,7 @@ export const rebuildConversationStore = async() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const addConversation = action(conversationMap, 'addConversation', (map, instance?: Partial<Conversation>) => {
|
export const addConversation = action(conversationMap, 'addConversation', (map, instance?: Partial<Conversation>) => {
|
||||||
|
console.log(conversationMap,instance)
|
||||||
const instanceId = instance?.id || `id_${Date.now()}`
|
const instanceId = instance?.id || `id_${Date.now()}`
|
||||||
const conversation: Conversation = {
|
const conversation: Conversation = {
|
||||||
id: instanceId,
|
id: instanceId,
|
||||||
@@ -62,6 +63,7 @@ export const addConversation = action(conversationMap, 'addConversation', (map,
|
|||||||
name: instance?.name || '',
|
name: instance?.name || '',
|
||||||
icon: instance?.icon || '',
|
icon: instance?.icon || '',
|
||||||
lastUseTime: Date.now(),
|
lastUseTime: Date.now(),
|
||||||
|
systemInfo:instance?.systemInfo
|
||||||
}
|
}
|
||||||
map.setKey(instanceId, conversation)
|
map.setKey(instanceId, conversation)
|
||||||
db.setItem(instanceId, conversation)
|
db.setItem(instanceId, conversation)
|
||||||
|
Reference in New Issue
Block a user