chore: initialize qiming workspace repository

This commit is contained in:
Codex
2026-05-29 14:22:48 +08:00
commit bfd67a0f2c
10750 changed files with 1885711 additions and 0 deletions

View File

@@ -0,0 +1,84 @@
<template>
<view class="all-conversations">
<!-- 会话列表 -->
<view
class="conversation-item"
hover-class="hover-class"
hover-start-time="50"
v-for="item in chatList"
:key="item.id"
@click="onConversationClick(item)"
>
<text class="conversation-title text-ellipsis">{{ item.topic }}</text>
<text class="conversation-date">{{ formatDate(item.modified) }}</text>
</view>
<empty-state v-if="!chatList.length" />
</view>
</template>
<script setup lang="uts">
import type { ConversationInfo} from '@/types/interfaces/conversationInfo';
import { formatDate } from '@/utils/system';
import { jumpToAgentDetailPage } from '@/utils/commonBusiness';
interface Props{
chatList:ConversationInfo[],
isAppDetails: boolean,
}
// 接收组件属性,设置默认值
const props = withDefaults(defineProps<Props>(), {
chatList: [],
isAppDetails: false,
})
// 会话项点击处理
const onConversationClick = (item: ConversationInfo) => {
// 是否是应用详情页
if (props.isAppDetails) {
let url = `/subpackages/pages/app-details/app-details?id=${item.agentId}`;
if (item.id) {
url = url + "&conversationId=" + item.id;
}
uni.navigateTo({ url });
} else {
// 跳转到智能体详情页面,并传递消息数据
jumpToAgentDetailPage(item.agentId, item.id)
}
};
</script>
<style lang="scss" scoped>
.all-conversations {
.conversation-item {
height: 76rpx;
padding: 0 16rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
transition: background-color 0.2s;
gap: 32rpx;
border-radius: 16rpx;
&.hover-class {
background-color: rgba(12, 20, 102, 0.04);
}
.conversation-title {
color: #000;
font-size: 28rpx;
font-weight: 400;
flex: 1;
}
.conversation-date {
text-align: right;
font-size: 24rpx;
color: rgba(0, 0, 0, 0.45);
}
}
}
</style>

View File

@@ -0,0 +1,236 @@
<template>
<view
class="layout"
:class="className"
:style="{
backgroundColor: transparentBackground ? 'transparent' : backgroundColor,
}"
>
<!-- 微信安全区 -->
<safety-zone v-if="hasSafetyZone"></safety-zone>
<view class="nav-bar">
<!-- 左侧菜单按钮 -->
<view class="left-box">
<view class="menu-btn">
<text
v-if="showBack"
class="iconfont icon-a-Chevronleft"
@tap="onBackClick"
></text>
<slot name="left"></slot>
</view>
</view>
<!-- 中间 logo + 名称 -->
<view class="logo-wrap">
<view class="title-box">
<!-- 图标 -->
<view class="logo" v-if="icon">
<image
class="image"
:src="currentIcon"
mode="aspectFill"
:alt="displayTitle || t('Mobile.Common.agentIconAlt')"
@error="handleImageError"
></image>
</view>
<!-- 标题 -->
<text
class="title text-ellipsis"
:class="icon ? 'title-exist-icon' : 'title-no-icon'"
>{{ displayTitle }}</text
>
</view>
</view>
<!-- 右侧插槽 -->
<view class="right-box">
<slot name="right"></slot>
</view>
<!-- 微信胶囊按钮功能区 -->
<!-- #ifdef MP-WEIXIN -->
<view
v-if="false"
class="right-safety"
:style="{
width: clientRect.width + 'px',
height: clientRect.height + 'px',
}"
></view>
<!-- #endif -->
</view>
</view>
</template>
<script setup lang="uts">
import { chatService } from "@/utils/chatService";
import agentImage from "@/static/assets/agent_image.png";
import { translateText, useI18n } from "@/utils/i18n";
const { t } = useI18n();
// #ifdef MP-WEIXIN
const clientRect = uni.getMenuButtonBoundingClientRect();
// #endif
const props = defineProps({
title: {
type: String,
default: "",
},
icon: {
type: String,
default: "",
},
showBack: {
type: Boolean,
default: false,
},
className: {
type: String,
default: "",
},
hasSafetyZone: {
type: Boolean,
default: true,
},
// 背景是否透明
transparentBackground: {
type: Boolean,
default: false,
},
// 背景颜色
backgroundColor: {
type: String,
default: "#fff",
},
});
const displayTitle = computed(() => {
return translateText(props.title);
});
// 当前显示的图标(用于处理加载失败时使用默认图片)
const currentIcon = ref<string>(props.icon || agentImage);
const onBackClick = () => {
// 中止当前会话
chatService?.abort();
// 获取当前页面栈
const pages = getCurrentPages();
// 如果页面栈中有多个页面,正常返回
if (pages.length > 1) {
uni.navigateBack({
delta: 1,
});
return;
}
// 如果页面栈只有一个页面(浏览器刷新后),使用浏览器历史记录返回 如果没有历史记录,跳转到首页
uni.reLaunch({
url: "/pages/index/index",
});
};
/**
* 图片加载失败处理
* 当图片加载失败时,使用默认图片
*/
const handleImageError = () => {
currentIcon.value = agentImage;
};
// 监听 props.icon 变化,更新当前图标
watch(
() => props.icon,
(newIcon) => {
currentIcon.value = newIcon || agentImage;
},
{ immediate: true },
);
</script>
<style lang="scss" scoped>
.layout {
.nav-bar {
display: flex;
flex-direction: row;
align-items: center;
height: 90rpx;
padding: 20rpx;
box-sizing: border-box;
.left-box {
min-width: 30%;
align-items: start;
.menu-btn {
margin-right: 12rpx;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: start;
gap: 20rpx;
min-width: 0;
}
}
.logo-wrap {
flex: 1;
.title-box {
width: 100%;
margin: 0 auto;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
gap: 12rpx;
min-width: 0;
.logo {
width: 64rpx;
height: 64rpx;
border-radius: 50%;
overflow: hidden;
position: relative;
flex-shrink: 0;
.image {
position: absolute;
left: -3%;
top: -3%;
width: 106%;
height: 106%;
}
}
.title {
font-size: 32rpx;
font-weight: 600;
line-height: 48rpx;
color: rgba(21, 23, 31, 1);
&-exist-icon {
max-width: calc(100% - 64rpx - 12rpx);
text-align: left;
}
&-no-icon {
max-width: 100%;
text-align: center;
}
}
}
}
.right-box {
min-width: 30%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
}
}
}
</style>