Compare commits
2 Commits
7b4fb72cdc
...
1df9ee3cf2
| Author | SHA1 | Date |
|---|---|---|
|
|
1df9ee3cf2 | |
|
|
eff089c7ad |
|
|
@ -94,7 +94,7 @@ async def create_share_handler(data: dict):
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"id": share["id"],
|
"id": share["id"],
|
||||||
"shareUrl": f"/#/share/{share['id']}",
|
"shareUrl": f"/chat-ui/share/{share['id']}",
|
||||||
"expiresAt": share["expiresAt"],
|
"expiresAt": share["expiresAt"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -114,7 +114,7 @@ async def create_share_handler(data: dict):
|
||||||
conv_snapshot = {
|
conv_snapshot = {
|
||||||
"id": conv["id"],
|
"id": conv["id"],
|
||||||
"title": conv["title"],
|
"title": conv["title"],
|
||||||
"messages": conv.get("messages", [])[:100], # 限制消息数量
|
"messages": conv.get("messages", []),
|
||||||
"createdAt": conv["createdAt"],
|
"createdAt": conv["createdAt"],
|
||||||
"updatedAt": conv["updatedAt"],
|
"updatedAt": conv["updatedAt"],
|
||||||
}
|
}
|
||||||
|
|
@ -139,7 +139,7 @@ async def create_share_handler(data: dict):
|
||||||
# 返回分享信息
|
# 返回分享信息
|
||||||
return {
|
return {
|
||||||
"id": share["id"],
|
"id": share["id"],
|
||||||
"shareUrl": f"/#/share/{share['id']}",
|
"shareUrl": f"/chat-ui/share/{share['id']}",
|
||||||
"expiresAt": share["expiresAt"],
|
"expiresAt": share["expiresAt"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ describe('分享 API 测试', () => {
|
||||||
it('应该成功创建分享', async () => {
|
it('应该成功创建分享', async () => {
|
||||||
const mockResponse: ShareCreateResponse = {
|
const mockResponse: ShareCreateResponse = {
|
||||||
id: 'share-123',
|
id: 'share-123',
|
||||||
shareUrl: 'https://example.com/#/share/share-123',
|
shareUrl: 'https://example.com/chat-ui/share/share-123',
|
||||||
expiresAt: Date.now() + 7 * 24 * 60 * 60 * 1000,
|
expiresAt: Date.now() + 7 * 24 * 60 * 60 * 1000,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,7 @@
|
||||||
message.role === 'assistant' &&
|
message.role === 'assistant' &&
|
||||||
!message.isStreaming &&
|
!message.isStreaming &&
|
||||||
!message.isError &&
|
!message.isError &&
|
||||||
|
!readonly &&
|
||||||
!isMessageSelectMode
|
!isMessageSelectMode
|
||||||
"
|
"
|
||||||
:content="message.content.text || ''"
|
:content="message.content.text || ''"
|
||||||
|
|
@ -223,12 +224,14 @@ const props = withDefaults(
|
||||||
isNew?: boolean;
|
isNew?: boolean;
|
||||||
isMessageSelectMode?: boolean;
|
isMessageSelectMode?: boolean;
|
||||||
isSelected?: boolean;
|
isSelected?: boolean;
|
||||||
|
readonly?: boolean;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
showTimestamp: true,
|
showTimestamp: true,
|
||||||
compact: false,
|
compact: false,
|
||||||
isMessageSelectMode: false,
|
isMessageSelectMode: false,
|
||||||
isSelected: false,
|
isSelected: false,
|
||||||
|
readonly: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const { copy } = useClipboard({ legacy: true });
|
const { copy } = useClipboard({ legacy: true });
|
||||||
|
|
@ -488,7 +491,7 @@ setCustomComponents("playground-demo", {
|
||||||
|
|
||||||
// markstream-vue 样式覆盖
|
// markstream-vue 样式覆盖
|
||||||
.text-content {
|
.text-content {
|
||||||
:deep(p) {
|
:deep(p) {
|
||||||
margin: 0 0 12px;
|
margin: 0 0 12px;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
|
|
@ -664,15 +667,16 @@ setCustomComponents("playground-demo", {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.images-grid {
|
.images-flex {
|
||||||
display: grid;
|
display: inline-flex;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
flex-wrap: wrap;
|
||||||
gap: 8px;
|
gap: 7px;
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.image-item {
|
.image-item {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
width: 130px;
|
||||||
aspect-ratio: 1;
|
aspect-ratio: 1;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
|
||||||
|
|
@ -191,8 +191,8 @@ async function handleCreateShare() {
|
||||||
// 关闭当前模态框,打开结果模态框
|
// 关闭当前模态框,打开结果模态框
|
||||||
handleClose()
|
handleClose()
|
||||||
|
|
||||||
// 前端生成分享 URL
|
// 优先使用后端返回的路径,避免前后端各自拼接导致不一致
|
||||||
const shareUrl = `${window.location.origin}/chat-ui/share/${result.id}`
|
const shareUrl = new URL(result.shareUrl, window.location.origin).toString()
|
||||||
|
|
||||||
// 存储分享信息并打开结果模态框
|
// 存储分享信息并打开结果模态框
|
||||||
settingsStore.setShareResult({
|
settingsStore.setShareResult({
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router'
|
||||||
import HomeView from '@/views/HomeView.vue'
|
import HomeView from '@/views/HomeView.vue'
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory('/chat-ui/'),
|
history: createWebHistory('/'),
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@
|
||||||
:key="message.id"
|
:key="message.id"
|
||||||
:message="message"
|
:message="message"
|
||||||
:show-timestamp="true"
|
:show-timestamp="true"
|
||||||
|
:readonly="true"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue