Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions backend/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5083,6 +5083,61 @@ const docTemplate = `{
}
}
},
"/conversations/{id}/export": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "导出当前用户单个会话的元信息、消息、运行日志和可见处理轨迹",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"chat"
],
"summary": "导出会话 JSON",
"parameters": [
{
"type": "string",
"description": "会话 public_id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/internal_transport_http_conversation.ConversationExportResponseDoc"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/internal_transport_http_conversation.ErrorDoc"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/internal_transport_http_conversation.ErrorDoc"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/internal_transport_http_conversation.ErrorDoc"
}
}
}
}
},
"/conversations/{id}/messages": {
"get": {
"security": [
Expand Down Expand Up @@ -10937,6 +10992,72 @@ const docTemplate = `{
}
}
},
"internal_transport_http_conversation.ConversationExportCompatibilityResponse": {
"type": "object",
"properties": {
"format": {
"type": "string"
},
"notes": {
"type": "string"
}
}
},
"internal_transport_http_conversation.ConversationExportResponse": {
"type": "object",
"properties": {
"compatibility": {
"$ref": "#/definitions/internal_transport_http_conversation.ConversationExportCompatibilityResponse"
},
"conversation": {
"$ref": "#/definitions/internal_transport_http_conversation.ConversationResponse"
},
"defaultMessagePublicIDs": {
"type": "array",
"items": {
"type": "string"
}
},
"exportScope": {
"type": "string"
},
"exportedAt": {
"type": "string"
},
"messages": {
"type": "array",
"items": {
"$ref": "#/definitions/internal_transport_http_conversation.MessageResponse"
}
},
"runs": {
"type": "array",
"items": {
"$ref": "#/definitions/internal_transport_http_conversation.RunResponse"
}
},
"totalMessages": {
"type": "integer"
},
"totalRuns": {
"type": "integer"
},
"version": {
"type": "integer"
}
}
},
"internal_transport_http_conversation.ConversationExportResponseDoc": {
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/internal_transport_http_conversation.ConversationExportResponse"
},
"errorMsg": {
"type": "string"
}
}
},
"internal_transport_http_conversation.ConversationListResponseDoc": {
"type": "object",
"properties": {
Expand Down
121 changes: 121 additions & 0 deletions backend/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -5076,6 +5076,61 @@
}
}
},
"/conversations/{id}/export": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "导出当前用户单个会话的元信息、消息、运行日志和可见处理轨迹",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"chat"
],
"summary": "导出会话 JSON",
"parameters": [
{
"type": "string",
"description": "会话 public_id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/internal_transport_http_conversation.ConversationExportResponseDoc"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/internal_transport_http_conversation.ErrorDoc"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/internal_transport_http_conversation.ErrorDoc"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/internal_transport_http_conversation.ErrorDoc"
}
}
}
}
},
"/conversations/{id}/messages": {
"get": {
"security": [
Expand Down Expand Up @@ -10930,6 +10985,72 @@
}
}
},
"internal_transport_http_conversation.ConversationExportCompatibilityResponse": {
"type": "object",
"properties": {
"format": {
"type": "string"
},
"notes": {
"type": "string"
}
}
},
"internal_transport_http_conversation.ConversationExportResponse": {
"type": "object",
"properties": {
"compatibility": {
"$ref": "#/definitions/internal_transport_http_conversation.ConversationExportCompatibilityResponse"
},
"conversation": {
"$ref": "#/definitions/internal_transport_http_conversation.ConversationResponse"
},
"defaultMessagePublicIDs": {
"type": "array",
"items": {
"type": "string"
}
},
"exportScope": {
"type": "string"
},
"exportedAt": {
"type": "string"
},
"messages": {
"type": "array",
"items": {
"$ref": "#/definitions/internal_transport_http_conversation.MessageResponse"
}
},
"runs": {
"type": "array",
"items": {
"$ref": "#/definitions/internal_transport_http_conversation.RunResponse"
}
},
"totalMessages": {
"type": "integer"
},
"totalRuns": {
"type": "integer"
},
"version": {
"type": "integer"
}
}
},
"internal_transport_http_conversation.ConversationExportResponseDoc": {
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/internal_transport_http_conversation.ConversationExportResponse"
},
"errorMsg": {
"type": "string"
}
}
},
"internal_transport_http_conversation.ConversationListResponseDoc": {
"type": "object",
"properties": {
Expand Down
78 changes: 78 additions & 0 deletions backend/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2681,6 +2681,49 @@ definitions:
errorMsg:
type: string
type: object
internal_transport_http_conversation.ConversationExportCompatibilityResponse:
properties:
format:
type: string
notes:
type: string
type: object
internal_transport_http_conversation.ConversationExportResponse:
properties:
compatibility:
$ref: '#/definitions/internal_transport_http_conversation.ConversationExportCompatibilityResponse'
conversation:
$ref: '#/definitions/internal_transport_http_conversation.ConversationResponse'
defaultMessagePublicIDs:
items:
type: string
type: array
exportScope:
type: string
exportedAt:
type: string
messages:
items:
$ref: '#/definitions/internal_transport_http_conversation.MessageResponse'
type: array
runs:
items:
$ref: '#/definitions/internal_transport_http_conversation.RunResponse'
type: array
totalMessages:
type: integer
totalRuns:
type: integer
version:
type: integer
type: object
internal_transport_http_conversation.ConversationExportResponseDoc:
properties:
data:
$ref: '#/definitions/internal_transport_http_conversation.ConversationExportResponse'
errorMsg:
type: string
type: object
internal_transport_http_conversation.ConversationListResponseDoc:
properties:
data:
Expand Down Expand Up @@ -6807,6 +6850,41 @@ paths:
summary: 设置会话归档
tags:
- chat
/conversations/{id}/export:
get:
consumes:
- application/json
description: 导出当前用户单个会话的元信息、消息、运行日志和可见处理轨迹
parameters:
- description: 会话 public_id
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/internal_transport_http_conversation.ConversationExportResponseDoc'
"400":
description: Bad Request
schema:
$ref: '#/definitions/internal_transport_http_conversation.ErrorDoc'
"404":
description: Not Found
schema:
$ref: '#/definitions/internal_transport_http_conversation.ErrorDoc'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/internal_transport_http_conversation.ErrorDoc'
security:
- BearerAuth: []
summary: 导出会话 JSON
tags:
- chat
/conversations/{id}/messages:
get:
consumes:
Expand Down
19 changes: 19 additions & 0 deletions backend/internal/application/conversation/dto.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
package conversation

import (
"time"

model "github.com/DEEIX-AI/DEEIX-Chat/backend/internal/domain/conversation"
)

// ConversationExportResult 表示单会话 JSON 导出结果。
type ConversationExportResult struct {
Version int
ExportScope string
ExportedAt time.Time
Conversation *model.Conversation
Messages []model.Message
Runs []model.Run
TotalMessages int64
TotalRuns int64
DefaultMessagePublicIDs []string
}

// ChatFilePolicyDTO 聊天文件策略响应(内部传输,不携带序列化标记)。
type ChatFilePolicyDTO struct {
MaxMessageFiles int
Expand Down
Loading
Loading